opensmtpd: fix offline enqueueing (#491938)

This commit is contained in:
Sandro
2026-03-01 03:42:39 +00:00
committed by GitHub
3 changed files with 47 additions and 8 deletions
+15 -6
View File
@@ -105,12 +105,21 @@ in
};
};
security.wrappers.smtpctl = {
owner = "root";
group = "smtpq";
setuid = false;
setgid = true;
source = "${cfg.package}/bin/smtpctl";
security.wrappers = {
makemap = {
owner = "root";
group = "smtpq";
setuid = false;
setgid = true;
source = "${cfg.package}/bin/smtpctl";
};
smtpctl = {
owner = "root";
group = "smtpq";
setuid = false;
setgid = true;
source = "${cfg.package}/bin/smtpctl";
};
};
services.mail.sendmailSetuidWrapper = lib.mkIf cfg.setSendmail (
+20
View File
@@ -0,0 +1,20 @@
Commit ID: 0527fcb65d6af4271a33dbd425f30d457fc7ab4f
Change ID: puqrnyuutmspqxqtkkqqrsmsxnyqvomm
Author : Ricardo Correia <someplaceguy@wizy.org> (2026-02-18 23:51:00)
Committer: Ricardo Correia <someplaceguy@wizy.org> (2026-02-19 00:43:47)
(no description set)
diff --git a/usr.sbin/smtpd/smtpd.c b/usr.sbin/smtpd/smtpd.c
index 2365b1ee46..b9e40e1417 100644
--- a/usr.sbin/smtpd/smtpd.c
+++ b/usr.sbin/smtpd/smtpd.c
@@ -1806,7 +1806,7 @@
envp[1] = (char *)NULL;
environ = envp;
- execvp(PATH_SMTPCTL, args.list);
+ execvp(@@PATH_SENDMAIL@@, args.list);
_exit(1);
}
+12 -2
View File
@@ -14,6 +14,7 @@
pam,
libxcrypt,
nixosTests,
binPath ? "/run/wrappers/bin",
}:
stdenv.mkDerivation (finalAttrs: {
@@ -43,11 +44,20 @@ stdenv.mkDerivation (finalAttrs: {
patches = [
./proc_path.diff # TODO: upstream to OpenSMTPD, see https://github.com/NixOS/nixpkgs/issues/54045
./offline.patch
];
postPatch = ''
substituteInPlace mk/smtpctl/Makefile.am --replace "chgrp" "true"
substituteInPlace mk/smtpctl/Makefile.am --replace "chmod 2555" "chmod 0555"
substituteInPlace mk/smtpctl/Makefile.am \
--replace-fail "chgrp" "true" \
--replace "chmod 2555" "chmod 0555"
substituteInPlace mk/pathnames \
--replace-fail "-DPATH_SMTPCTL=\\\"\$(sbindir)" \
"-DPATH_SMTPCTL=\\\"${binPath}" \
--replace-fail "-DPATH_MAKEMAP=\\\"\$(sbindir)" \
"-DPATH_MAKEMAP=\\\"${binPath}"
substituteInPlace usr.sbin/smtpd/smtpd.c \
--replace-fail "@@PATH_SENDMAIL@@" "\"${binPath}/sendmail\""
'';
configureFlags = [