Skip to content

Commit 8e5fe12

Browse files
authored
Create apparmor_hat.md
1 parent 489f95f commit 8e5fe12

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

apparmor_hat.md

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
phpstatic for linux package support apparmor_hat to protected your server, to enable it add `apparmor_hat = your_hat_name` into your php-fpm pool.
2+
3+
`/etc/apparmor.d/usr.local.sbin.php-fpm` example:
4+
```conf
5+
#include <tunables/global>
6+
profile php-fpm /usr/local/sbin/php-fpm flags=(attach_disconnected) {
7+
#include <abstractions/base>
8+
#include <abstractions/nameservice>
9+
10+
capability net_admin,
11+
capability setuid,
12+
capability setgid,
13+
capability chown,
14+
capability kill,
15+
16+
/usr/local/etc/php/ r,
17+
/usr/local/etc/php/** r,
18+
19+
/proc/loadavg r,
20+
/proc/@{pid}/attr/current rw,
21+
/dev/shm/mongoc-* rw,
22+
23+
/var/lock/php-fpm.lock rw,
24+
/var/log/php-fpm.log rw,
25+
/var/log/php-slow.log rw,
26+
/var/log/php/* rw,
27+
28+
/run/php-fpm/fpm-*.socket rwlk,
29+
/run/php-fpm/php-fpm.pid rwlk,
30+
/run/php-fpm.pid rwlk,
31+
32+
/opt/web/** rk,
33+
34+
# Zend opcache
35+
/tmp/.ZendSem.* rwlk,
36+
/tmp/php* rw,
37+
38+
deny / rw,
39+
40+
signal (send) peer=php-fpm//*,
41+
42+
change_profile -> php-fpm//*,
43+
44+
}
45+
```

0 commit comments

Comments
 (0)