apparmor.d/profiles/mount

72 lines
1.8 KiB
Text
Raw Normal View History

# vim:syntax=apparmor
# ------------------------------------------------------------------
#
2021-01-10 16:35:07 +01:00
# 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.
#
# ------------------------------------------------------------------
2020-12-10 22:33:39 +01:00
abi <abi/3.0>,
2020-12-10 22:33:39 +01:00
include <tunables/global>
@{exec_path} = /{usr/,}bin/mount
profile mount @{exec_path} flags=(complain) {
2020-12-10 22:33:39 +01:00
include <abstractions/base>
include <abstractions/disks-write>
include <abstractions/nameservice-strict>
# To be able to mount anything
# mount("/dev/sdb1", "/mnt", "ext4", 0, NULL) = -1 EPERM (Operation not permitted)
# write(2, "/mnt: permission denied.", 24) = 24
capability sys_admin,
# For NTFS mounts
capability setgid,
capability setuid,
mount,
2021-03-13 09:47:36 +01:00
network inet stream,
network inet6 stream,
signal (receive) set=(term, kill),
@{exec_path} mr,
/{usr/,}bin/ntfs-3g rPx,
2021-03-21 17:04:10 +01:00
/{usr/,}bin/lowntfs-3g rPx,
/{usr/,}bin/sshfs rPx,
/{usr/,}sbin/mount.* rPx,
# Mount points
/media/*/ r,
/media/*/*/ r,
/mnt/ r,
/mnt/*/ r,
/media/cdrom[0-9]/ r,
# Mount iso/img files
owner @{HOME}/**.{iso,img,bin,mdf,nrg} rwk,
owner /media/*/**.{iso,img,bin,mdf,nrg} rwk,
owner @{HOME}/**.{ISO,IMG,BIN,MDF,NRG} rwk,
owner /media/*/**.{ISO,IMG,BIN,MDF,NRG} rwk,
# 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,
/etc/fstab r,
owner @{PROC}/@{pid}/mountinfo r,
2020-10-25 10:23:34 +01:00
owner @{run}/mount/ rw,
owner @{run}/mount/utab{,.*} rw,
owner @{run}/mount/utab.lock wk,
2020-12-10 22:33:39 +01:00
include if exists <local/mount>
}