| 1 |
[Unit] |
| 2 |
Description=nagios4 |
| 3 |
Documentation=man:nagios4 |
| 4 |
|
| 5 |
[Service] |
| 6 |
Environment=NAGIOSCFG="/etc/nagios4/nagios.cfg" |
| 7 |
EnvironmentFile=/etc/default/nagios4 |
| 8 |
ExecStartPre=sh -c 'nagiospipe=$$(sed -n "s/^command_file=\\(.*\\)/\\1/p" ${NAGIOSCFG}); [ -z "$${nagiospipe}" -o ! -e "$${nagiospipe}" ] || rm -f "$${nagiospipe}"' |
| 9 |
ExecStart=/usr/sbin/nagios4 ${NAGIOSCFG} |
| 10 |
ExecStopPost=sh -c 'nagiospipe=$$(sed -n "s/^command_file=\\(.*\\)/\\1/p" ${NAGIOSCFG}); [ -z "$${nagiospipe}" -o ! -e "$${nagiospipe}" ] || rm -f "$${nagiospipe}"' |
| 11 |
ExecReload=/bin/kill -HUP $MAINPID |
| 12 |
KillMode=mixed |
| 13 |
PIDFile=/run/nagios4/nagios.pid |
| 14 |
|
| 15 |
# Hardening. NoNewPrivileges is deliberately not set: plugins like |
| 16 |
# check_ping invoke /bin/ping which relies on cap_net_raw file |
| 17 |
# capabilities, and NoNewPrivileges would strip them. MemoryDenyWriteExecute |
| 18 |
# is also omitted because it can break PHP/Perl event-broker modules. |
| 19 |
ProtectSystem=full |
| 20 |
ProtectHome=true |
| 21 |
PrivateTmp=true |
| 22 |
ProtectKernelTunables=true |
| 23 |
ProtectKernelModules=true |
| 24 |
ProtectControlGroups=true |
| 25 |
RestrictSUIDSGID=true |
| 26 |
LockPersonality=true |
| 27 |
RestrictRealtime=true |
| 28 |
RestrictNamespaces=true |
| 29 |
SystemCallArchitectures=native |
| 30 |
|
| 31 |
[Install] |
| 32 |
WantedBy=multi-user.target |