apparmor.d/profiles/apt-cdrom
2021-04-01 16:17:47 +01:00

87 lines
1.8 KiB
Text

# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2019-2021 Mikhail Morfikov
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}bin/apt-cdrom
profile apt-cdrom @{exec_path} flags=(complain) {
include <abstractions/base>
include <abstractions/nameservice-strict>
include <abstractions/apt-common>
capability dac_read_search,
@{exec_path} mr,
/{usr/,}bin/dpkg rPx -> child-dpkg,
/{usr/,}bin/mount rCx -> mount,
/{usr/,}bin/umount rCx -> umount,
# Are all of these needed? (#FIXME#)
@{sys}/bus/ r,
@{sys}/bus/*/devices/ r,
@{sys}/class/ r,
@{sys}/class/*/ r,
@{sys}/devices/**/uevent r,
@{run}/udev/data/* r,
/etc/fstab r,
# For cd-roms
/media/cdrom[0-9]/ r,
/media/cdrom[0-9]/**/ r,
/media/cdrom[0-9]/.disk/info r,
/media/cdrom[0-9]/dists/**/binary-*/Packages{,.gz} r,
/media/cdrom[0-9]/dists/**/i18n/Translation-en{,.gz} r,
# For pendrives
/media/*/*/ r,
/media/*/*/**/ r,
/media/*/*/.disk/info r,
/media/*/*/dists/**/binary-*/Packages{,.gz} r,
/media/*/*/dists/**/i18n/Translation-en{,.gz} r,
/var/lib/apt/lists/** rw,
owner @{PROC}/@{pid}/fd/ r,
/var/lib/apt/cdroms.list{,.new} rw,
/var/lib/apt/cdroms.list~ w,
/etc/apt/sources.list{,.new} rw,
/etc/apt/sources.list~ w,
profile mount flags=(complain) {
include <abstractions/base>
/{usr/,}bin/mount mr,
/etc/fstab r,
/media/cdrom[0-9]/ r,
}
profile umount flags=(complain) {
include <abstractions/base>
capability sys_admin,
/{usr/,}bin/umount mr,
@{run}/mount/utab{,.*} rw,
@{run}/mount/utab.lock rwk,
owner @{PROC}/@{pid}/mountinfo r,
umount /media/*/,
umount /media/*/*/,
}
include if exists <local/apt-cdrom>
}