2020-10-05 23:05:58 +02:00
|
|
|
[Unit]
|
|
|
|
Description=domoticz_service
|
|
|
|
After=network.target
|
|
|
|
|
|
|
|
[Service]
|
|
|
|
User=__APP__
|
|
|
|
Group=__APP__
|
2023-02-20 22:22:42 +01:00
|
|
|
ExecStart=__INSTALL_DIR__/domoticz -www __PORT__ -sslwww 0 -log /var/log/__APP__/__APP__.log -loglevel normal,status,error
|
|
|
|
WorkingDirectory=__INSTALL_DIR__/
|
2023-02-27 23:24:05 +01:00
|
|
|
ExecStartPre=+setcap 'cap_net_bind_service=+ep cap_net_raw=+eip' __INSTALL_DIR__/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
|
|
|
|
# Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
|
2023-02-27 23:24:05 +01:00
|
|
|
NoNewPrivileges=yes
|
2022-04-24 23:58:20 +02:00
|
|
|
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
|
2023-02-25 08:29:56 +01:00
|
|
|
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_BLUETOOTH
|
2023-02-27 23:24:05 +01:00
|
|
|
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
|
2023-02-27 23:24:05 +01:00
|
|
|
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
|
2023-02-27 23:24:05 +01:00
|
|
|
SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @swap
|
2022-06-01 22:43:51 +02:00
|
|
|
#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
|