CanLoadNewProfile returns whether the current process can load a new AppArmor profile. CanLoadNewProfile needs root. CanLoadNewProfile checks both /sys/module/apparmor/parameters/enabled and /sys/kernel/security. Related: https://gitlab.com/apparmor/apparmor/-/blob/v3.0.3/libraries/libapparmor/sr
()
| 71 | // |
| 72 | // Related: https://gitlab.com/apparmor/apparmor/-/blob/v3.0.3/libraries/libapparmor/src/kernel.c#L311 |
| 73 | func CanLoadNewProfile() bool { |
| 74 | return !userns.RunningInUserNS() && os.Geteuid() == 0 && hostSupports() |
| 75 | } |
| 76 | |
| 77 | var ( |
| 78 | paramEnabled bool |
searching dependent graphs…