@@ -11,7 +11,61 @@ Type=@php_fpm_systemd@
11
11
PIDFile=@EXPANDED_LOCALSTATEDIR@/run/php-fpm.pid
12
12
ExecStart=@EXPANDED_SBINDIR@/php-fpm --nodaemonize --fpm-config @EXPANDED_SYSCONFDIR@/php-fpm.conf
13
13
ExecReload=/bin/kill -USR2 $MAINPID
14
+
15
+ # Set up a new file system namespace and mounts private /tmp and /var/tmp directories
16
+ # so this service cannot access the global directories and other processes cannot
17
+ # access this service's directories.
14
18
PrivateTmp=true
15
19
20
+ # The directories /home, /root and /run/user are made inaccessible and empty for processes
21
+ # invoked by this unit.
22
+ ProtectHome=true
23
+
24
+ # Mounts the /usr, /boot, and /etc directories read-only for processes invoked by this unit.
25
+ ProtectSystem=full
26
+
27
+ # Ensures that the service process and all its children can never gain new privileges
28
+ NoNewPrivileges=true
29
+
30
+ # Sets up a new /dev namespace for the executed processes and only adds API pseudo devices
31
+ # such as /dev/null, /dev/zero or /dev/random (as well as the pseudo TTY subsystem) to it,
32
+ # but no physical devices such as /dev/sda.
33
+ PrivateDevices=true
34
+
35
+ # Required for dropping privileges and running as a different user
36
+ CapabilityBoundingSet=CAP_SETGID CAP_SETUID
37
+
38
+ # Attempts to create memory mappings that are writable and executable at the same time,
39
+ # or to change existing memory mappings to become executable are prohibited.
40
+ MemoryDenyWriteExecute=true
41
+
42
+ # Explicit module loading will be denied. This allows to turn off module load and unload
43
+ # operations on modular kernels. It is recommended to turn this on for most services that
44
+ # do not need special file systems or extra kernel modules to work.
45
+ ProtectKernelModules=true
46
+
47
+ # Kernel variables accessible through /proc/sys, /sys, /proc/sysrq-trigger, /proc/latency_stats,
48
+ # /proc/acpi, /proc/timer_stats, /proc/fs and /proc/irq will be made read-only to all processes
49
+ # of the unit. Usually, tunable kernel variables should only be written at boot-time, with the
50
+ # sysctl.d(5) mechanism. Almost no services need to write to these at runtime; it is hence
51
+ # recommended to turn this on for most services.
52
+ ProtectKernelTunables=true
53
+
54
+ # The Linux Control Groups (cgroups(7)) hierarchies accessible through /sys/fs/cgroup will be
55
+ # made read-only to all processes of the unit. Except for container managers no services should
56
+ # require write access to the control groups hierarchies; it is hence recommended to turn this on
57
+ # for most services
58
+ ProtectControlGroups=true
59
+
60
+ # Any attempts to enable realtime scheduling in a process of the unit are refused.
61
+ RestrictRealtime=true
62
+
63
+ # Restricts the set of socket address families accessible to the processes of this unit.
64
+ # Protects against vulnerabilities such as CVE-2016-8655
65
+ RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX
66
+
67
+ # Takes away the ability to create or manage any kind of namespace
68
+ RestrictNamespaces=true
69
+
16
70
[Install]
17
71
WantedBy=multi-user.target
0 commit comments