apparmor.d/profiles/mount-nfs

73 lines
1.6 KiB
Text
Raw Normal View History

2021-03-21 17:04:10 +01:00
# 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 <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}sbin/mount.nfs
profile mount-nfs @{exec_path} flags=(complain) {
include <abstractions/base>
include <abstractions/nameservice-strict>
# To be able to mount anything
capability sys_admin,
capability chown,
capability setgid,
capability setuid,
capability net_bind_service,
network inet dgram,
network inet6 dgram,
network inet stream,
network inet6 stream,
@{exec_path} mr,
/{usr/,}bin/{,ba,da}sh rix,
/{usr/,}sbin/start-statd rix,
/{usr/,}bin/flock rix,
/usr/bin/systemctl rPx -> child-systemctl,
/etc/fstab r,
/etc/netconfig r,
/etc/rpc r,
@{PROC}/filesystems r,
owner @{PROC}/@{pid}/mountinfo r,
owner @{run}/mount/utab{,.*} rw,
owner @{run}/mount/utab.lock wk,
owner @{run}/rpc.statd.lock wk,
# Mount points
/media/*/ r,
/media/*/*/ r,
/mnt/ r,
/mnt/*/ r,
# Allow to mount smb/cifs disks only under the /media/ dirs
mount fstype=nfs -> /media/*/,
mount fstype=nfs -> /media/*/*/,
mount fstype=nfs -> /mnt/,
mount fstype=nfs -> /mnt/*/,
umount /media/*/,
umount /media/*/*/,
umount /mnt/,
umount /mnt/*/,
include if exists <local/mount-nfs>
}