| 1 |
# vim:syntax=apparmor |
| 2 |
|
| 3 |
#include <tunables/global> |
| 4 |
|
| 5 |
# flags=(attach_disconnected) is needed, otherwise when trying |
| 6 |
# to write to NOTIFY_SOCKET Router hits: |
| 7 |
# Failed name lookup - disconnected path" error=-13 |
| 8 |
# profile="/usr/bin/mysqlrouter" name="run/systemd/notify" |
| 9 |
|
| 10 |
/usr/bin/mysqlrouter flags=(attach_disconnected) { |
| 11 |
#include <abstractions/base> |
| 12 |
#include <abstractions/nameservice> |
| 13 |
#include <abstractions/user-tmp> |
| 14 |
|
| 15 |
# Allow system resource access |
| 16 |
/sys/devices/system/cpu/ r, |
| 17 |
capability sys_resource, |
| 18 |
capability dac_override, |
| 19 |
capability setuid, |
| 20 |
capability setgid, |
| 21 |
capability chown, |
| 22 |
capability fowner, |
| 23 |
|
| 24 |
# Allow config access |
| 25 |
/etc/mysqlrouter/** rw, |
| 26 |
/var/lib/mysqlrouter/** rw, |
| 27 |
|
| 28 |
# Allow libssl to read its global config |
| 29 |
/etc/ssl/openssl.cnf r, |
| 30 |
|
| 31 |
# Allow access to libmysqlclient's charset files |
| 32 |
/usr/share/mysql-8.0/charsets/** r, |
| 33 |
|
| 34 |
# Allow runtime files such as PID-file |
| 35 |
/var/run/mysqlrouter/** rw, |
| 36 |
/run/mysqlrouter/** rw, |
| 37 |
|
| 38 |
# Allow systemd notify messages |
| 39 |
/{,var/}run/systemd/notify w, |
| 40 |
|
| 41 |
# Allow read/ write to /tmp |
| 42 |
/tmp/ r, |
| 43 |
/tmp/* rw, |
| 44 |
|
| 45 |
# Allow execution of MySQL Router binary |
| 46 |
/usr/bin/mysqlrouter mr, |
| 47 |
|
| 48 |
# Allow plugin access |
| 49 |
/usr/lib/mysqlrouter/plugin/*.so mr, |
| 50 |
|
| 51 |
# Allow log file access |
| 52 |
/var/log/mysqlrouter/ rw, |
| 53 |
/var/log/mysqlrouter/** rw, |
| 54 |
} |