mirror of
https://github.com/YunoHost-Apps/domoticz_ynh.git
synced 2024-09-03 18:26:17 +02:00
54 lines
2 KiB
Desktop File
54 lines
2 KiB
Desktop File
[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
|
|
WorkingDirectory=__FINALPATH__/
|
|
PermissionsStartOnly=true
|
|
ExecStartPre=setcap 'cap_net_bind_service=+ep cap_net_raw=+eip' __FINALPATH__/domoticz
|
|
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
|
|
#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 AF_BLUETOOTH
|
|
RestrictNamespaces=yes
|
|
RestrictRealtime=yes
|
|
#Same : restrict access to devices
|
|
#DevicePolicy=closed
|
|
ProtectSystem=full
|
|
ProtectControlGroups=yes
|
|
ProtectKernelModules=yes
|
|
ProtectKernelTunables=yes
|
|
LockPersonality=yes
|
|
#@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
|
|
#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
|
|
|
|
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|