2017-04-08 02:04:27 +00:00
|
|
|
[Unit]
|
2020-12-11 13:40:13 +00:00
|
|
|
Description=__APP__-web
|
|
|
|
|
After=network.target
|
2017-04-08 02:04:27 +00:00
|
|
|
|
|
|
|
|
[Service]
|
2020-12-11 13:40:13 +00:00
|
|
|
Type=simple
|
|
|
|
|
User=__APP__
|
2024-02-24 22:28:27 +00:00
|
|
|
WorkingDirectory=__INSTALL_DIR__/live
|
2020-12-11 13:40:13 +00:00
|
|
|
Environment="RAILS_ENV=production"
|
|
|
|
|
Environment="PORT=__PORT_WEB__"
|
2024-12-28 00:29:20 +00:00
|
|
|
Environment="__LD_PRELOAD__"
|
2022-05-29 13:54:35 +00:00
|
|
|
Environment="__YNH_RUBY_LOAD_PATH__"
|
2024-02-24 22:28:27 +00:00
|
|
|
ExecStart=__INSTALL_DIR__/live/bin/bundle exec puma -C config/puma.rb
|
2020-12-11 13:40:13 +00:00
|
|
|
ExecReload=/bin/kill -SIGUSR1 $MAINPID
|
|
|
|
|
TimeoutSec=15
|
|
|
|
|
Restart=always
|
2024-02-24 22:28:27 +00:00
|
|
|
StandardOutput=append:/var/log/__APP__/__APP__-web.log
|
|
|
|
|
StandardError=inherit
|
2017-04-08 02:04:27 +00:00
|
|
|
|
2024-12-28 00:29:20 +00:00
|
|
|
# Proc filesystem
|
|
|
|
|
# Capabilities
|
|
|
|
|
# Security
|
|
|
|
|
NoNewPrivileges=true
|
|
|
|
|
# Sandboxing
|
2022-01-07 00:25:26 +00:00
|
|
|
ProtectSystem=full
|
2024-12-28 00:29:20 +00:00
|
|
|
PrivateTmp=true
|
|
|
|
|
PrivateDevices=true
|
|
|
|
|
ProtectKernelModules=true
|
|
|
|
|
ProtectKernelTunables=true
|
|
|
|
|
ProtectControlGroups=true
|
|
|
|
|
RestrictAddressFamilies=AF_INET
|
|
|
|
|
RestrictAddressFamilies=AF_INET6
|
|
|
|
|
RestrictAddressFamilies=AF_NETLINK
|
|
|
|
|
RestrictAddressFamilies=AF_UNIX
|
|
|
|
|
RestrictNamespaces=true
|
|
|
|
|
LockPersonality=true
|
|
|
|
|
RestrictRealtime=true
|
|
|
|
|
DevicePolicy=closed
|
|
|
|
|
# System Call Filtering
|
2022-01-07 00:25:26 +00:00
|
|
|
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
|
|
|
|
|
CapabilityBoundingSet=~CAP_NET_ADMIN CAP_NET_BROADCAST CAP_NET_RAW
|
|
|
|
|
CapabilityBoundingSet=~CAP_SYS_ADMIN CAP_SYS_PTRACE CAP_SYSLOG
|
|
|
|
|
|
2017-04-08 02:04:27 +00:00
|
|
|
[Install]
|
2020-12-11 13:40:13 +00:00
|
|
|
WantedBy=multi-user.target
|