Merge pull request #255227 from tomfitzhenry/postfix-harden

nixos/postfix: add systemd hardening directives
This commit is contained in:
Nick Cao 2023-12-23 10:36:18 -05:00 committed by GitHub
commit a83ee8f514
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -779,6 +779,19 @@ in
ExecStart = "${pkgs.postfix}/bin/postfix start";
ExecStop = "${pkgs.postfix}/bin/postfix stop";
ExecReload = "${pkgs.postfix}/bin/postfix reload";
# Hardening
PrivateTmp = true;
PrivateDevices = true;
ProtectSystem = "full";
CapabilityBoundingSet = [ "~CAP_NET_ADMIN CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_MODULE" ];
MemoryDenyWriteExecute = true;
ProtectKernelModules = true;
ProtectKernelTunables = true;
ProtectControlGroups = true;
RestrictAddressFamilies = [ "AF_INET" "AF_INET6" "AF_NETLINK" "AF_UNIX" ];
RestrictNamespaces = true;
RestrictRealtime = true;
};
};