apparmor.d/profiles/fusermount

80 lines
2 KiB
Text
Raw Normal View History

# vim:syntax=apparmor
# ------------------------------------------------------------------
#
2021-01-10 16:35:07 +01:00
# Copyright (C) 2020-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/fusermount{,3}
profile fusermount @{exec_path} {
2020-12-10 22:33:39 +01:00
include <abstractions/base>
include <abstractions/nameservice-strict>
# To mount anything:
# fusermount: mount failed: Operation not permitted
capability sys_admin,
# This is needed when mounting MTP devices via some file manager:
# fusermount: mount failed: Permission denied
capability dac_read_search,
2021-03-14 18:57:00 +01:00
# For obexfs
network bluetooth stream,
@{exec_path} mr,
# Where to mount ISO files
owner @{HOME}/*/ rw,
owner @{HOME}/*/*/ rw,
owner @{HOME}/.cache/**/ rw,
# Be able to mount ISO images
2021-03-14 18:57:00 +01:00
mount fstype={fuse,fuse.*} -> @{HOME}/*/,
mount fstype={fuse,fuse.*} -> @{HOME}/*/*/,
mount fstype={fuse,fuse.*} -> @{HOME}/.cache/**/,
2020-10-13 16:47:49 +02:00
mount fstype={fuse,fuse.*} -> /media/*/,
2021-03-21 17:04:10 +01:00
mount fstype={fuse,fuse.*} -> /media/*/*/,
2020-10-13 16:47:49 +02:00
# For MTP
mount -> /,
2021-03-21 17:04:10 +01:00
# For AppImage
mount fstype={fuse,fuse.*} -> /tmp/.mount_*/,
2021-03-13 09:47:36 +01:00
# For GVFS
mount fstype={fuse,fuse.*} -> @{run}/user/[0-9]*/gvfs/,
# Be able to unmount the ISO images
2021-03-14 18:57:00 +01:00
umount @{HOME}/*/,
umount @{HOME}/*/*/,
umount @{HOME}/.cache/**/,
2020-10-13 16:47:49 +02:00
umount /media/*/,
2021-03-21 17:04:10 +01:00
umount /tmp/.mount_*/,
2021-03-13 09:47:36 +01:00
umount @{run}/user/[0-9]*/**/,
# Image files to be mounted
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,
2021-03-21 17:04:10 +01:00
# AppImage files
owner @{HOME}/**.AppImage r,
owner /media/*/**.AppImage r,
/etc/fuse.conf r,
/dev/fuse rw,
@{PROC}/@{pid}/mounts r,
2020-12-10 22:33:39 +01:00
include if exists <local/fusermount>
}