Add two profiles directory to have smaller dir.

This commit is contained in:
Alexandre Pujol 2021-09-15 16:55:27 +01:00
parent 6c0ae4ddc1
commit d95a876424
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
521 changed files with 0 additions and 0 deletions

View file

@ -0,0 +1,134 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2018-2021 Mikhail Morfikov
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}lib/udisks2/udisksd
@{exec_path} += @{libexec}/udisks2/udisksd
profile udisksd @{exec_path} flags=(attach_disconnected) {
include <abstractions/base>
include <abstractions/nameservice-strict>
include <abstractions/disks-write>
# To remove the following errors:
# udisksd[]: Error probing device: Error sending ATA command IDENTIFY DEVICE to '/dev/sda':
# SGIO v3 ioctl failed (v4 not supported): Operation not permitted (g-io-error-quark, 14)
capability sys_rawio,
# To allow users to mount volumes
# Error mounting /dev/sd*: GDBus.Error:org.freedesktop.UDisks2.Error.Failed:
# Error mounting /dev/sd* at /media/*/*: Operation not permitted.
capability sys_admin,
capability chown,
capability dac_read_search,
capability dac_override,
# Needed?
deny capability sys_nice,
network netlink raw,
@{exec_path} mr,
/{usr/,}bin/{,ba,da}sh rix,
/{usr/,}bin/umount rix,
/{usr/,}bin/eject rPx,
/{usr/,}{s,}bin/dumpe2fs rPx,
/{usr/,}{s,}bin/dmidecode rPx,
/{usr/,}{s,}bin/lvm rPUx,
/{usr/,}bin/systemctl rPx -> child-systemctl,
/{usr/,}bin/systemd-escape rPx,
# Allow mounting of removable devices
mount fstype={btrfs,ext*,vfat,iso9660,udf} /dev/sd[a-z] -> @{MOUNTS}/*/*/,
mount fstype={btrfs,ext*,vfat,iso9660,udf} /dev/sd[a-z][0-9]* -> @{MOUNTS}/*/*/,
mount fstype={btrfs,ext*,vfat,iso9660,udf} /dev/dm-[0-9]* -> @{MOUNTS}/*/*/,
# Allow mounting of loop devices (ISO files)
mount fstype={btrfs,ext*,vfat,iso9660,udf} /dev/loop[0-9]* -> @{MOUNTS}/*/*/,
mount fstype={btrfs,ext*,vfat,iso9660,udf} /dev/loop[0-9]*p[0-9]* -> @{MOUNTS}/*/*/,
# Allow mounting of cdrom
mount fstype={btrfs,ext*,vfat,iso9660,udf} /dev/loop[0-9]* -> /media/cdrom[0-9]/,
mount fstype={iso9660,udf} /dev/sr[0-9]* -> /media/cdrom[0-9]/,
# Allow mounting od sd cards
mount fstype={btrfs,ext*,vfat,iso9660,udf} /dev/mmcblk[0-9] -> @{MOUNTS}/*/*/,
mount fstype={btrfs,ext*,vfat,iso9660,udf} /dev/mmcblk[0-9]*p[0-9]* -> @{MOUNTS}/*/*/,
# Allow unmounting
umount @{MOUNTS}/*/,
umount @{MOUNTS}/*/*/,
umount /media/cdrom[0-9]/,
# Be able to create/delete dirs for removable media
@{MOUNTS}/*/ rw,
@{MOUNTS}/*/*/ rw,
/media/cdrom[0-9]/ rw,
# Udisks2 config files
/etc/udisks2/ r,
/etc/udisks2/udisks2.conf r,
# For mounting NTFS disks
capability setuid,
capability setgid,
/{usr/,}bin/ntfs-3g rPx,
/etc/libblockdev/conf.d/ r,
/etc/libblockdev/conf.d/[0-9][0-9]-default.cfg r,
owner @{PROC}/@{pid}/mountinfo r,
owner @{PROC}/@{pid}/mounts r,
owner @{PROC}/@{pid}/fd/ r,
@{PROC}/swaps r,
@{PROC}/devices r,
# To be able to initialize device-mapper disk devices
/dev/mapper/ r,
/dev/mapper/control rw,
# The special /dev/loop-control file can be used to create and destroy loop devices or to find
# the first available loop device.
/dev/loop-control rw,
# To check whether the x-udisks-auth option was used to specify that additional authorization is
# required to mount/unlock a device
/etc/fstab r,
/etc/crypttab r,
# To be able to operate on encryted devices
@{run}/cryptsetup/ r,
@{run}/cryptsetup/L* rwk,
@{sys}/fs/ r,
@{sys}/bus/ r,
@{sys}/class/ r,
@{sys}/devices/pci[0-9]*/**/{ata,usb,mmc}[0-9]/{,**/}uevent w,
@{sys}/devices/virtual/block/dm-[0-9]*/ w,
@{sys}/devices/virtual/block/dm-[0-9]*/** w,
# For powering off USB devices
@{sys}/devices/pci[0-9]*/**/{ata,usb,mmc}[0-9]/{,**/}remove rw,
@{sys}/devices/virtual/bdi/**/read_ahead_kb r,
@{run}/ r,
# Info on mounted devices
@{run}/mount/utab{,.*} rw,
@{run}/mount/utab.lock rwk,
/var/lib/udisks2/ r,
/var/lib/udisks2/mounted-fs{,*} rw,
@{run}/udisks2/{,**} rw,
@{run}/systemd/seats/seat[0-9]* r,
@{run}/systemd/inhibit/[0-9]*.ref rw,
include if exists <local/udisksd>
}