Skip to content

Commit 17b5150

Browse files
authored
Revert "nixos/dovecot: improve and harden systemd unit" (#422817)
Users reported issues with this changeset in #418722.
2 parents a697a03 + a794031 commit 17b5150

2 files changed

Lines changed: 5 additions & 51 deletions

File tree

nixos/modules/services/mail/dovecot.nix

Lines changed: 4 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -692,67 +692,23 @@ in
692692

693693
environment.etc."dovecot/dovecot.conf".source = cfg.configFile;
694694

695-
systemd.services.dovecot = {
696-
aliases = [ "dovecot2.service" ];
695+
systemd.services.dovecot2 = {
697696
description = "Dovecot IMAP/POP3 server";
698-
documentation = [
699-
"man:dovecot(1)"
700-
"https://doc.dovecot.org"
701-
];
702697

703698
after = [ "network.target" ];
704699
wantedBy = [ "multi-user.target" ];
705-
restartTriggers = [ cfg.configFile ];
700+
restartTriggers = [
701+
cfg.configFile
702+
];
706703

707704
startLimitIntervalSec = 60; # 1 min
708705
serviceConfig = {
709706
Type = "notify";
710707
ExecStart = "${dovecotPkg}/sbin/dovecot -F";
711708
ExecReload = "${dovecotPkg}/sbin/doveadm reload";
712-
713-
CapabilityBoundingSet = [
714-
"CAP_CHOWN"
715-
"CAP_DAC_OVERRIDE"
716-
"CAP_FOWNER"
717-
"CAP_NET_BIND_SERVICE"
718-
"CAP_SETGID"
719-
"CAP_SETUID"
720-
"CAP_SYS_CHROOT"
721-
"CAP_SYS_RESOURCE"
722-
];
723-
LockPersonality = true;
724-
MemoryDenyWriteExecute = true;
725-
NoNewPrivileges = true;
726-
OOMPolicy = "continue";
727-
PrivateTmp = true;
728-
ProcSubset = "pid";
729-
ProtectClock = true;
730-
ProtectControlGroups = true;
731-
ProtectHome = lib.mkDefault false;
732-
ProtectHostname = true;
733-
ProtectKernelLogs = true;
734-
ProtectKernelModules = true;
735-
ProtectKernelTunables = true;
736-
ProtectProc = "invisible";
737-
ProtectSystem = "full";
738-
PrivateDevices = true;
739709
Restart = "on-failure";
740710
RestartSec = "1s";
741-
RestrictAddressFamilies = [
742-
"AF_INET"
743-
"AF_INET6"
744-
"AF_UNIX"
745-
];
746-
RestrictNamespaces = true;
747-
RestrictRealtime = true;
748-
RestrictSUIDSGID = false; # sets sgid on maildirs
749711
RuntimeDirectory = [ "dovecot2" ];
750-
SystemCallArchitectures = "native";
751-
SystemCallFilter = [
752-
"@system-service @resources"
753-
"~@privileged"
754-
"@chown @setuid capset chroot"
755-
];
756712
};
757713

758714
# When copying sieve scripts preserve the original time stamp

nixos/tests/dovecot.nix

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,11 @@
8484

8585
testScript = ''
8686
machine.wait_for_unit("postfix.service")
87-
machine.wait_for_unit("dovecot.service")
87+
machine.wait_for_unit("dovecot2.service")
8888
machine.succeed("send-testmail")
8989
machine.succeed("send-lda")
9090
machine.wait_until_fails('[ "$(postqueue -p)" != "Mail queue is empty" ]')
9191
machine.succeed("test-imap")
9292
machine.succeed("test-pop")
93-
94-
machine.log(machine.succeed("systemd-analyze security dovecot.service | grep -v ✓"))
9593
'';
9694
}

0 commit comments

Comments
 (0)