From ed3649bcce1ea0db5385744f9114d4b40d6dce55 Mon Sep 17 00:00:00 2001 From: Tobias Geerinckx-Rice Date: Sun, 18 Aug 2024 02:00:00 +0200 Subject: services: Refactor opensmtpd-set-gids. * gnu/services/mail.scm (opensmtpd-set-gids): Rewrite using MAP technology. Change-Id: I30b7eddaf64d242196b1c56f98dec42a86436c18 --- gnu/services/mail.scm | 45 ++++++++++++++------------------------------- 1 file changed, 14 insertions(+), 31 deletions(-) (limited to 'gnu') diff --git a/gnu/services/mail.scm b/gnu/services/mail.scm index dd0fa59a69..18b482272c 100644 --- a/gnu/services/mail.scm +++ b/gnu/services/mail.scm @@ -1743,37 +1743,20 @@ match from local for any action outbound (define (opensmtpd-set-gids config) (match-record config (package config-file setgid-commands?) (if setgid-commands? - (list - (privileged-program - (program (file-append package "/sbin/smtpctl")) - (setuid? #false) - (setgid? #true) - (group "smtpq")) - (privileged-program - (program (file-append package "/sbin/sendmail")) - (setuid? #false) - (setgid? #true) - (group "smtpq")) - (privileged-program - (program (file-append package "/sbin/send-mail")) - (setuid? #false) - (setgid? #true) - (group "smtpq")) - (privileged-program - (program (file-append package "/sbin/makemap")) - (setuid? #false) - (setgid? #true) - (group "smtpq")) - (privileged-program - (program (file-append package "/sbin/mailq")) - (setuid? #false) - (setgid? #true) - (group "smtpq")) - (privileged-program - (program (file-append package "/sbin/newaliases")) - (setuid? #false) - (setgid? #true) - (group "smtpq"))) + (map (lambda (command) + (privileged-program + (program (file-append package "/" command)) + (setgid? #t) + (group "smtpq"))) + (list "sbin/smtpctl" + + ;; Also privilege the compatibility symlinks created by + ;; the Guix opensmtpd package; all synonyms for smtpctl. + "sbin/mailq" + "sbin/makemap" + "sbin/newaliases" + "sbin/sendmail" + "sbin/send-mail")) '()))) (define opensmtpd-service-type -- cgit v1.2.3