GNU bug report logs - #77501
[PATCH] Restore logging of OpenSMTPd to /var/log/maillog.

Previous Next

Package: guix-patches;

Reported by: Felix Lechner <felix.lechner <at> lease-up.com>

Date: Thu, 3 Apr 2025 18:07:01 UTC

Severity: normal

Tags: patch

Done: Andreas Enge <andreas <at> enge.fr>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Felix Lechner <felix.lechner <at> lease-up.com>
To: 77501 <at> debbugs.gnu.org
Cc: Tomas Volf <~@wolfsden.cz>, Gabriel Wicki <gabriel <at> erlikon.ch>, Andreas Enge <andreas <at> enge.fr>, Felix Lechner <felix.lechner <at> lease-up.com>, Ludovic Courtès <ludo <at> gnu.org>, Maxim Cournoyer <maxim.cournoyer <at> gmail.com>
Subject: [bug#77501] [PATCH] Log OpenSMTPd to /var/log/mail.log via a configurable option. (Closes: #77501)
Date: Tue,  8 Apr 2025 14:32:27 -0700
Please also see this thread:

    https://lists.gnu.org/archive/html/help-guix/2025-04/msg00009.html

Change-Id: I485e040d680ccb39fa62e49d2e6ea916f047972c
---
Hi,

This was deployed briefly on production equipment and appears to work.

Kind regards
Felix

 doc/guix.texi         |  4 ++++
 gnu/services/mail.scm | 10 +++++++---
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/doc/guix.texi b/doc/guix.texi
index bee80cd4e2..c2640e5063 100644
--- a/doc/guix.texi
+++ b/doc/guix.texi
@@ -29219,6 +29219,10 @@ Mail Services
 users and daemons on the local machine, as well as permitting email to
 remote servers.  Run @command{man smtpd.conf} for more information.
 
+@item @code{log-file} (default: @code{"/var/log/mail.log"})
+The file location for the OpenSMTPD log file.  Logging occurs in the
+foreground via the Shepherd, i.e. OpenSMTPD does not detach.
+
 @item @code{setgid-commands?} (default: @code{#t})
 Make the following commands setgid to @code{smtpq} so they can be
 executed: @command{smtpctl}, @command{sendmail}, @command{send-mail},
diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm
index ee61887369..cf23f76bc7 100644
--- a/gnu/services/mail.scm
+++ b/gnu/services/mail.scm
@@ -1719,6 +1719,8 @@ (define-record-type* <opensmtpd-configuration>
                         (default '())) ; list of symbols
   (config-file opensmtpd-configuration-config-file
                (default %default-opensmtpd-config-file))
+  (log-file opensmtpd-configuration-log-file
+            (default "/var/log/mail.log"))
   (setgid-commands? opensmtpd-setgid-commands? (default #t)))
 
 (define %default-opensmtpd-config-file
@@ -1734,15 +1736,17 @@ (define %default-opensmtpd-config-file
 
 (define (opensmtpd-shepherd-service config)
   (match-record config <opensmtpd-configuration>
-                       (package config-file shepherd-requirement)
+                       (package config-file log-file shepherd-requirement)
     (list (shepherd-service
            (provision '(smtpd))
            (requirement `(pam loopback ,@shepherd-requirement))
            (documentation "Run the OpenSMTPD daemon.")
            (start (let ((smtpd (file-append package "/sbin/smtpd")))
                     #~(make-forkexec-constructor
-                       (list #$smtpd "-f" #$config-file)
-                       #:pid-file "/var/run/smtpd.pid")))
+                       (list #$smtpd
+                             "-d"
+                             "-f" #$config-file)
+                       #:log-file #$log-file)))
            (stop #~(make-kill-destructor))))))
 
 (define %opensmtpd-accounts

base-commit: c88f98bb3ca2616baea6b1e452cc900cc9c87503
-- 
2.49.0





This bug report was last modified 31 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.