github.com/hms58/moby@v1.13.1/profiles/apparmor/template.go (about) 1 // +build linux 2 3 package apparmor 4 5 // baseTemplate defines the default apparmor profile for containers. 6 const baseTemplate = ` 7 {{range $value := .Imports}} 8 {{$value}} 9 {{end}} 10 11 profile {{.Name}} flags=(attach_disconnected,mediate_deleted) { 12 {{range $value := .InnerImports}} 13 {{$value}} 14 {{end}} 15 16 network, 17 capability, 18 file, 19 umount, 20 21 deny @{PROC}/* w, # deny write for all files directly in /proc (not in a subdir) 22 # deny write to files not in /proc/<number>/** or /proc/sys/** 23 deny @{PROC}/{[^1-9],[^1-9][^0-9],[^1-9s][^0-9y][^0-9s],[^1-9][^0-9][^0-9][^0-9]*}/** w, 24 deny @{PROC}/sys/[^k]** w, # deny /proc/sys except /proc/sys/k* (effectively /proc/sys/kernel) 25 deny @{PROC}/sys/kernel/{?,??,[^s][^h][^m]**} w, # deny everything except shm* in /proc/sys/kernel/ 26 deny @{PROC}/sysrq-trigger rwklx, 27 deny @{PROC}/mem rwklx, 28 deny @{PROC}/kmem rwklx, 29 deny @{PROC}/kcore rwklx, 30 31 deny mount, 32 33 deny /sys/[^f]*/** wklx, 34 deny /sys/f[^s]*/** wklx, 35 deny /sys/fs/[^c]*/** wklx, 36 deny /sys/fs/c[^g]*/** wklx, 37 deny /sys/fs/cg[^r]*/** wklx, 38 deny /sys/firmware/** rwklx, 39 deny /sys/kernel/security/** rwklx, 40 41 {{if ge .Version 208095}} 42 # suppress ptrace denials when using 'docker ps' or using 'ps' inside a container 43 ptrace (trace,read) peer={{.Name}}, 44 {{end}} 45 } 46 `