update apparmor profiles

Signed-off-by: Alexandre Pujol <alexandre@pujol.io>
This commit is contained in:
Mikhail Morfikov 2022-04-24 11:52:42 +02:00 committed by Alexandre Pujol
parent 85e7f58d3c
commit 35a281d045
Failed to generate hash of commit
28 changed files with 147 additions and 38 deletions

View file

@ -79,13 +79,13 @@
# access to firmware's etc # access to firmware's etc
/usr/share/AAVMF/** r, /usr/share/AAVMF/** r,
/usr/share/bochs/** r, /usr/share/bochs/** r,
/usr/share/edk2-ovmf/** r, /usr/share/edk2-ovmf/** rk,
/usr/share/kvm/** r, /usr/share/kvm/** r,
/usr/share/misc/sgabios.bin r, /usr/share/misc/sgabios.bin r,
/usr/share/openbios/** r, /usr/share/openbios/** r,
/usr/share/openhackware/** r, /usr/share/openhackware/** r,
/usr/share/OVMF/** r, /usr/share/OVMF/** rk,
/usr/share/ovmf/** r, /usr/share/ovmf/** rk,
/usr/share/proll/** r, /usr/share/proll/** r,
/usr/share/qemu-efi/** r, /usr/share/qemu-efi/** r,
/usr/share/qemu-kvm/** r, /usr/share/qemu-kvm/** r,
@ -247,4 +247,9 @@
/ r, # harmless on any lsb compliant system / r, # harmless on any lsb compliant system
/sys/bus/nd/devices/{,**/} r, /sys/bus/nd/devices/{,**/} r,
# required for QEMU accessing UEFI nvram variables
owner /var/lib/libvirt/qemu/nvram/*_VARS.fd rwk,
owner /var/lib/libvirt/qemu/nvram/*_VARS.ms.fd rwk,
# Site-specific additions and overrides. See local/README for details.
include if exists <local/abstractions/libvirt-qemu> include if exists <local/abstractions/libvirt-qemu>

View file

@ -33,10 +33,14 @@ profile android-studio @{exec_path} {
signal (send) set=(term, kill) peer=android-studio//lsb-release, signal (send) set=(term, kill) peer=android-studio//lsb-release,
ptrace (read) peer=android-studio//*,
network inet dgram, network inet dgram,
network inet6 dgram, network inet6 dgram,
network inet stream, network inet stream,
network inet6 stream, network inet6 stream,
network inet raw,
network inet6 raw,
network netlink raw, network netlink raw,
@{exec_path} r, @{exec_path} r,
@ -129,6 +133,9 @@ profile android-studio @{exec_path} {
owner "@{user_cache_dirs}/Android Open Source Project/" rw, owner "@{user_cache_dirs}/Android Open Source Project/" rw,
owner "@{user_cache_dirs}/Android Open Source Project/**" rw, owner "@{user_cache_dirs}/Android Open Source Project/**" rw,
owner @{user_cache_dirs}/main.kts.compiled.cache/ rw,
owner @{user_cache_dirs}/main.kts.compiled.cache/** rw,
owner @{user_cache_dirs}/Google/ rw, owner @{user_cache_dirs}/Google/ rw,
owner @{user_cache_dirs}/Google/** rwk, owner @{user_cache_dirs}/Google/** rwk,
# To remove the following error: # To remove the following error:
@ -178,11 +185,12 @@ profile android-studio @{exec_path} {
owner @{PROC}/@{pid}/fd/ r, owner @{PROC}/@{pid}/fd/ r,
owner @{PROC}/@{pid}/cmdline r, owner @{PROC}/@{pid}/cmdline r,
owner @{PROC}/@{pid}/mounts r, owner @{PROC}/@{pid}/mounts r,
owner @{PROC}/@{pid}/coredump_filter rw,
owner @{PROC}/@{pid}/mem r, owner @{PROC}/@{pid}/mem r,
owner @{PROC}/@{pid}/oom_{,score_}adj rw, owner @{PROC}/@{pid}/oom_{,score_}adj rw,
owner @{PROC}/@{pids}/task/ r, owner @{PROC}/@{pids}/task/ r,
owner @{PROC}/@{pids}/task/@{tid}/status r, owner @{PROC}/@{pids}/task/@{tid}/status r,
owner @{PROC}/@{pids}/stat r, @{PROC}/@{pids}/stat r,
@{PROC}/sys/net/core/somaxconn r, @{PROC}/sys/net/core/somaxconn r,
@{PROC}/sys/fs/inotify/max_user_watches r, @{PROC}/sys/fs/inotify/max_user_watches r,
@{PROC}/sys/kernel/yama/ptrace_scope r, @{PROC}/sys/kernel/yama/ptrace_scope r,
@ -201,6 +209,8 @@ profile android-studio @{exec_path} {
/usr/share/hwdata/pnp.ids r, /usr/share/hwdata/pnp.ids r,
/usr/share/glib-2.0/schemas/gschemas.compiled r,
/var/lib/dbus/machine-id r, /var/lib/dbus/machine-id r,
/etc/machine-id r, /etc/machine-id r,

View file

@ -1,13 +1,6 @@
# vim:syntax=apparmor # apparmor.d - Full set of apparmor profiles
# ------------------------------------------------------------------ # Copyright (C) 2021 Mikhail Morfikov
# # SPDX-License-Identifier: GPL-2.0-only
# Copyright (C) 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>, abi <abi/3.0>,
@ -22,7 +15,8 @@ profile apt-forktracer @{exec_path} {
@{exec_path} mr, @{exec_path} mr,
/{usr/,}bin/ r, /{usr/,}bin/ r,
/{usr/,}bin/dpkg rPx -> child-dpkg, /{usr/,}bin/dpkg rPx -> child-dpkg,
/{usr/,}bin/apt-cache rPx,
/usr/share/apt-forktracer/{,**} r, /usr/share/apt-forktracer/{,**} r,
@ -38,5 +32,8 @@ profile apt-forktracer @{exec_path} {
/var/lib/dbus/machine-id r, /var/lib/dbus/machine-id r,
/etc/machine-id r, /etc/machine-id r,
/etc/dpkg/origins/debian r,
/etc/debian_version r,
include if exists <local/apt-forktracer> include if exists <local/apt-forktracer>
} }

View file

@ -35,6 +35,7 @@ profile apt-methods-gpgv @{exec_path} {
/{usr/,}bin/find rix, /{usr/,}bin/find rix,
/{usr/,}bin/gpgv rix, /{usr/,}bin/gpgv rix,
/{usr/,}bin/head rix,
/{usr/,}bin/cat rix, /{usr/,}bin/cat rix,
/{usr/,}bin/chmod rix, /{usr/,}bin/chmod rix,
/{usr/,}bin/cmp rix, /{usr/,}bin/cmp rix,
@ -79,8 +80,8 @@ profile apt-methods-gpgv @{exec_path} {
@{PROC}/@{pid}/fd/ r, @{PROC}/@{pid}/fd/ r,
# Local keyring storage # Local keyring storage
/etc/keyrings/ r, /etc/apt/keyrings/ r,
/etc/keyrings/*.{gpg,asc} r, /etc/apt/keyrings/*.{gpg,asc} r,
# Extrepo keyring storage # Extrepo keyring storage
/var/lib/extrepo/keys/*.{gpg,asc} r, /var/lib/extrepo/keys/*.{gpg,asc} r,

View file

@ -46,6 +46,7 @@ profile debsums @{exec_path} {
/var/lib/{,**} r, /var/lib/{,**} r,
/opt/{,**} r, /opt/{,**} r,
/boot/{,**} r, /boot/{,**} r,
/lib*/{,**} r,
include if exists <local/debsums> include if exists <local/debsums>
} }

