[Unit] Description=nagios4 Documentation=man:nagios4 [Service] Environment=NAGIOSCFG="/etc/nagios4/nagios.cfg" EnvironmentFile=/etc/default/nagios4 ExecStartPre=sh -c 'nagiospipe=$$(sed -n "s/^command_file=\\(.*\\)/\\1/p" ${NAGIOSCFG}); [ -z "$${nagiospipe}" -o ! -e "$${nagiospipe}" ] || rm -f "$${nagiospipe}"' ExecStart=/usr/sbin/nagios4 ${NAGIOSCFG} ExecStopPost=sh -c 'nagiospipe=$$(sed -n "s/^command_file=\\(.*\\)/\\1/p" ${NAGIOSCFG}); [ -z "$${nagiospipe}" -o ! -e "$${nagiospipe}" ] || rm -f "$${nagiospipe}"' ExecReload=/bin/kill -HUP $MAINPID KillMode=mixed PIDFile=/run/nagios4/nagios.pid # Hardening. NoNewPrivileges is deliberately not set: plugins like # check_ping invoke /bin/ping which relies on cap_net_raw file # capabilities, and NoNewPrivileges would strip them. MemoryDenyWriteExecute # is also omitted because it can break PHP/Perl event-broker modules. ProtectSystem=full ProtectHome=true PrivateTmp=true ProtectKernelTunables=true ProtectKernelModules=true ProtectControlGroups=true RestrictSUIDSGID=true LockPersonality=true RestrictRealtime=true RestrictNamespaces=true SystemCallArchitectures=native [Install] WantedBy=multi-user.target