apparmor.d/apparmor.d/profiles-s-z/snap
2023-09-29 19:25:30 +01:00

110 lines
2.9 KiB
Plaintext

# apparmor.d - Full set of apparmor profiles
# Copyright (C) 2022 Alexandre Pujol <alexandre@pujol.io>
# SPDX-License-Identifier: GPL-2.0-only
abi <abi/3.0>,
include <tunables/global>
@{bin_dirs} = @{bin}/ /snap/snapd/@{int}@{bin}
@{lib_dirs} = @{lib}/ /snap/snapd/@{int}@{lib}
@{exec_path} = @{bin_dirs}/snap
profile snap @{exec_path} {
include <abstractions/base>
include <abstractions/consoles>
include <abstractions/dbus-session-strict>
include <abstractions/dbus-strict>
include <abstractions/disks-read>
include <abstractions/nameservice-strict>
capability dac_read_search,
capability sys_admin,
unix (send, receive) type=stream peer=(label=apt),
mount options=(ro, silent) -> /tmp/snapd-auto-import-mount-@{int}/,
dbus (send, receive) bus=session path=/org/freedesktop/
interface=org.freedesktop.systemd1.Manager
member={StartTransientUnit,JobRemoved}
peer=(name=:*, label=unconfined),
dbus (send, receive) bus=system path=/org/freedesktop/
interface=org.freedesktop.systemd1.Manager
member={StartTransientUnit,JobRemoved},
dbus (send, receive) bus=system path=/org/freedesktop/systemd1
interface=org.freedesktop.systemd1.Manager,
dbus send bus=session path=/org/freedesktop/portal/documents
interface=org.freedesktop.portal.Documents
member=GetMountPoint
peer=(name=org.freedesktop.portal.Documents),
@{exec_path} mrix,
@{bin}/mount rix,
@{bin}/gpg{,2} rCx -> gpg,
@{bin}/systemctl rPx -> child-systemctl,
/snap/{,**} rw,
# @{lib_dirs}/snap-confine rPx -> /usr/lib/snapd/snap-confine,
@{lib_dirs}/snapd/snap-seccomp rPx,
@{lib_dirs}/snapd/snapd rPx,
/etc/fstab r,
/var/lib/snapd/{,**} rwk,
/var/cache/snapd/commands.db rwk,
/var/cache/snapd/names r,
@{HOME}/snap/{,**} rw,
owner /tmp/snapd-auto-import-mount-@{int}/ rw,
@{run}/user/@{uid}/bus rw,
owner @{run}/user/@{uid}/.mutter-Xwaylandauth.[0-9A-Z]* r,
owner @{run}/user/@{uid}/gdm/Xauthority r,
owner @{run}/user/@{uid}/snapd-session-agent.socket rw,
owner @{run}/user/@{uid}/systemd/notify rw,
@{run}/mount/utab r,
@{run}/snapd.socket rw,
@{sys}/kernel/mm/transparent_hugepage/hpage_pmd_size r,
@{sys}/kernel/security/apparmor/features/ r,
@{PROC}/@{pids}/cgroup r,
@{PROC}/@{pids}/mountinfo r,
@{PROC}/cgroups r,
@{PROC}/cmdline r,
@{PROC}/sys/kernel/random/boot_id r,
@{PROC}/sys/kernel/random/uuid r,
@{PROC}/sys/kernel/seccomp/actions_avail r,
@{PROC}/version r,
/dev/tty@{int} rw,
/dev/ttyS[0-9]* rw,
deny @{user_share_dirs}/gvfs-metadata/* r,
profile gpg {
include <abstractions/base>
@{bin}/gpg{,2} mr,
@{bin}/dirmngr rix,
@{bin}/gpg-agent rix,
@{bin}/gpg-connect-agent rix,
owner @{HOME}/.snap/gnupg/ rw,
owner @{HOME}/.snap/gnupg/** rwkl,
include if exists <local/snap_gpg>
}
include if exists <local/snap>
}