aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTobias Geerinckx-Rice <me@tobias.gr>2024-08-18 02:00:00 +0200
committerTobias Geerinckx-Rice <me@tobias.gr>2024-08-18 02:00:00 +0200
commited3649bcce1ea0db5385744f9114d4b40d6dce55 (patch)
treefa27be2dec317aeb930ad931579e89de0a56239f
parent79833cdbc6832f1fc7d6b3c85afc824c5fc21be4 (diff)
downloadguix-ed3649bcce1ea0db5385744f9114d4b40d6dce55.tar
guix-ed3649bcce1ea0db5385744f9114d4b40d6dce55.tar.gz
services: Refactor opensmtpd-set-gids.
* gnu/services/mail.scm (opensmtpd-set-gids): Rewrite using MAP technology. Change-Id: I30b7eddaf64d242196b1c56f98dec42a86436c18
-rw-r--r--gnu/services/mail.scm45
1 files changed, 14 insertions, 31 deletions
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 <opensmtpd-configuration> (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