feat(profiles): reorganise a few profiles.

This commit is contained in:
Alexandre Pujol 2022-06-25 00:18:26 +01:00
parent fcbe764ccf
commit c04363c1b6
No known key found for this signature in database
GPG key ID: C5469996F0DF68EC
6 changed files with 125 additions and 145 deletions

View file

@ -10,23 +10,14 @@ include <tunables/global>
profile adduser @{exec_path} {
include <abstractions/base>
include <abstractions/consoles>
include <abstractions/perl>
include <abstractions/nameservice-strict>
include <abstractions/perl>
# To create a user home dir and give it proper permissions:
# mkdir("/home/user", 0755) = 0
# chown("/home/user", 1001, 1001) = 0
# chmod("/home/user", 0755) = 0
capability chown,
capability fowner,
# To set the set-group-ID bit for the user home dir (SETGID_HOME=yes).
capability fsetid,
# To copy files from the /etc/skel/ dir to the newly created user dir, which now has a different
# owner.
capability dac_read_search,
capability dac_override,
capability dac_read_search,
capability fowner,
capability fsetid,
@{exec_path} r,
/{usr/,}bin/perl r,
@ -35,25 +26,24 @@ profile adduser @{exec_path} {
/{usr/,}bin/find rix,
/{usr/,}bin/rm rix,
/{usr/,}{s,}bin/groupadd rPx,
/{usr/,}{s,}bin/groupdel rPx,
/{usr/,}{s,}bin/useradd rPx,
/{usr/,}{s,}bin/userdel rPx,
/{usr/,}{s,}bin/groupdel rPx,
/{usr/,}{s,}bin/groupadd rPx,
/{usr/,}{s,}bin/usermod rPx,
/{usr/,}bin/passwd rPx,
/{usr/,}bin/gpasswd rPx,
/{usr/,}bin/chfn rPx,
/{usr/,}bin/chage rPx,
/{usr/,}bin/chage rPx,
/{usr/,}bin/chfn rPx,
/{usr/,}bin/gpasswd rPx,
/{usr/,}bin/passwd rPx,
/etc/{group,passwd,shadow} r,
/etc/adduser.conf r,
/etc/skel/{,.*} r,
# To create user dirs and copy files from /etc/skel/ to them
@{HOME}/ rw,
@{HOME}/.* w,
/var/lib/*/{,*} rw,
/etc/skel/{,.*} r,
include if exists <local/adduser>
}

View file

@ -1,5 +1,6 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2021 Mikhail Morfikov
# Copyright (C) 2021-2022 Mikhail Morfikov
# Copyright (C) 2021-2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
@ -9,15 +10,15 @@ include <tunables/global>
@{exec_path} = /{usr/,}bin/blueman-*
profile blueman @{exec_path} flags=(attach_disconnected) {
include <abstractions/base>
include <abstractions/audio>
include <abstractions/dconf-write>
include <abstractions/python>
include <abstractions/fonts>
include <abstractions/fontconfig-cache-read>
include <abstractions/gtk>
include <abstractions/fonts>
include <abstractions/freedesktop.org>
include <abstractions/gtk>
include <abstractions/python>
include <abstractions/thumbnails-cache-read>
include <abstractions/user-download-strict>
include <abstractions/audio>
network inet stream,
network inet6 stream,
@ -27,17 +28,25 @@ profile blueman @{exec_path} flags=(attach_disconnected) {
ptrace (read) peer=gjs-console,
@{exec_path} mrix,
/{usr/,}bin/python3.[0-9]* r,
/{usr/,}bin/blueman-tray rPx,
/{usr/,}bin/ r,
/{usr/,}bin/{b,d}ash rix,
/{usr/,}bin/{b,d}ash rix,
/{usr/,}bin/xdg-open rCx -> open,
/{usr/,}bin/blueman-tray rPx,
/{usr/,}bin/xdg-open rCx -> open,
/usr/share/blueman/{,**} r,
/usr/share/glib-2.0/schemas/gschemas.compiled r,
/usr/share/X11/xkb/{,**} r,
/etc/machine-id r,
/var/lib/dbus/machine-id r,
/var/lib/blueman/network.state r,
owner @{HOME}/ r,
owner @{HOME}/bluetooth*/ r,
owner @{HOME}/bluetooth*/* rw,
owner @{user_cache_dirs}/blueman-tray-[0-9]* rw,
owner @{user_cache_dirs}/blueman-services-[0-9]* rw,
owner @{user_cache_dirs}/blueman-adapters-[0-9]* rw,
@ -49,36 +58,16 @@ profile blueman @{exec_path} flags=(attach_disconnected) {
owner @{user_share_dirs}/gvfs-metadata/{,*} r,
owner @{HOME}/ r,
owner @{HOME}/bluetooth*/ r,
owner @{HOME}/bluetooth*/* rw,
# For sending a note (disabled since the feature doesn't seem to work)
#owner /tmp/* rw,
#owner /var/tmp/* rw,
#owner /tmp/note*.vnt rw,
/var/lib/blueman/network.state r,
owner @{run}/user/@{uid}/gdm/Xauthority r,
owner @{PROC}/@{pid}/fd/ r,
owner @{PROC}/@{pid}/mounts r,
@{PROC}/@{pids}/cmdline r,
/usr/share/glib-2.0/schemas/gschemas.compiled r,
/dev/tty rw,
/dev/rfkill r,
/dev/shm/ r,
/var/lib/dbus/machine-id r,
/etc/machine-id r,
owner @{run}/user/@{uid}/gdm/Xauthority r,
# file_inherit
/dev/dri/card[0-9]* rw,
/dev/rfkill r,
/dev/shm/ r,
/dev/tty rw,
profile open {
include <abstractions/base>
@ -87,30 +76,29 @@ profile blueman @{exec_path} flags=(attach_disconnected) {
/{usr/,}bin/xdg-open mr,
/{usr/,}bin/{,ba,da}sh rix,
/{usr/,}bin/gawk rix,
/{usr/,}bin/readlink rix,
/{usr/,}bin/basename rix,
/{usr/,}bin/dbus-send rix,
/{usr/,}bin/file rix,
/{usr/,}bin/gawk rix,
/{usr/,}bin/mimetype rix,
/{usr/,}bin/readlink rix,
/{usr/,}bin/uname rix,
/{usr/,}bin/xprop rix,
/{usr/,}bin/file rix,
/{usr/,}bin/dbus-send rix,
/{usr/,}bin/mimetype rix,
/usr/share/perl5/** r,
/etc/magic r,
owner @{HOME}/ r,
owner @{HOME}/bluetooth*/* r,
owner @{run}/user/@{uid}/ r,
# Allowed apps to open
/{usr/,}lib/firefox/firefox rPx,
/{usr/,}bin/spacefm rPx,
# file_inherit
/usr/share/perl5/** r,
/etc/magic r,
owner @{HOME}/ r,
owner @{HOME}/bluetooth*/* r,
owner @{HOME}/.xsession-errors w,
owner @{run}/user/@{uid}/ r,
}
include if exists <local/blueman>

View file

@ -1,5 +1,6 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2015-2021 Mikhail Morfikov
# Copyright (C) 2015-2022 Mikhail Morfikov
# Copyright (C) 2021-2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
@ -27,20 +28,19 @@ profile bluetoothd @{exec_path} {
/etc/bluetooth/{,*.conf} r,
/var/lib/bluetooth/{,**} rw,
@{run}/sdp rw,
@{run}/udev/data/+hid:* r,
@{sys}/devices/pci[0-9]*/**/usb[0-9]/**/bluetooth/**/{uevent,name} r,
@{sys}/devices/platform/**/rfkill/**/name r,
@{sys}/devices/virtual/dmi/id/chassis_type r,
/dev/uhid rw,
/dev/uinput rw,
/dev/rfkill rw,
/dev/hidraw[0-9]* rw,
@{run}/sdp rw,
@{run}/udev/data/+hid:* r,
@{sys}/devices/virtual/dmi/id/chassis_type r,
@{sys}/devices/platform/**/rfkill/**/name r,
@{sys}/devices/pci[0-9]*/**/usb[0-9]/**/bluetooth/**/{uevent,name} r,
/var/lib/bluetooth/{,**} rw,
include if exists <local/bluetoothd>
}

View file

@ -1,5 +1,6 @@
# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2019-2021 Mikhail Morfikov
# Copyright (C) 2019-2022 Mikhail Morfikov
# Copyright (C) 2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
@ -12,19 +13,16 @@ profile e2fsck @{exec_path} {
include <abstractions/disks-write>
include <abstractions/user-download-strict>
capability dac_read_search,
capability sys_rawio,
@{exec_path} mr,
# To check for badblocks
/{usr/,}bin/{,ba,da}sh rix,
/{usr/,}{s,}bin/badblocks rPx,
owner @{run}/blkid/blkid.tab{,-*} rw,
owner @{run}/blkid/blkid.tab.old rwl -> @{run}/blkid/blkid.tab,
@{PROC}/swaps r,
owner @{PROC}/@{pid}/mounts r,
@{sys}/devices/**/power_supply/AC/online r,
/usr/share/file/misc/magic.mgc r,
# A place for file images
owner @{HOME}/**.{iso,img,bin,mdf,nrg} rwk,
@ -32,5 +30,14 @@ profile e2fsck @{exec_path} {
owner @{HOME}/**.{ISO,IMG,BIN,MDF,NRG} rwk,
owner @{MOUNTS}/**.{ISO,IMG,BIN,MDF,NRG} rwk,
@{run}/blkid/ rw,
owner @{run}/blkid/blkid.tab.old rwl -> @{run}/blkid/blkid.tab,
owner @{run}/blkid/blkid.tab{,-*} rw,
@{sys}/devices/**/power_supply/AC/online r,
@{PROC}/swaps r,
owner @{PROC}/@{pid}/mounts r,
include if exists <local/e2fsck>
}