systemd.service 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. [Unit]
  2. Description=Homarr: customizable home page
  3. After=network.target
  4. [Service]
  5. Type=simple
  6. User=__APP__
  7. Group=__APP__
  8. WorkingDirectory=__INSTALL_DIR__/
  9. Environment="__YNH_NODE_LOAD_PATH__"
  10. #Environment="PATH=ENV_PATH"
  11. Environment="NODE_ENV=production"
  12. #Environment="PORT=__PORT__"
  13. ExecStart=/usr/bin/yarn start
  14. Restart=on-failure
  15. RestartSec=5
  16. StartLimitInterval=60s
  17. StartLimitBurst=3
  18. # Sandboxing options to harden security
  19. # Depending on specificities of your service/app, you may need to tweak these
  20. # .. but this should be a good baseline
  21. # Details for these options: https://www.freedesktop.org/software/systemd/man/systemd.exec.html
  22. NoNewPrivileges=yes
  23. PrivateTmp=yes
  24. PrivateDevices=yes
  25. RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6 AF_NETLINK
  26. RestrictNamespaces=yes
  27. RestrictRealtime=yes
  28. DevicePolicy=closed
  29. ProtectClock=yes
  30. ProtectHostname=yes
  31. ProtectProc=invisible
  32. ProtectSystem=full
  33. ProtectControlGroups=yes
  34. ProtectKernelModules=yes
  35. ProtectKernelTunables=yes
  36. LockPersonality=yes
  37. SystemCallArchitectures=native
  38. SystemCallFilter=~@clock @debug @module @mount @obsolete @reboot @setuid @swap @cpu-emulation @privileged
  39. # Denying access to capabilities that should not be relevant for webapps
  40. # Doc: https://man7.org/linux/man-pages/man7/capabilities.7.html
  41. CapabilityBoundingSet=~CAP_RAWIO CAP_MKNOD
  42. CapabilityBoundingSet=~CAP_AUDIT_CONTROL CAP_AUDIT_READ CAP_AUDIT_WRITE
  43. CapabilityBoundingSet=~CAP_SYS_BOOT CAP_SYS_TIME CAP_SYS_MODULE CAP_SYS_PACCT
  44. CapabilityBoundingSet=~CAP_LEASE CAP_LINUX_IMMUTABLE CAP_IPC_LOCK
  45. CapabilityBoundingSet=~CAP_BLOCK_SUSPEND CAP_WAKE_ALARM
  46. CapabilityBoundingSet=~CAP_SYS_TTY_CONFIG
  47. CapabilityBoundingSet=~CAP_MAC_ADMIN CAP_MAC_OVERRIDE
  48. CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
  49. CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
  50. [Install]
  51. WantedBy=multi-user.target