apparmor.d/profiles/rpi-imager
2021-04-01 16:17:47 +01:00

104 lines
3.0 KiB
Plaintext

# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2017-2021 Mikhail Morfikov
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}bin/rpi-imager
profile rpi-imager @{exec_path} {
include <abstractions/base>
include <abstractions/gtk>
include <abstractions/fonts>
include <abstractions/fontconfig-cache-read>
include <abstractions/freedesktop.org>
include <abstractions/dri-common>
include <abstractions/dri-enumerate>
include <abstractions/nameservice-strict>
include <abstractions/ssl_certs>
include <abstractions/openssl>
include <abstractions/mesa>
include <abstractions/user-download-strict>
include <abstractions/disks-write>
#capability sys_admin,
deny capability sys_nice,
network inet dgram,
network inet6 dgram,
network inet stream,
network inet6 stream,
network netlink dgram,
network netlink raw,
@{exec_path} mr,
/usr/bin/lsblk rCx -> lsblk,
# When rpi-imager is run as root, it wants to exec dbus-launch, and hence it creates the two
# following root processes:
# dbus-launch --autolaunch e0a30ad97cd6421c85247839ccef9db2 --binary-syntax --close-stderr
# /usr/bin/dbus-daemon --syslog-only --fork --print-pid 5 --print-address 7 --session
#
# Should this be allowed? Rpi-imager works fine without this.
#/{usr/,}bin/dbus-launch rCx -> dbus,
#/{usr/,}bin/dbus-send rCx -> dbus,
deny /{usr/,}bin/dbus-launch rx,
deny /{usr/,}bin/dbus-send rx,
owner "@{HOME}/.config/Raspberry Pi/" rw,
owner "@{HOME}/.config/Raspberry Pi/Imager.conf" rw,
owner "@{HOME}/.config/Raspberry Pi/Imager.conf.lock" rwk,
owner "@{HOME}/.cache/Raspberry Pi/" rw,
owner "@{HOME}/.cache/Raspberry Pi/**" rwl -> "@{HOME}/.cache/Raspberry Pi/**",
owner @{HOME}/.cache/ rw,
owner @{HOME}/.cache/qtshadercache/ rw,
owner @{HOME}/.cache/qtshadercache/#[0-9]*[0-9] rw,
owner @{HOME}/.cache/qtshadercache/[0-9a-f]* rwl -> @{HOME}/.cache/qtshadercache/#[0-9]*[0-9],
owner @{HOME}/.cache/qtshadercache-*-little_endian-*/#[0-9]*[0-9] rw,
owner @{HOME}/.cache/qtshadercache-*-little_endian-*/[0-9a-f]* rwl -> @{HOME}/.cache/qtshadercache-*-little_endian-*/#[0-9]*[0-9],
# To configure Qt5 settings (theme, font, icons, etc.) under DE/WM without Qt integration
owner @{HOME}/.config/qt5ct/{,**} r,
/usr/share/qt5ct/** r,
owner @{HOME}/.config/QtProject.conf r,
/etc/machine-id r,
/var/lib/dbus/machine-id r,
/usr/share/hwdata/pnp.ids r,
owner @{PROC}/@{pid}/cmdline r,
owner @{PROC}/@{pid}/fd/ r,
owner @{PROC}/@{pid}/mountinfo r,
owner @{PROC}/@{pid}/mounts r,
/etc/fstab r,
/etc/X11/cursors/*.theme r,
/dev/disk/by-label/ r,
profile lsblk {
include <abstractions/base>
include <abstractions/disks-read>
include <abstractions/nameservice-strict>
/usr/bin/lsblk mr,
@{PROC}/swaps r,
owner @{PROC}/@{pid}/mountinfo r,
# file_inherit
/dev/dri/card[0-9]* rw,
}
include if exists <local/rpi-imager>
}