Craig Andrews
2016-06-27 15:14:07 UTC
I think it would be great if postfix could include and install a systemd service.
Currently, each distribution is required to write its own systemd service. This situation is less than ideal because work is duplicated and there is a lot inconsistency. I think it makes more sense to develop the service definition upstream and include it as part of the postfix release so each distro has a solid, consistent, supported starting point, and distros can collaborate via the postfix project (ex, this mailing list) to improve the service over time.
I've attached a systemd service definition that I think would work well.
Note that I'm not suggesting that postfix link against systemd... just distribute the service definition and (perhaps optionally?) install it from postfix-install. :-)
Thanks,
~Craig
===postfix.service===
[Unit]
Description=Postfix Mail Transport Agent
After=syslog.target network.target
Conflicts=sendmail.service exim.service
[Service]
Type=forking
ExecStartPre=-/usr/bin/newaliases
ExecStart=/usr/sbin/postfix start
ExecStop=/usr/sbin/postfix stop
ExecReload=/usr/sbin/postfix reload
# Hardening
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=full
# Perhaps someone can suggest a tighter capability set, hopefully using whitelisting instead of blacklisting?
CapabilityBoundingSet=~ CAP_NET_ADMIN CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_MODULE
[Install]
WantedBy=multi-user.target
===end postfix.service===
Currently, each distribution is required to write its own systemd service. This situation is less than ideal because work is duplicated and there is a lot inconsistency. I think it makes more sense to develop the service definition upstream and include it as part of the postfix release so each distro has a solid, consistent, supported starting point, and distros can collaborate via the postfix project (ex, this mailing list) to improve the service over time.
I've attached a systemd service definition that I think would work well.
Note that I'm not suggesting that postfix link against systemd... just distribute the service definition and (perhaps optionally?) install it from postfix-install. :-)
Thanks,
~Craig
===postfix.service===
[Unit]
Description=Postfix Mail Transport Agent
After=syslog.target network.target
Conflicts=sendmail.service exim.service
[Service]
Type=forking
ExecStartPre=-/usr/bin/newaliases
ExecStart=/usr/sbin/postfix start
ExecStop=/usr/sbin/postfix stop
ExecReload=/usr/sbin/postfix reload
# Hardening
PrivateTmp=yes
PrivateDevices=yes
ProtectSystem=full
# Perhaps someone can suggest a tighter capability set, hopefully using whitelisting instead of blacklisting?
CapabilityBoundingSet=~ CAP_NET_ADMIN CAP_SYS_ADMIN CAP_SYS_BOOT CAP_SYS_MODULE
[Install]
WantedBy=multi-user.target
===end postfix.service===