Project

General

Profile

Actions

Feature #14337

closed

Allow SMTP notifications from non-root processes

Added by Denny Page over 1 year ago. Updated 11 months ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
Notifications
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
23.09
Release Notes:
Default

Description

The changes to address #14031 removed the ability for non root processes to send notifications. This one line change restores that functionality:

--- notices.inc.old    2023-04-23 09:44:28.161806000 -0700
+++ notices.inc    2023-05-02 09:36:47.548761000 -0700
@@ -356,7 +356,7 @@

     /* Store last message sent to avoid spamming */
     @file_put_contents("/var/db/notices_lastmsg.txt", $message);
-    if (!$force) {
+    if ($force == false && posix_geteuid() == 0) {
         notify_via_queue_add($message, 'mail');
         $ret = true;
     } else {
Actions #1

Updated by Jim Pingle over 1 year ago

  • Tracker changed from Regression to Feature
  • Assignee set to Jim Pingle
  • Target version set to 2.7.0
  • Plus Target Version set to 23.09
  • Affected Version deleted (2.7.x)
  • Affected Architecture deleted (All)
Actions #2

Updated by Jim Pingle over 1 year ago

  • Target version changed from 2.7.0 to CE-Next
Actions #3

Updated by Jim Pingle about 1 year ago

  • Subject changed from Allow notifications non root processes to Allow SMTP notifications from non-root processes
  • Status changed from New to In Progress
  • Target version changed from CE-Next to 2.8.0

I have an alternate idea on how to fix this and (hopefully) also preserve the duplicate message suppression. There is also quite a bit of code in notices.inc that needs updated for PHP 8.x.

I'm partway through making the necessary changes here and then I need to test it quite a bit before I commit it.

Actions #4

Updated by Denny Page about 1 year ago

Thanks Jim

Actions #5

Updated by Jim Pingle about 1 year ago

  • Status changed from In Progress to Feedback
  • % Done changed from 0 to 100
Actions #6

Updated by Jim Pingle about 1 year ago

With the changes I just pushed, I get working SMTP notifications from NUT as well as other users. No duplicates/loops or any other issues that I can see thus far.

No changes need to be made to nut or anything else that sends notifications, it's all handled on the backend.

Not 100% fond of the solution but it's not any worse off than it was before.

Actions #7

Updated by Jim Pingle about 1 year ago

  • Status changed from Feedback to Resolved

Seems to be working as expected on dev snapshots.

Actions #8

Updated by Jim Pingle 11 months ago

  • Target version changed from 2.8.0 to 2.7.1
Actions

Also available in: Atom PDF