# vim:syntax=apparmor # ------------------------------------------------------------------ # # Copyright (C) 2017-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 , include @{exec_path} = /{usr/,}bin/rpi-imager profile rpi-imager @{exec_path} { include include include include include include include include include include include include include #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 include include /usr/bin/lsblk mr, @{PROC}/swaps r, owner @{PROC}/@{pid}/mountinfo r, # file_inherit /dev/dri/card[0-9]* rw, } include if exists }