Debian Codegraph @

doc/systemd/lighttpd.service

raw
1 [Unit]
2 Description=Lighttpd Daemon
3 After=network-online.target
4 Documentation=man:lighttpd https://wiki.lighttpd.net
5
6 # optional: systemd socket activation for lighttpd
7 # Requires lighttpd.conf: server.systemd-socket-activation = "enable"
8 # Requires installation, configuration, enabling of systemd lighttpd*.socket
9 # https://git.lighttpd.net/lighttpd/lighttpd1.4/src/branch/master/doc/systemd/
10 #Requires=lighttpd-http-ipv4.socket lighttpd-http-ipv6.socket lighttpd-https-ipv4.socket lighttpd-https-ipv6.socket
11
12 [Install]
13 WantedBy=multi-user.target
14
15 [Service]
16 Type=simple
17 PIDFile=/run/lighttpd.pid
18 ExecStartPre=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf
19 ExecStart=/usr/sbin/lighttpd -D -f /etc/lighttpd/lighttpd.conf
20 ExecReload=/usr/sbin/lighttpd -tt -f /etc/lighttpd/lighttpd.conf
21 ExecReload=/bin/kill -USR1 $MAINPID
22 Restart=on-failure
23
24 # increase num files soft limit; 1024 harkens back to select() limit
25 # (lighttpd.conf must still be configured with `server.max-fds`; default 4096)
26 LimitNOFILE=32768:524288
27
28 #
29 # system capabilities hardening
30 #
31
32 # (comment all out if running lighttpd as root to manage system, e.g. via LuCI)
33
34 # Recommended configuration: have systemd start lighttpd as unprivileged user.
35 # Note: starting lighttpd as unprivileged user requires TLS certificates to be
36 # readable by the unprivileged user and will fail for existing configurations
37 # where that is not currently the case. For that scenario and for similar
38 # compatibility reasons, this is not yet enabled by default.
39 #User=lighttpd
40 #Group=lighttpd
41
42 # Allow unprivileged lighttpd to bind,listen to ports < 1024 (i.e. 80 and 443).
43 AmbientCapabilities=CAP_NET_BIND_SERVICE
44
45 # Recommended configuration: strictly limit capabilities
46 # Limit capabilities, including for children and privileged processes, e.g. root
47 # CAP_NET_BIND_SERVICE allows bind() to ports < 1024 (i.e. 80 and 443).
48 # CAP_SETGID, CAP_SETUID, and CAP_SYS_CHROOT are self explanatory.
49 #CapabilityBoundingSet=CAP_NET_BIND_SERVICE CAP_SETGID CAP_SETUID CAP_SYS_CHROOT
50 # If not starting lighttpd as root, minimal capability to bind to ports < 1024:
51 #CapabilityBoundingSet=CAP_NET_BIND_SERVICE
52
53 # Using systemd socket activation, even CAP_NET_BIND_SERVICE is not necessary
54 # and could be removed from AmbientCapabilities and CapabilityBoundingSet.
55 # Requires lighttpd*.socket 'Requires' in [Unit] section at top of this file.
56
57 # Note: PrivateTmp=yes
58 # could break backends if named socket from independent daemon is located
59 # in /tmp; must relocate lighttpd.conf socket paths to e.g. /run/lighttpd
60 # Note: ProtectHome=read-only
61 # could break CGI scripts or WebDAV writing to home paths
62 # Note: RestrictSUIDSGID=yes
63 # could break CGI scripts or WebDAV setting suid/sgid permission bit on files
64 # Note: NoNewPrivileges=yes
65 # will disallow unprivileged scripts from using sudo
66
67 KeyringMode=private
68 LockPersonality=yes
69 MemoryDenyWriteExecute=yes
70 NoNewPrivileges=yes
71 PrivateDevices=yes
72 PrivateTmp=yes
73 ProtectClock=yes
74 ProtectControlGroups=yes
75 ProtectHome=read-only
76 ProtectHostname=yes
77 ProtectKernelLogs=yes
78 ProtectKernelModules=yes
79 ProtectKernelTunables=yes
80 ProtectProc=invisible
81 ProtectSystem=full
82 RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX AF_NETLINK
83 RestrictNamespaces=yes
84 RestrictRealtime=yes
85 RestrictSUIDSGID=yes
86 SystemCallArchitectures=native
87
88 #SystemCallFilter=@known
89 #SystemCallFilter=@system-service
90 #SystemCallFilter=~@privileged
91 #SystemCallFilter=@setuid
92 #SystemCallFilter=~@mount
93 #SystemCallFilter=chroot
94 #SystemCallFilter=~@resources
95 #SystemCallFilter=setrlimit
96 #SystemCallFilter=~@cpu-emulation
97 #SystemCallFilter=~@debug
98 #SystemCallFilter=~@keyring
99 #SystemCallFilter=~@obsolete
100 #SystemCallFilter=~@pkey