apparmor.d/apparmor.d/profiles-g-l/kmod
2023-04-24 18:58:58 +01:00

71 lines
1.8 KiB
Plaintext

# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2019-2021 Mikhail Morfikov
# Copyright (C) 2021 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}bin/{kmod,lsmod}
@{exec_path} += /{usr/,}{s,}bin/{depmod,insmod,lsmod,rmmod,modinfo,modprobe}
profile kmod @{exec_path} flags=(attach_disconnected) {
include <abstractions/base>
include <abstractions/consoles>
include <abstractions/nameservice-strict>
include <abstractions/openssl>
capability dac_override,
capability mknod,
capability net_admin,
capability sys_module,
capability syslog,
unix (receive) type=stream,
@{exec_path} mrix,
/{usr/,}{s,}bin/sysctl rPx,
/{usr/,}bin/{,ba,da}sh rix,
/{usr/,}bin/basename rix,
/{usr/,}bin/false rix,
/{usr/,}bin/id rix,
/{usr/,}bin/true rix,
/{usr/,}lib/modprobe.d/{,*.conf} r,
/{usr/,}lib/modules/*/modules.* rw,
/etc/depmod.d/{,**} r,
/etc/modprobe.d/{,*.conf} r,
/tmp/**/*.ko{,.zst} r,
/usr/src/*/*.ko r,
/var/lib/dkms/**/module/*.ko r,
/var/lib/dpkg/triggers/* r,
/var/tmp/dracut.*/{,**} rw,
owner /boot/System.map-* r,
owner /tmp/mkinitcpio.*/{,**} rw,
# For local kernel build
owner /tmp/depmod.*/lib/modules/*/ r,
owner /tmp/depmod.*/lib/modules/*/modules.* rw,
owner @{user_build_dirs}/**/System.map r,
owner @{user_build_dirs}/**/lib/modules/*/ r,
owner @{user_build_dirs}/**/lib/modules/*/modules.* rw,
owner @{user_build_dirs}/**/lib/modules/*/kernel/{,**/} r,
owner @{user_build_dirs}/**/lib/modules/*/kernel/**/*.ko r,
owner @{run}/tmpfiles.d/ w,
owner @{run}/tmpfiles.d/static-nodes.conf w,
@{sys}/module/{,**} r,
@{PROC}/cmdline r,
@{PROC}/modules r,
deny /apparmor/.null rw,
deny @{user_share_dirs}/gvfs-metadata/* r,
include if exists <local/kmod>
}