From patchwork Tue Apr 8 21:32:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Felix Lechner X-Patchwork-Id: 41472 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3B68F27BC4B; Tue, 8 Apr 2025 22:36:36 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H2, RCVD_IN_VALIDITY_CERTIFIED,RCVD_IN_VALIDITY_RPBL,RCVD_IN_VALIDITY_SAFE, SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 4337327BC49 for ; Tue, 8 Apr 2025 22:36:35 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1u2Gc8-0001N7-VF; Tue, 08 Apr 2025 17:36:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1u2Gc0-0001Mg-7J for guix-patches@gnu.org; Tue, 08 Apr 2025 17:36:05 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1u2Gbz-0005lq-1D; Tue, 08 Apr 2025 17:36:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:In-Reply-To:References:Subject; bh=Z82Iq6wcGQGGiqGXINhz9hTy1AcqCayGQ9pUjhR2HCg=; b=fWeaGGLdy7bL6CTjfSoKmas6jeQ7lUUS9RzGfxtF9Uaf6UMJqpBF+tQugRpYPGk4Ga1kIFd7CFj8v5kZQ51y6L+jRyJFlycb11oUoFpDtA5hSVrqYHZibri8tHLJfRBmAc43dn7b86tFV9P/PqOMFbogNRho/8aUvVhhMHAU54G37vDIg5+CYGf7DbJqeOdHMn1gl7EQvJ6bL2PE2oymcjEtjzp/KgVdqDV9uV0cSyj9rlgPja8Bqj732nFFOKxnndrvl8JnFAmar0pTlg6gq5phvsPWxKLxH/PO37qg8mIOHvpn1xyse5wl/o7OQTVFCH/3q692o4RabIF0+QHOTg==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1u2Gbx-0008QM-U4; Tue, 08 Apr 2025 17:36:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#77501] [PATCH] Log OpenSMTPd to /var/log/mail.log via a configurable option. (Closes: #77501) References: <8f60a2b7cd79da8cf4853affbdb2db4e7394c68c.1743703468.git.felix.lechner@lease-up.com> In-Reply-To: <8f60a2b7cd79da8cf4853affbdb2db4e7394c68c.1743703468.git.felix.lechner@lease-up.com> Resent-From: Felix Lechner Original-Sender: "Debbugs-submit" Resent-CC: ludo@gnu.org, maxim.cournoyer@gmail.com, guix-patches@gnu.org Resent-Date: Tue, 08 Apr 2025 21:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 77501 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 77501@debbugs.gnu.org Cc: Tomas Volf <~@wolfsden.cz>, Gabriel Wicki , Andreas Enge , Felix Lechner , Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer X-Debbugs-Original-Xcc: Ludovic =?utf-8?q?Court=C3=A8s?= , Maxim Cournoyer Received: via spool by 77501-submit@debbugs.gnu.org id=B77501.174414810331923 (code B ref 77501); Tue, 08 Apr 2025 21:36:01 +0000 Received: (at 77501) by debbugs.gnu.org; 8 Apr 2025 21:35:03 +0000 Received: from localhost ([127.0.0.1]:35837 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1u2Gb1-0008Ip-9P for submit@debbugs.gnu.org; Tue, 08 Apr 2025 17:35:03 -0400 Received: from sail-ipv4.us-core.com ([208.82.101.137]:56888) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1u2Gax-0008II-RY for 77501@debbugs.gnu.org; Tue, 08 Apr 2025 17:35:00 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; s=2017; bh=/Ku3f9+u94K5pFF dYZ+vA5FgjJw6clPXF0ObsI3pM8o=; h=date:subject:cc:to:from; d=lease-up.com; b=j8maW/lQvIJtJgGcp9ivzxJVb0g1WLKF+cjj3+g3Ce1MTh9aKtvA 51i4vQfQphnM+rko4AyBCC9+MdL+0m8lCCZDCFlwoCiMjw0oE5Ytia3ZJ7KZu6VpQtwPw0 Tjf7TJdFmEUtxP08isxjh214zvuA3lfWsekeZsMU00CsBsLNU= Received: by sail-ipv4.us-core.com (OpenSMTPD) with ESMTPSA id 329400b9 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Tue, 8 Apr 2025 21:34:55 +0000 (UTC) Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id b0cc682a; Tue, 8 Apr 2025 21:34:54 +0000 (UTC) Date: Tue, 8 Apr 2025 14:32:27 -0700 Message-ID: X-Mailer: git-send-email 2.49.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-to: Felix Lechner X-ACL-Warn: , Felix Lechner via Guix-patches X-Patchwork-Original-From: Felix Lechner via Guix-patches via From: Felix Lechner Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches 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(-) base-commit: c88f98bb3ca2616baea6b1e452cc900cc9c87503 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* (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 - (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