# vim:syntax=apparmor # ------------------------------------------------------------------ # # Copyright (C) 2019-2021 Mikhail Morfikov # # This program is free software; you can redistribute it and/or # modify it under the terms of version 2 of the GNU General Public # License published by the Free Software Foundation. # # ------------------------------------------------------------------ abi , include @{exec_path} = /{usr/,}bin/apt-cdrom profile apt-cdrom @{exec_path} flags=(complain) { include include include 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 /{usr/,}bin/mount mr, /etc/fstab r, /media/cdrom[0-9]/ r, } profile umount flags=(complain) { include 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 }