View file

@ -89,6 +89,9 @@ profile dpkg @{exec_path} {
/usr/** rwl -> /usr/**, /usr/** rwl -> /usr/**,
/lib/ r, /lib/ r,
/lib/** rwl -> /lib/** , /lib/** rwl -> /lib/** ,
# Fixme when more transitions will be available (#FIXME#)
/lib{,32,64,x64}/ r,
/lib{,32,64,x64}/** rwl,
/bin/ r, /bin/ r,
/bin/* rwl -> /bin/*, /bin/* rwl -> /bin/*,
/sbin/ r, /sbin/ r,

View file

@ -52,6 +52,9 @@ profile querybts @{exec_path} {
/etc/fstab r, /etc/fstab r,
/var/lib/dbus/machine-id r,
/etc/machine-id r,
# Allowed apps to open # Allowed apps to open
/{usr/,}lib/firefox/firefox rPUx, /{usr/,}lib/firefox/firefox rPUx,

View file

@ -93,6 +93,8 @@ profile reportbug @{exec_path} {
@{sys}/module/apparmor/parameters/enabled r, @{sys}/module/apparmor/parameters/enabled r,
/dev/ptmx rw,
owner /tmp/reportbug-*-[0-9]*-@{pid}-* rw, owner /tmp/reportbug-*-[0-9]*-@{pid}-* rw,
owner /tmp/* rw, owner /tmp/* rw,
owner /var/tmp/*.bug{,~} rw, owner /var/tmp/*.bug{,~} rw,

View file

@ -61,7 +61,7 @@ profile dbus-daemon @{exec_path} flags=(attach_disconnected) {
@{run}/systemd/inhibit/[0-9]*.ref rw, @{run}/systemd/inhibit/[0-9]*.ref rw,
@{run}/systemd/sessions/[0-9]*.ref rw, @{run}/systemd/sessions/[0-9]*.ref rw,
@{run}/systemd/users/@{uid} r, @{run}/systemd/users/@{uid} r,
owner @{run}/user/@{uid}/at-spi/bus rw, owner @{run}/user/@{uid}/at-spi/bus{,_[0-9]*} rw,
owner @{run}/user/@{uid}/dbus-1/ rw, owner @{run}/user/@{uid}/dbus-1/ rw,
owner @{run}/user/@{uid}/dbus-1/services/ rw, owner @{run}/user/@{uid}/dbus-1/services/ rw,

View file

@ -70,7 +70,7 @@ profile gpg @{exec_path} {
# APT upstream/user keyrings # APT upstream/user keyrings
/usr/share/keyrings/*.{gpg,asc} r, /usr/share/keyrings/*.{gpg,asc} r,
/etc/keyrings/*.{gpg,asc} r, /etc/apt/keyrings/*.{gpg,asc} r,
# APT repositories # APT repositories
/var/lib/apt/lists/*_InRelease r, /var/lib/apt/lists/*_InRelease r,

View file

@ -35,12 +35,17 @@ profile appstreamcli @{exec_path} flags=(complain) {
/var/lib/app-info/yaml/ r, /var/lib/app-info/yaml/ r,
/var/lib/app-info/yaml/*_Components-*.yml.gz w, /var/lib/app-info/yaml/*_Components-*.yml.gz w,
/var/lib/app-info/ w,
/var/lib/apt/lists/ r, /var/lib/apt/lists/ r,
/var/lib/apt/lists/*_Components-*.gz r, /var/lib/apt/lists/*_Components-*.gz r,
/var/lib/swcatalog/ rw,
/var/lib/swcatalog/yaml/ rw,
/var/lib/swcatalog/yaml/*_Components-*.yml.gz w,
/var/lib/flatpak/appstream/{,**} r, /var/lib/flatpak/appstream/{,**} r,
/var/cache/swcatalog/cache/{,**} rw, /var/cache/swcatalog/cache/{,**} rw,
owner /var/cache/app-info/{,**} rw, owner /var/cache/app-info/{,**} rw,
owner /var/cache/swcatalog/{,**} rw,
owner /tmp/appstream-cache-*.mdb rw, owner /tmp/appstream-cache-*.mdb rw,
owner /tmp/appstream/ rw, owner /tmp/appstream/ rw,
owner /tmp/appstream/appcache-*.mdb rw, owner /tmp/appstream/appcache-*.mdb rw,

View file

@ -10,6 +10,8 @@ include <tunables/global>
profile atftpd @{exec_path} { profile atftpd @{exec_path} {
include <abstractions/base> include <abstractions/base>
include <abstractions/nameservice> include <abstractions/nameservice>
# For libwrap (TCP Wrapper) support
include <abstractions/hosts_access>
# to run atftpd daemon as nobody/nogroup # to run atftpd daemon as nobody/nogroup
capability setgid, capability setgid,
@ -21,8 +23,5 @@ profile atftpd @{exec_path} {
/tftpboot/{,**} r, /tftpboot/{,**} r,
/srv/tftp/{,**} r, /srv/tftp/{,**} r,
# for libwrap (TCP Wrapper) support
/etc/hosts.{,allow,deny} r,
include if exists <local/atftpd> include if exists <local/atftpd>
} }

View file

@ -30,8 +30,12 @@ profile atril @{exec_path} {
@{exec_path} mr, @{exec_path} mr,
/usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/WebKitNetworkProcess rix, /{usr/,}bin/{,ba,da}sh rix,
/usr/lib/x86_64-linux-gnu/webkit2gtk-4.0/WebKitWebProcess rix,
/{usr/,}bin/atril-previewer rPx,
/{usr/,}lib/@{multiarch}/webkit2gtk-4.0/WebKitNetworkProcess rix,
/{usr/,}lib/@{multiarch}/webkit2gtk-4.0/WebKitWebProcess rix,
# Which media files atril should be able to open # Which media files atril should be able to open
/ r, / r,
@ -52,6 +56,7 @@ profile atril @{exec_path} {
owner @{run}/user/@{uid}/dconf/ rw, owner @{run}/user/@{uid}/dconf/ rw,
owner @{run}/user/@{uid}/dconf/user rw, owner @{run}/user/@{uid}/dconf/user rw,
owner @{PROC}/@{pid}/fd/ r,
owner @{PROC}/@{pid}/mountinfo r, owner @{PROC}/@{pid}/mountinfo r,
owner @{PROC}/@{pid}/mounts r, owner @{PROC}/@{pid}/mounts r,
owner @{PROC}/@{pid}/statm r, owner @{PROC}/@{pid}/statm r,
@ -59,24 +64,25 @@ profile atril @{exec_path} {
owner @{PROC}/@{pid}/cgroup r, owner @{PROC}/@{pid}/cgroup r,
@{PROC}/zoneinfo r, @{PROC}/zoneinfo r,
/sys/firmware/acpi/pm_profile r, @{sys}/firmware/acpi/pm_profile r,
/sys/devices/virtual/dmi/id/chassis_type r, @{sys}/devices/virtual/dmi/id/chassis_type r,
/sys/fs/cgroup/** r, @{sys}/fs/cgroup/** r,
/etc/fstab r, /etc/fstab r,
/usr/share/poppler/** r, /usr/share/poppler/{,**} r,
owner @{user_config_dirs}/atril/ rw, owner @{user_config_dirs}/atril/{,*} rw,
owner @{user_config_dirs}/atril/* rw,
owner @{user_cache_dirs}/atril/ rw, owner @{user_cache_dirs}/atril/{,**} rw,
owner @{user_cache_dirs}/atril/** rw,
owner @{user_share_dirs}/gvfs-metadata/home r, owner @{user_share_dirs}/gvfs-metadata/home r,
owner @{user_share_dirs}/gvfs-metadata/home-*.log r, owner @{user_share_dirs}/gvfs-metadata/home-*.log r,
owner /tmp/gtkprint_* rw, owner /tmp/gtkprint_* rw,
owner /tmp/settings*.ini rw,
owner /tmp/settings*.ini.* rw,
owner /tmp/atril-@{pid}/ rw, owner /tmp/atril-@{pid}/ rw,
owner /tmp/atril-@{pid}/*/ rw, owner /tmp/atril-@{pid}/*/ rw,
owner /tmp/atril-@{pid}/*/mimetype rw, owner /tmp/atril-@{pid}/*/mimetype rw,

View file

@ -46,6 +46,7 @@ profile conky @{exec_path} {
/{usr/,}bin/cat rix, /{usr/,}bin/cat rix,
/{usr/,}bin/wc rix, /{usr/,}bin/wc rix,
/{usr/,}bin/sed rix, /{usr/,}bin/sed rix,
/{usr/,}bin/sleep rix,
# For external IP address # For external IP address
#/{usr/,}bin/dig rix, #/{usr/,}bin/dig rix,

View file

@ -43,9 +43,15 @@ profile ffplay @{exec_path} {
include <abstractions/X> include <abstractions/X>
include <abstractions/freedesktop.org> include <abstractions/freedesktop.org>
include <abstractions/audio> include <abstractions/audio>
include <abstractions/nameservice-strict>
include <abstractions/user-download-strict> include <abstractions/user-download-strict>
include <abstractions/private-files-strict> include <abstractions/private-files-strict>
network inet stream,
network inet6 stream,
network inet dgram,
network inet6 dgram,
@{exec_path} mr, @{exec_path} mr,
# Which media files ffplay should be able to open # Which media files ffplay should be able to open

View file

@ -98,7 +98,7 @@ profile gajim @{exec_path} {
# Silencer # Silencer
deny /usr/share/gajim/** w, deny /usr/share/gajim/** w,
deny /usr/lib/python3/dist-packages/** w,
profile ccache { profile ccache {
include <abstractions/base> include <abstractions/base>
@ -117,6 +117,8 @@ profile gajim @{exec_path} {
/media/ccache/*/** rw, /media/ccache/*/** rw,
owner @{run}/user/@{uid}/ccache-tmp/ rw,
/etc/debian_version r, /etc/debian_version r,
} }

View file

@ -15,6 +15,7 @@ profile gparted @{exec_path} {
/{usr/,}{s,}bin/ r, /{usr/,}{s,}bin/ r,
/{usr/,}{s,}bin/gpartedbin rPx, /{usr/,}{s,}bin/gpartedbin rPx,
@{libexec}/gpartedbin rPx,
/{usr/,}bin/ r, /{usr/,}bin/ r,
/{usr/,}bin/{,e}grep rix, /{usr/,}bin/{,e}grep rix,

View file

@ -7,6 +7,7 @@ abi <abi/3.0>,
include <tunables/global> include <tunables/global>
@{exec_path} = /{usr/,}{s,}bin/gpartedbin @{exec_path} = /{usr/,}{s,}bin/gpartedbin
@{exec_path} += @{libexec}/gpartedbin
profile gpartedbin @{exec_path} { profile gpartedbin @{exec_path} {
include <abstractions/base> include <abstractions/base>
include <abstractions/gtk> include <abstractions/gtk>

View file

@ -19,10 +19,12 @@ profile i3lock @{exec_path} {
@{exec_path} mr, @{exec_path} mr,
/usr/sbin/unix_chkpwd rPx, /{usr/,}sbin/unix_chkpwd rPx,
owner @{HOME}/.Xauthority r, owner @{HOME}/.Xauthority r,
owner @{PROC}/@{pid}/fd/ r,
# For background image. # For background image.
owner @{HOME}/*.png r, owner @{HOME}/*.png r,
owner @{HOME}/*/*.png r, owner @{HOME}/*/*.png r,

View file

@ -79,6 +79,7 @@ profile mkinitramfs @{exec_path} {
/boot/ r, /boot/ r,
owner /boot/initrd.img-*.new rw, owner /boot/initrd.img-*.new rw,
owner /boot/config-* r,
/var/tmp/ r, /var/tmp/ r,
owner /var/tmp/mkinitramfs_*/ rw, owner /var/tmp/mkinitramfs_*/ rw,

View file

@ -36,6 +36,7 @@ include <tunables/global>
@{mkvmerge_ext} += [sS][rR][tT] @{mkvmerge_ext} += [sS][rR][tT]
@{mkvmerge_ext} += [tT][xX][tT] @{mkvmerge_ext} += [tT][xX][tT]
@{mkvmerge_ext} += [sS][uU][bB] @{mkvmerge_ext} += [sS][uU][bB]
@{mkvmerge_ext} += [mM][kK][sS]
@{exec_path} = /{usr/,}bin/mkvmerge @{exec_path} = /{usr/,}bin/mkvmerge
profile mkvmerge @{exec_path} { profile mkvmerge @{exec_path} {

View file

@ -36,6 +36,7 @@ include <tunables/global>
@{mkvtoolnix_ext} += [sS][rR][tT] @{mkvtoolnix_ext} += [sS][rR][tT]
@{mkvtoolnix_ext} += [tT][xX][tT] @{mkvtoolnix_ext} += [tT][xX][tT]
@{mkvtoolnix_ext} += [sS][uU][bB] @{mkvtoolnix_ext} += [sS][uU][bB]
@{mkvtoolnix_ext} += [mM][kK][sS]
@{exec_path} = /{usr/,}bin/mkvtoolnix-gui @{exec_path} = /{usr/,}bin/mkvtoolnix-gui
profile mkvtoolnix-gui @{exec_path} { profile mkvtoolnix-gui @{exec_path} {

View file

@ -0,0 +1,29 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2022 Mikhail Morfikov
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}bin/mtr
profile mtr @{exec_path} {
include <abstractions/base>
include <abstractions/gtk>
include <abstractions/fonts>
include <abstractions/fontconfig-cache-read>
include <abstractions/freedesktop.org>
include <abstractions/nameservice-strict>
network inet dgram,
network inet6 dgram,
network netlink raw,
signal (send) set=(term, kill) peer=mtr-packet,
@{exec_path} mr,
/{usr/,}bin/mtr-packet rPx,
include if exists <local/mtr>
}

View file

@ -0,0 +1,27 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2022 Mikhail Morfikov
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{exec_path} = /{usr/,}bin/mtr-packet
profile mtr-packet @{exec_path} {
include <abstractions/base>
capability net_raw,
network inet stream,
network inet6 stream,
network inet dgram,
network inet6 dgram,
network inet raw,
network inet6 raw,
signal (receive) set=(kill, term) peer=mtr,
@{exec_path} mr,
include if exists <local/mtr-packet>
}

View file

@ -28,5 +28,7 @@ profile update-alternatives @{exec_path} {
/usr/** rw, /usr/** rw,
/lib/firmware/* rw,
include if exists <local/update-alternatives> include if exists <local/update-alternatives>
} }

View file

@ -28,10 +28,13 @@ profile uscan @{exec_path} {
/{usr/,}bin/pwd rix, /{usr/,}bin/pwd rix,
/{usr/,}bin/find rix, /{usr/,}bin/find rix,
/{usr/,}bin/file rix, /{usr/,}bin/file rix,
/{usr/,}bin/getconf rix,
/{usr/,}bin/tar rix, /{usr/,}bin/tar rix,
/{usr/,}bin/gzip rix, /{usr/,}bin/gzip rix,
/{usr/,}bin/bzip2 rix, /{usr/,}bin/bzip2 rix,
/{usr/,}bin/gunzip rix,
/{usr/,}bin/xz rix,
/{usr/,}bin/uupdate rPUx, /{usr/,}bin/uupdate rPUx,

View file

@ -15,6 +15,9 @@ profile vsftpd @{exec_path} {
# Only for local users authentication # Only for local users authentication
include <abstractions/authentication> include <abstractions/authentication>
# For libwrap (TCP Wrapper) support (tcp_wrappers=YES)
include <abstractions/hosts_access>
# To be able to listen on ports < 1024 # To be able to listen on ports < 1024
capability net_bind_service, capability net_bind_service,
@ -48,9 +51,6 @@ profile vsftpd @{exec_path} {
# List of users disallowed FTP access # List of users disallowed FTP access
/etc/ftpusers r, /etc/ftpusers r,
# For libwrap (TCP Wrapper) support (tcp_wrappers=YES)
/etc/hosts.{allow,deny} r,
# vsftpd config files # vsftpd config files
/etc/vsftpd.conf r, /etc/vsftpd.conf r,
/etc/vsftpd/**/ r, /etc/vsftpd/**/ r,

View file

@ -65,7 +65,7 @@ profile yt-dlp @{exec_path} {
# Which files yt-dlp should be able to open # Which files yt-dlp should be able to open
owner /media/**/ r, owner /media/**/ r,
owner /media/**.@{ytdlp_ext} rw, owner /media/**.@{ytdlp_ext} rwk,
owner @{HOME}/.cache/ rw, owner @{HOME}/.cache/ rw,
owner @{HOME}/.cache/yt-dlp/ rw, owner @{HOME}/.cache/yt-dlp/ rw,