2 Description=Postfix Mail Transport Agent (main/default instance)
 
   3 Documentation=man:postfix(1)
 
   4 After=network.target nss-lookup.target
 
   5 # network-online.target is a semi-working work-around for specific
 
   6 # network_interfaces, https://bugs.debian.org/854475#126
 
   7 # Please add local override wanting network-online.target or
 
   8 # systemd-networkd-wait-online@INTERFACE:no-carrier.service
 
   9 #After=network-online.target
 
  10 #Wants=network-online.target
 
  11 ConditionPathExists=/etc/postfix/main.cf
 
  12 # pre-3.9.1-7 multi-instance setup:
 
  13 Conflicts=postfix@-.service
 
  17 # Force operations on single default instance, do not run postmulti wrapper
 
  18 Environment=MAIL_CONFIG=/etc/postfix
 
  19 # perform 2-stage startup
 
  20 ExecStartPre=+postfix check
 
  21 ExecStart=postfix debian-systemd-start
 
  23 ExecReload=postfix reload
 
  25 # Postfix consists of multiple processes run by a master(8) orchestrator,
 
  26 # each of them having different requirements.  From the whole set, local(8)
 
  27 # (the Postfix local delivery agent) is the most demanding one, because it
 
  28 # runs things as user, and a user needs to be able to run suid/sgid programs
 
  29 # (if not only to be able to deliver mail to /var/spool/postfix/postdrop).
 
  30 # Individual Postfix daemons are started as root, optionally perform chroot
 
  31 # into the queue directory, and drop privileges voluntary
 
  33 # listen(2) on privileged ports (smtp)
 
  34 CapabilityBoundingSet=CAP_NET_BIND_SERVICE
 
  35 # chroot into queue dir
 
  36 CapabilityBoundingSet=CAP_SYS_CHROOT
 
  37 # drop root privs, run as user when delivering local mail
 
  38 CapabilityBoundingSet=CAP_SETGID CAP_SETUID
 
  39 # processes access protected files in non-root-owned dirs (acl root:rwx);
 
  40 CapabilityBoundingSet=CAP_DAC_OVERRIDE
 
  41 # https://bugs.debian.org/1099891 :
 
  42 CapabilityBoundingSet=CAP_DAC_READ_SEARCH
 
  43 # chown(2) is needed for procmal &Co to create /var/mail/$USER
 
  44 CapabilityBoundingSet=CAP_CHOWN
 
  46 # users might run suid/sgid programs from ~/.forward:
 
  48 # for the same reason, NoNewPrivileges can not be set to yes
 
  51 # if you don't use procmail for delivery to /var/mail/$USER,
 
  52 # CAP_CHOWN can be removed.
 
  53 # if you don't use local(8) at all, only doing local delivery over LMTP
 
  54 # or using virtual(8), you can also set
 
  57 # Also, CAP_DAC_OVERRIDE can be eliminated by adding root user to ACL to
 
  58 # postfix-owned dis in spool: public, private; and whatever maps in protected
 
  59 # subdirs you use, relying on cap_dac_override
 
  62 MemoryDenyWriteExecute=yes
 
  63 ProtectControlGroups=yes
 
  68 ProtectKernelModules=yes
 
  69 ProtectKernelTunables=yes
 
  70 # ProtectProc is not usable with User=root:
 
  73 # ProtectSystem can be "yes" if rw maps are in /etc, or "full"
 
  74 # Alternative would be "strict" +ReadWritePaths=/var
 
  76 # Need to write to ~/Maildir/ etc:
 
  78 RestrictAddressFamilies=AF_UNIX AF_NETLINK AF_INET AF_INET6
 
  79 RestrictNamespaces=yes
 
  82 SystemCallFilter=@system-service @setuid chroot
 
  85 WantedBy=multi-user.target