|
@@ -1,4 +1,6 @@
|
|
-@{DOCKER_GRAPH_PATH}=/var/lib/docker
|
|
|
|
|
|
+package main
|
|
|
|
+
|
|
|
|
+const dockerProfileTemplate = `@{DOCKER_GRAPH_PATH}=/var/lib/docker
|
|
|
|
|
|
profile /usr/bin/docker (attach_disconnected, complain) {
|
|
profile /usr/bin/docker (attach_disconnected, complain) {
|
|
# Prevent following links to these files during container setup.
|
|
# Prevent following links to these files during container setup.
|
|
@@ -15,9 +17,11 @@ profile /usr/bin/docker (attach_disconnected, complain) {
|
|
|
|
|
|
umount,
|
|
umount,
|
|
pivot_root,
|
|
pivot_root,
|
|
|
|
+{{if ge .MajorVersion 2}}{{if ge .MinorVersion 9}}
|
|
signal (receive) peer=@{profile_name},
|
|
signal (receive) peer=@{profile_name},
|
|
signal (receive) peer=unconfined,
|
|
signal (receive) peer=unconfined,
|
|
signal (send),
|
|
signal (send),
|
|
|
|
+{{end}}{{end}}
|
|
ipc rw,
|
|
ipc rw,
|
|
network,
|
|
network,
|
|
capability,
|
|
capability,
|
|
@@ -34,10 +38,12 @@ profile /usr/bin/docker (attach_disconnected, complain) {
|
|
/etc/localtime r,
|
|
/etc/localtime r,
|
|
/etc/ld.so.cache r,
|
|
/etc/ld.so.cache r,
|
|
|
|
|
|
|
|
+{{if ge .MajorVersion 2}}{{if ge .MinorVersion 9}}
|
|
ptrace peer=@{profile_name},
|
|
ptrace peer=@{profile_name},
|
|
ptrace (read) peer=docker-default,
|
|
ptrace (read) peer=docker-default,
|
|
deny ptrace (trace) peer=docker-default,
|
|
deny ptrace (trace) peer=docker-default,
|
|
deny ptrace peer=/usr/bin/docker///bin/ps,
|
|
deny ptrace peer=/usr/bin/docker///bin/ps,
|
|
|
|
+{{end}}{{end}}
|
|
|
|
|
|
/usr/lib/** rm,
|
|
/usr/lib/** rm,
|
|
/lib/** rm,
|
|
/lib/** rm,
|
|
@@ -57,9 +63,11 @@ profile /usr/bin/docker (attach_disconnected, complain) {
|
|
/sbin/zfs rCx,
|
|
/sbin/zfs rCx,
|
|
/sbin/apparmor_parser rCx,
|
|
/sbin/apparmor_parser rCx,
|
|
|
|
|
|
|
|
+{{if ge .MajorVersion 2}}{{if ge .MinorVersion 9}}
|
|
# Transitions
|
|
# Transitions
|
|
change_profile -> docker-*,
|
|
change_profile -> docker-*,
|
|
change_profile -> unconfined,
|
|
change_profile -> unconfined,
|
|
|
|
+{{end}}{{end}}
|
|
|
|
|
|
profile /bin/cat (complain) {
|
|
profile /bin/cat (complain) {
|
|
/etc/ld.so.cache r,
|
|
/etc/ld.so.cache r,
|
|
@@ -81,8 +89,10 @@ profile /usr/bin/docker (attach_disconnected, complain) {
|
|
/dev/null rw,
|
|
/dev/null rw,
|
|
/bin/ps mr,
|
|
/bin/ps mr,
|
|
|
|
|
|
|
|
+{{if ge .MajorVersion 2}}{{if ge .MinorVersion 9}}
|
|
# We don't need ptrace so we'll deny and ignore the error.
|
|
# We don't need ptrace so we'll deny and ignore the error.
|
|
deny ptrace (read, trace),
|
|
deny ptrace (read, trace),
|
|
|
|
+{{end}}{{end}}
|
|
|
|
|
|
# Quiet dac_override denials
|
|
# Quiet dac_override denials
|
|
deny capability dac_override,
|
|
deny capability dac_override,
|
|
@@ -100,11 +110,15 @@ profile /usr/bin/docker (attach_disconnected, complain) {
|
|
/proc/tty/drivers r,
|
|
/proc/tty/drivers r,
|
|
}
|
|
}
|
|
profile /sbin/iptables (complain) {
|
|
profile /sbin/iptables (complain) {
|
|
|
|
+{{if ge .MajorVersion 2}}{{if ge .MinorVersion 9}}
|
|
signal (receive) peer=/usr/bin/docker,
|
|
signal (receive) peer=/usr/bin/docker,
|
|
|
|
+{{end}}{{end}}
|
|
capability net_admin,
|
|
capability net_admin,
|
|
}
|
|
}
|
|
profile /sbin/auplink flags=(attach_disconnected, complain) {
|
|
profile /sbin/auplink flags=(attach_disconnected, complain) {
|
|
|
|
+{{if ge .MajorVersion 2}}{{if ge .MinorVersion 9}}
|
|
signal (receive) peer=/usr/bin/docker,
|
|
signal (receive) peer=/usr/bin/docker,
|
|
|
|
+{{end}}{{end}}
|
|
capability sys_admin,
|
|
capability sys_admin,
|
|
capability dac_override,
|
|
capability dac_override,
|
|
|
|
|
|
@@ -123,7 +137,9 @@ profile /usr/bin/docker (attach_disconnected, complain) {
|
|
/proc/[0-9]*/mounts rw,
|
|
/proc/[0-9]*/mounts rw,
|
|
}
|
|
}
|
|
profile /sbin/modprobe /bin/kmod (complain) {
|
|
profile /sbin/modprobe /bin/kmod (complain) {
|
|
|
|
+{{if ge .MajorVersion 2}}{{if ge .MinorVersion 9}}
|
|
signal (receive) peer=/usr/bin/docker,
|
|
signal (receive) peer=/usr/bin/docker,
|
|
|
|
+{{end}}{{end}}
|
|
capability sys_module,
|
|
capability sys_module,
|
|
/etc/ld.so.cache r,
|
|
/etc/ld.so.cache r,
|
|
/lib/** rm,
|
|
/lib/** rm,
|
|
@@ -137,7 +153,9 @@ profile /usr/bin/docker (attach_disconnected, complain) {
|
|
}
|
|
}
|
|
# xz works via pipes, so we do not need access to the filesystem.
|
|
# xz works via pipes, so we do not need access to the filesystem.
|
|
profile /usr/bin/xz (complain) {
|
|
profile /usr/bin/xz (complain) {
|
|
|
|
+{{if ge .MajorVersion 2}}{{if ge .MinorVersion 9}}
|
|
signal (receive) peer=/usr/bin/docker,
|
|
signal (receive) peer=/usr/bin/docker,
|
|
|
|
+{{end}}{{end}}
|
|
/etc/ld.so.cache r,
|
|
/etc/ld.so.cache r,
|
|
/lib/** rm,
|
|
/lib/** rm,
|
|
/usr/bin/xz rm,
|
|
/usr/bin/xz rm,
|
|
@@ -238,4 +256,4 @@ profile /usr/bin/docker (attach_disconnected, complain) {
|
|
|
|
|
|
capability mac_admin,
|
|
capability mac_admin,
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}`
|