-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(flatpak): add flatpak integration.
- Add flatpak profile - Add flatpak-bwrap subprofile: it manage the sandbox creation & has some larger access. - Add flatpak-app, default profile for sandboxed app. See Full system policy #252
- Loading branch information
Showing
5 changed files
with
219 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2023 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
abi <abi/3.0>, | ||
|
||
include <tunables/global> | ||
|
||
@{exec_path} = @{bin}/flatpak | ||
profile flatpak @{exec_path} flags=(attach_disconnected,mediate_deleted,complain) { | ||
include <abstractions/base> | ||
include <abstractions/consoles> | ||
include <abstractions/dconf-write> | ||
include <abstractions/freedesktop.org> | ||
include <abstractions/nameservice-strict> | ||
include <abstractions/openssl> | ||
include <abstractions/ssl_certs> | ||
include <abstractions/X-strict> | ||
|
||
capability dac_override, | ||
capability dac_read_search, | ||
capability net_admin, | ||
|
||
network inet dgram, | ||
network inet6 dgram, | ||
network inet stream, | ||
network inet6 stream, | ||
network netlink raw, | ||
|
||
@{exec_path} mr, | ||
|
||
@{bin}/bwrap rPx -> flatpak-bwrap, | ||
@{bin}/gpg rCx -> gpg, | ||
@{bin}/gpgconf rCx -> gpg, | ||
@{bin}/gpgsm rCx -> gpg, | ||
|
||
/usr/share/gvfs/remote-volume-monitors/*.monitor r, | ||
/usr/share/flatpak/{,**} r, | ||
|
||
/etc/flatpak/{,**} r, | ||
/etc/pulse/client.conf r, | ||
|
||
/var/lib/flatpak/{,**} rwlk, | ||
/var/tmp/#@{int} rw, | ||
|
||
/ r, | ||
|
||
owner @{HOME}/.var/ w, | ||
owner @{HOME}/.var/app/{,**} rw, | ||
|
||
owner @{user_cache_dirs}/flatpak/{,**} rw, | ||
owner @{user_config_dirs}/pulse/client.conf r, | ||
owner @{user_config_dirs}/user-dirs.dirs r, | ||
|
||
@{user_share_dirs}/flatpak/{,**} r, | ||
owner @{user_share_dirs}/flatpak/{,**} rw, | ||
|
||
/tmp/#@{int} rw, | ||
owner /dev/shm/flatpak*/{,**} rw, | ||
owner /tmp/ostree-gpg-*/{,**} rw, | ||
|
||
@{run}/user/@{uid}/.dbus-proxy/ w, | ||
@{run}/user/@{uid}/dconf/user rw, | ||
owner @{run}/user/@{uid}/.dbus-proxy/* rw, | ||
owner @{run}/user/@{uid}/.flatpak/ rw, | ||
owner @{run}/user/@{uid}/.flatpak/** rwlk -> @{run}/user/@{uid}/.flatpak/**, | ||
owner @{run}/user/@{uid}/app/ w, | ||
owner @{run}/user/@{uid}/app/*/ w, | ||
|
||
@{sys}/module/nvidia/version r, | ||
|
||
owner @{PROC}/@{pid}/stat r, | ||
|
||
deny @{user_share_dirs}/gvfs-metadata/* r, | ||
|
||
/dev/tty rw, | ||
/dev/tty@{int} rw, | ||
|
||
profile gpg { | ||
include <abstractions/base> | ||
|
||
capability dac_read_search, | ||
|
||
@{bin}/gpg{,2} mr, | ||
@{bin}/gpgconf mr, | ||
@{bin}/gpgsm mr, | ||
|
||
@{HOME}/@{XDG_GPG_DIR}/*.conf r, | ||
|
||
owner /tmp/ostree-gpg-*/ rw, | ||
owner /tmp/ostree-gpg-*/** rwkl -> /tmp/ostree-gpg-*/**, | ||
|
||
include if exists <local/flatpak_gpg> | ||
} | ||
|
||
include if exists <local/flatpak> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2023 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
# Default profile for all flatpak applications. Ideally, this profile should be | ||
# generated by flatpak itself with settings from the flatpak manifest. | ||
|
||
abi <abi/3.0>, | ||
|
||
include <tunables/global> | ||
|
||
profile flatpak-app flags=(attach_disconnected,mediate_deleted) { | ||
include <abstractions/base> | ||
include <abstractions/bwrap-app> | ||
|
||
network inet dgram, | ||
network inet6 dgram, | ||
network inet stream, | ||
network inet6 stream, | ||
network netlink raw, | ||
|
||
ptrace peer=flatpak-bwrap//&flatpak-app, | ||
|
||
signal peer=flatpak-bwrap//&flatpak-app, | ||
|
||
@{bin}/** rmix, | ||
@{lib}/** rmix, | ||
/app/** rmix, | ||
|
||
/var/lib/flatpak/app/{,**} r, | ||
|
||
@{run}/flatpak/{,**} r, | ||
|
||
include if exists <usr/flatpak-app.d> | ||
include if exists <local/flatpak-app> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# apparmor.d - Full set of apparmor profiles | ||
# Copyright (C) 2023 Alexandre Pujol <[email protected]> | ||
# SPDX-License-Identifier: GPL-2.0-only | ||
|
||
abi <abi/3.0>, | ||
|
||
include <tunables/global> | ||
|
||
profile flatpak-bwrap flags=(attach_disconnected,mediate_deleted) { | ||
include <abstractions/base> | ||
include <abstractions/bwrap-app> | ||
include <abstractions/dbus> | ||
|
||
capability dac_override, | ||
capability dac_read_search, | ||
capability net_admin, | ||
capability setpcap, | ||
capability sys_admin, | ||
capability sys_ptrace, | ||
capability sys_resource, | ||
|
||
network inet dgram, | ||
network inet6 dgram, | ||
network inet stream, | ||
network inet6 stream, | ||
network netlink raw, | ||
|
||
mount, | ||
umount, | ||
|
||
pivot_root oldroot=/newroot/ -> /newroot/, | ||
pivot_root oldroot=/tmp/oldroot/ -> /tmp/, | ||
|
||
ptrace peer=flatpak-bwrap//&flatpak-app, | ||
|
||
signal peer=flatpak-bwrap//&flatpak-app, | ||
|
||
@{bin}/** rmix, | ||
@{lib}/** rmix, | ||
/app/** rm, | ||
|
||
@{bin}/gtk{,4}-update-icon-cache rPx -> flatpak-bwrap//>k-update-icon-cache, | ||
@{bin}/update-desktop-database rPx -> flatpak-bwrap//&update-desktop-database, | ||
@{bin}/update-mime-database rPx -> flatpak-bwrap//&update-mime-database, | ||
@{bin}/xdg-dbus-proxy rPx -> flatpak-bwrap//&xdg-dbus-proxy, | ||
/app/** rPx -> flatpak-bwrap//&flatpak-app, | ||
|
||
/usr/share/flatpak/triggers/* rix, | ||
|
||
/usr/.ref rk, | ||
|
||
/etc/shells rw, | ||
|
||
/app/.ref k, | ||
/app/extra/** rw, | ||
/bindfile@{rand6} rw, | ||
/newroot/{,**} rw, | ||
/tmp/newroot/ w, | ||
/tmp/oldroot/ w, | ||
|
||
/var/lib/flatpak/app/{,**} r, | ||
/var/lib/flatpak/exports/** rw, | ||
/var/tmp/etilqs_@{hex} rw, | ||
|
||
owner @{run}/flatpak/{,**} rk, | ||
owner @{run}/ld-so-cache-dir/* rw, | ||
|
||
@{PROC}/sys/kernel/overflowgid r, | ||
@{PROC}/sys/kernel/overflowuid r, | ||
@{PROC}/sys/user/max_user_namespaces w, | ||
owner @{PROC}/@{pid}/gid_map rw, | ||
owner @{PROC}/@{pid}/setgroups rw, | ||
owner @{PROC}/@{pid}/uid_map rw, | ||
|
||
include if exists <usr/flatpak-bwrap.d> | ||
include if exists <local/flatpak-bwrap> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters