Skip to content

Commit

Permalink
incusd/apparmor: Support unpriv binfmt_misc
Browse files Browse the repository at this point in the history
Signed-off-by: Stéphane Graber <[email protected]>
  • Loading branch information
stgraber committed Feb 8, 2024
1 parent 99e1f55 commit 53393de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions internal/server/apparmor/instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ func instanceProfile(sysOS *sys.OS, inst instance, extraBinaries []string) (stri
"feature_cgroup2": sysOS.CGInfo.Layout == cgroup.CgroupsUnified || sysOS.CGInfo.Layout == cgroup.CgroupsHybrid,
"feature_stacking": sysOS.AppArmorStacking && !sysOS.AppArmorStacked,
"feature_unix": unixSupported,
"kernel_binfmt": util.IsFalseOrEmpty(inst.ExpandedConfig()["security.privileged"]) && sysOS.UnprivBinfmt,
"name": InstanceProfileName(inst),
"namespace": InstanceNamespaceName(inst),
"nesting": util.IsTrue(inst.ExpandedConfig()["security.nesting"]),
Expand Down
2 changes: 2 additions & 0 deletions internal/server/apparmor/instance_lxc.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ profile "{{ .name }}" flags=(attach_disconnected,mediate_deleted) {
# Handle binfmt
mount fstype=binfmt_misc -> /proc/sys/fs/binfmt_misc/,
{{- if not .kernel_binfmt }}
deny /proc/sys/fs/binfmt_misc/{,**} rwklx,
{{- end }}
# Handle cgroupfs
mount options=(ro,nosuid,nodev,noexec,remount,strictatime) -> /sys/fs/cgroup/,
Expand Down

0 comments on commit 53393de

Please sign in to comment.