Skip to content

Instantly share code, notes, and snippets.

@AkihiroSuda
Created November 29, 2020 17:13
Show Gist options
  • Save AkihiroSuda/032108f4d9c7bed49f9b18b2499b6aad to your computer and use it in GitHub Desktop.
Save AkihiroSuda/032108f4d9c7bed49f9b18b2499b6aad to your computer and use it in GitHub Desktop.
AppArmor profile: docker-no-abstract-socket
#include <tunables/global>
profile docker-no-abstract-socket flags=(attach_disconnected,mediate_deleted) {
#include <abstractions/base>
network,
capability,
file,
umount,
signal (receive) peer=unconfined,
signal (send,receive) peer=docker-no-abstract-socket,
deny @{PROC}/* w,
deny @{PROC}/{[^1-9],[^1-9][^0-9],[^1-9s][^0-9y][^0-9s],[^1-9][^0-9][^0-9][^0-9]*}/** w,
deny @{PROC}/sys/[^k]** w,
deny @{PROC}/sys/kernel/{?,??,[^s][^h][^m]**} w,
deny @{PROC}/sysrq-trigger rwklx,
deny @{PROC}/kcore rwklx,
deny mount,
deny /sys/[^f]*/** wklx,
deny /sys/f[^s]*/** wklx,
deny /sys/fs/[^c]*/** wklx,
deny /sys/fs/c[^g]*/** wklx,
deny /sys/fs/cg[^r]*/** wklx,
deny /sys/firmware/** rwklx,
deny /sys/kernel/security/** rwklx,
ptrace (trace,read,tracedby,readby) peer=docker-no-abstract-socket,
# Only the following line is related to abstract sockets.
# Other lines are from "docker-default" profile (https://github.com/moby/moby/pull/39923)
deny unix addr=@**,
}
# To load the profile, run `sudo apparmor_parser -r docker-no-abstract-socket`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment