1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/domoticz_ynh.git synced 2024-09-03 18:26:17 +02:00
domoticz_ynh/conf/systemd.service

55 lines
2 KiB
SYSTEMD
Raw Normal View History

2020-10-05 23:05:58 +02:00
[Unit]
Description=domoticz_service
After=network.target
[Service]
User=__APP__
Group=__APP__
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
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
# 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
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
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
# 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
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
2020-10-05 23:05:58 +02:00
[Install]
WantedBy=multi-user.target