2020-10-05 23:05:58 +02:00
|
|
|
[Unit]
|
|
|
|
Description=domoticz_service
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
User=__APP__
|
|
|
|
Group=__APP__
|
2022-11-28 23:09:34 +01:00
|
|
|
ExecStart=__FINALPATH__/domoticz -www __PORT__ -sslwww 0 -log /var/log/__APP__/__APP__.log -loglevel normal,status,error
|
2020-10-05 23:05:58 +02:00
|
|
|
WorkingDirectory=__FINALPATH__/
|
|
|
|
PermissionsStartOnly=true
|
2021-01-27 09:05:36 +01:00
|
|
|
ExecStartPre=setcap 'cap_net_bind_service=+ep cap_net_raw=+eip' __FINALPATH__/domoticz
|
2020-10-05 23:05:58 +02:00
|
|
|
Restart=on-failure
|
|
|
|
RestartSec=1m
|
|
|
|
#StandardOutput=null
|
2022-04-24 23:58:20 +02:00
|
|
|
|
|
|
|
# Sandboxing options to harden security
|
|
|
|
# Depending on specificities of your service/app, you may need to tweak these
|
|
|
|
# .. but this should be a good baseline
|
|
|
|
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
|
|
|
NoNewPrivileges=yes
|
|
|
|
PrivateTmp=yes
|
2022-05-30 23:07:31 +02:00
|
|
|
#Private device restrict access to device in /dev/, so to any devices like razberry, zigate, etc.
|
|
|
|
#PrivateDevices=yes
|
2022-04-24 23:58:20 +02:00
|
|
|
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
|
|
|
|
RestrictNamespaces=yes
|
|
|
|
RestrictRealtime=yes
|
2022-05-30 23:18:09 +02:00
|
|
|
#Same : restrict access to devices
|
|
|
|
#DevicePolicy=closed
|
2022-04-24 23:58:20 +02:00
|
|
|
ProtectSystem=full
|
|
|
|
ProtectControlGroups=yes
|
|
|
|
ProtectKernelModules=yes
|
|
|
|
ProtectKernelTunables=yes
|
|
|
|
LockPersonality=yes
|
2022-06-01 22:43:51 +02:00
|
|
|
#@setuid prevent system call such as ping or other command lines
|
|
|
|
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @swap
|
|
|
|
#SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap
|
2022-04-24 23:58:20 +02:00
|
|
|
|
|
|
|
# Denying access to capabilities that should not be relevant for webapps
|
|
|
|
# Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
|
|
|
|
CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
|
|
|
|
CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
|
|
|
|
CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
|
|
|
|
CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
|
|
|
|
CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
|
|
|
|
CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
|
|
|
|
CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
|
2022-05-22 19:15:23 +02:00
|
|
|
#Has to be commented as prevent the service to run
|
|
|
|
#CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
|
2022-04-24 23:58:20 +02:00
|
|
|
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
|
|
|
|
|
|
|
|
|
|
|
|
|
2020-10-05 23:05:58 +02:00
|
|
|
[Install]
|
2021-01-27 09:05:36 +01:00
|
|
|
WantedBy=multi-user.target
|