2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 01:57:43 +00:00

1486 Commits

Author SHA1 Message Date
Federico Quattrin
8cf0bda8d2 added '/usr/bin/free mr' in free profile 2025-06-10 09:26:02 -03:00
Federico Quattrin
a23d44e28b updated free profile copyright 2025-04-10 15:46:25 -03:00
Federico Quattrin
896944d24d added free profile 2025-04-10 15:45:21 -03:00
Ryan Lee
f6042bf34d profiles: remove the toybox profile
toybox is similar to busybox but is developed with Android development in
mind. Thus, it has the same issues as the busybox profile and should be
removed.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-04-07 12:55:00 -07:00
Christian Boltz
ef25cb160f
remmina: add audit flag for writing autostart file
... as discussed in https://gitlab.com/apparmor/apparmor/-/merge_requests/1603
2025-04-05 14:22:22 +02:00
John Johansen
bc067f8a8f Merge fusermount3: drop obsolete comment
The comment was introduced in
https://gitlab.com/apparmor/apparmor/-/merge_requests/1562, but
aa-logprof now understands these mount rules (since
https://gitlab.com/apparmor/apparmor/-/merge_requests/1565)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1613
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-04-05 09:41:55 +00:00
John Johansen
ddd9af1aec Merge Fix warnings and errors from Remmina profile
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1603
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-04-04 21:54:24 +00:00
John Johansen
0d6e447d24 Merge usr.bin.passwd profile fixes
* passwd -e LOGIN was failing
* Allow execution of /usr/sbin/nscd
  See: bee77ffc29/lib/nscd.c (L23-L27)
* Allow pam_passwdqc to read /etc/passwdqc.conf and passwdqc filter
  files (see https://www.openwall.com/passwdqc/)
* Allow setuid & fsetid capabilities
* Allow locking with /etc/shadow.PID & /etc/shadow.lock
* Allow shadow backup /etc/shadow- and whatever /etc/shadow+ is used for

Example failures:

```
type=AVC msg=audit(1740926750.381:99876): apparmor="DENIED" operation="capable" profile="/usr/bin/passwd" pid=16139 comm="passwd" capability=4  capname="fsetid"
type=AVC msg=audit(1740926025.892:99797): apparmor="DENIED" operation="capable" profile="/usr/bin/passwd" pid=14443 comm="passwd" capability=7  capname="setuid"
type=AVC msg=audit(1740926673.852:99871): apparmor="DENIED" operation="link" profile="/usr/bin/passwd" name="/etc/shadow.lock" pid=15961 comm="passwd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0 target="/etc/shadow.15961"FSUID="root" OUID="root"
type=AVC msg=audit(1740926025.892:99798): apparmor="DENIED" operation="mknod" profile="/usr/bin/passwd" name="/etc/shadow.14443" pid=14443 comm="passwd" requested_mask="c" denied_mask="c" fsuid=0 ouid=0FSUID="root" OUID="root"
type=AVC msg=audit(1740926502.637:99859): apparmor="DENIED" operation="open" profile="/usr/bin/passwd" name="/etc/shadow-" pid=15555 comm="passwd" requested_mask="wc" denied_mask="wc" fsuid=0 ouid=0FSUID="root" OUID="root"
type=AVC msg=audit(1740926820.608:99882): apparmor="DENIED" operation="rename_src" profile="/usr/bin/passwd" name="/etc/shadow+" pid=16275 comm="passwd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0FSUID="root" OUID="root"
```

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1566
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-04-04 21:49:15 +00:00
John Johansen
3740f78c11 profiles: Fix remmina profile
Two fixes for the remmina profile so we can merge this
1. mknod is not currently an allowed permission. It has to be
   downgraded to w
   Do that with a note about how this needs to change in the future

2. The original fix adds direct references to peer=(label=unconfined)
   Fix this to use a variable. So it will be easier to refactor and
   update.
   While doing it for the PMR also fixup the other direct unconfined
   references.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-04-04 14:34:10 -07:00
John Johansen
377753b5bf Merge Fixes for wpa_supplicant profile based on LP: #2098838
Representative log lines from the [LaunchPad bug](https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/2098838):

```
Feb 19 16:34:01 kernel: audit: type=1400 audit(1740000841.920:621): apparmor="DENIED" operation="create" class="net" profile="wpa_supplicant" pid=2211 comm="wpa_supplicant" family="netlink" sock_type="raw" protocol=0 requested="create" denied="create"
Feb 19 16:34:01 kernel: audit: type=1400 audit(1740000841.920:622): apparmor="DENIED" operation="open" class="file" profile="wpa_supplicant" name="/sys/devices/pci0000:00/0000:00:14.3/ieee80211/phy0/name" pid=2211 comm="wpa_supplicant" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
Feb 19 16:34:01 kernel: audit: type=1400 audit(1740000841.920:623): apparmor="DENIED" operation="create" class="net" profile="wpa_supplicant" pid=2211 comm="wpa_supplicant" family="inet" sock_type="dgram" protocol=0 requested="create" denied="create"
Feb 19 16:34:01 kernel: audit: type=1400 audit(1740000841.920:624): apparmor="DENIED" operation="open" class="file" profile="wpa_supplicant" name="/sys/devices/pci0000:00/0000:00:14.3/ieee80211/phy0/name" pid=2211 comm="wpa_supplicant" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
```

However, regression potential remains for other setups (e.g. USB WiFi dongles), and we should maybe open up a discussion about when we want to target profiles into `apparmor.d` as opposed to `extras`.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1554
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-04-04 21:09:51 +00:00
Christian Boltz
4c8ae4760b
fusermount3: drop obsolete comment
The comment was introduced in
https://gitlab.com/apparmor/apparmor/-/merge_requests/1562, but
aa-logprof now understands these mount rules (since
https://gitlab.com/apparmor/apparmor/-/merge_requests/1565)
2025-04-04 21:15:55 +02:00
John Johansen
0d1c694a66 Merge profiles: allow fusermount3 to mount in directories used by flatpak (LP: 2100295)
These are the default directory mounts used by Flatpak's system cache for mounting revokefs-fuse. Unfortunately, the new rules are quite broad, but we might not be able to do much better than that.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1562
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-04-02 17:54:13 +00:00
Maxime Bélair
d1108183a7 Fix lsblk profile for disks over network
Fixes: https://bugs.launchpad.net/maas/+bug/2092232

In the lsblk profile, the rule responsible for allowing to read disks
over network was not generic enough to handle some cases, such as IBM
Power. The new rule, `@{sys}/devices/**/host@{int}/** r`, should support
all cases.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-04-02 13:31:37 +02:00
Paulo Flabiano Smorigo
ee3dfb4a5d
Fix warnings and errors from Remmina profile
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>
2025-04-01 14:18:24 -03:00
klo
23c6e17f7f profiles: allow fusermount3 to (u)mount nested subdirs of @{run}/user/@{uid}
This is needed to fix the gnome-remote-desktop daemon, which mounts in a
directory like /run/user/119/gnome-remote-desktop/cliprdr-ABm0Gd/.

Fixes: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/2103889

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-03-24 12:22:19 -07:00
Ryan Lee
eb5a4f8628 Merge small fix for lsblk profile
Fixes [launchpad bug #2103524](https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/2103524)

lsblk on some virtualized systems require access to directory
`/sys/devices/LNXSYSTM:*/LNXSYBUS:*/**` since block devices can be exposed
in this directory.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1584
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: Ryan Lee <rlee287@yahoo.com>
2025-03-20 09:23:17 -07:00
Scarlett Moore
7f12ccf695 Add qt6 abstractions for qt6 to fix KDE application crashes. 2025-03-20 09:09:54 -07:00
Maxime Bélair
b527256c0d small fix for lsblk profile
Fixes bug #2103524

lsblk on some virtualized systems require access to directory
/sys/devices/LNXSYSTM:*/LNXSYBUS:*/** since block devices can be exposed
in this directory.
2025-03-20 09:07:14 +01:00
Hector Cao
4476eb8288 Add abstract profile for libnuma
For executables dynamically linked to libnuma, the runtimer linker
invokes libnuma functions (num_init) that try to access
/sys/devices/system/node/ and if the application's apparmor
profile does not allow this access, this access will be denied
by apparmor with following error message:

  apparmor="DENIED" operation="open" class="file"
  name="/sys/devices/system/node/" comm="qemu-bridge-hel"
  requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

Here is the simplified call trace:

  0 ... in ?? () from /lib/x86_64-linux-gnu/libnuma.so.1
  1 ... in call_init (...) at ./elf/dl-init.c:74
  2 ... in call_init (...) at ./elf/dl-init.c:120
  3 _dl_init (...) at ./elf/dl-init.c:121
  4 ... in _dl_start_user () from /lib64/ld-linux-x86-64.so.2

This commit adds an abstract profile that applications that are
linked to libnuma can include in their apparmor profile.

MR: mailing list patch
Signed-off-by: Hector Cao <hector.cao@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-03-19 09:19:21 -07:00
John Johansen
791935b9f8 Merge profiles: allow sanitized_helper to run snap applications
This allows evince to share the document to a program running as a snap,
e.g. mail via firefox. Given that /usr/bin/snap itself is not confined
I chose to use ux, rather than pux.

Tested locally on Ubuntu 24.04 by sharing a document from evince to
firefox.

Fixes: https://bugs.launchpad.net/apparmor/+bug/2095872
Jira: https://bugs.launchpad.net/apparmor/+bug/2095872

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1572
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-03-18 16:17:04 +00:00
Ryan Lee
a82b16f059 Merge Add ncurses abstraction with terminfo paths
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1550
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Ryan Lee <rlee287@yahoo.com>
2025-03-17 09:16:14 -07:00
Zygmunt Krynicki
2fe23fef17 profiles: allow sanitized_helper to run snap applications
This allows evince to share the document to a program running as a snap,
e.g. mail via firefox. Given that /usr/bin/snap itself is not confined
I chose to use ux, rather than pux.

Tested locally on Ubuntu 24.04 by sharing a document from evince to
firefox.

Fixes: https://bugs.launchpad.net/apparmor/+bug/2095872
Jira: https://bugs.launchpad.net/apparmor/+bug/2095872

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2025-03-10 13:16:48 +01:00
pyllyukko
ab1a455f05
usr.bin.passwd profile fixes
* passwd -e LOGIN was failing
* Allow execution of /usr/sbin/nscd
  See: bee77ffc29/lib/nscd.c (L23-L27)
* Allow pam_passwdqc to read /etc/passwdqc.conf and passwdqc filter
  files (see https://www.openwall.com/passwdqc/)
* Allow setuid & fsetid capabilities
* Allow locking with /etc/shadow.PID & /etc/shadow.lock
* Allow shadow backup /etc/shadow- and whatever /etc/shadow+ is used for
2025-03-02 16:51:33 +02:00
Ryan Lee
59124362d3 profiles: allow fusermount3 to mount in directories used by flatpak
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-02-27 16:50:19 -08:00
Ryan Lee
bc0426ef18 Fixes for wpa_supplicant profile based on LP: #2098838
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-02-21 08:55:36 -08:00
Georgia Garcia
45a945acd3 Merge profiles: allow ro mounts in fusermount3 profile
These are needed by e.g. AppImages

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1556
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-02-20 18:07:58 +00:00
Ryan Lee
a20409cf1e profiles: allow ro mounts in fusermount3 profile
These are needed by e.g. AppImages

Closes: https://bugs.launchpad.net/bugs/2098993
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-02-20 09:49:27 -08:00
Ryan Lee
1b87b7be5e Replace terminfo lines in profiles with the terminfo abstraction
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-02-19 17:14:28 -08:00
Ryan Lee
c45ce5502e Add terminfo abstraction with terminfo paths searched by ncurses
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-02-19 16:48:19 -08:00
John Johansen
7abfc1baf7 profiles: fix sbuild to work with the unprivileged_unshare profile
sbuild is an unconfined profile allowing it to by-pass the unprivlieged
user namespace restritction.

unconfined profiles us a pix transition which means when the
unprivileged_unshare profile is enabled, the binaries in an unconfined
profile calls unshare it will transition to the unprivileged_unshare
profile.

This will break sbuild because it needs capabilities within the
user namespace.

However we can not just add a x transition rule to unconfined profiles,
the transitions won't be respected. Instead we have to make the profile
a default allow profile, and add a transition that will override
the default pix transition of allow all.

We have to add the attached_disconnected and mediated_deleted flags
because sbuild is manipulating mounts.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-02-19 16:05:57 -08:00
Ryan Lee
09573220d2 profiles: add missing fowner capability to the tar profile
This manifested with chmod calls failing in autopkgtests of dbus and snapd

Reported-by: Alex Murray <alex.murray@canonical.com>
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-02-18 17:11:55 -08:00
John Johansen
b5ff20b5f1 Merge tunable: add letter, alphanumeric character, hex and words variables.
Follow up from !1544 with the other basic variables.

Variables such as `@{rand6}` and `@{word6}` are very commonly used as they allow us to restrict access from rules such as: `/tmp/*`, `/tmp/??????`

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1546
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-14 19:34:00 +00:00
John Johansen
dc583bc1d4 Merge abstraction: add devices-usb & devices-usb-read
Needed for https://gitlab.com/apparmor/apparmor/-/merge_requests/1433

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1545
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-14 19:31:40 +00:00
Alexandre Pujol
8af71cd5f5
tunable: add letter, alphanumeric character, hex and words variables. 2025-02-14 19:56:28 +01:00
Alexandre Pujol
4591ed63ba
abstraction: add devices-usb & devices-usb-read 2025-02-14 19:44:25 +01:00
Alexandre Pujol
d7a73847de
tunable: add int variable 2025-02-14 19:16:25 +01:00
John Johansen
8e586e5492 Merge profiles: fix non-user-namespace-related sandbox bypass in unshare profile
The unshare-userns-restrict profile contained a cx transition to
transition to a profile that allows most things while denying
capabilities:

audit allow cx /** -> unpriv,

However, this transition does not stack the unshare//unpriv profile
against any other profile the target binary might have had. As a result,
the lack of stacking resulted in a non-namespace-related sandboxing
bypass in which attachments of other profiles that should have confined
the target binary do not get applied. Instead, we adopt a stack similar
to the one in bwrap-userns-restrict, with the exception that unshare
does not use no-new-privs and therefore only needs a two-layer stack
instead of a three-layer stack.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1533
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-12 10:29:33 +00:00
John Johansen
4c64266f2b Merge initial fusermount3 profile
Initial profile for fusermount3. Feedback welcome 😄

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1514
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-12 09:40:28 +00:00
Ryan Lee
c6ba1bd2fb Remove no-longer-true aa-enforce line from unshare-userns-restrict
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-02-11 11:56:29 -08:00
Ryan Lee
ab3ca1a93f profiles: fix non-user-namespace-related sandbox bypass in unshare profile
The unshare-userns-restrict profile contained a cx transition to
transition to a profile that allows most things while denying
capabilities:

audit allow cx /** -> unpriv,

However, this transition does not stack the unshare//unpriv profile
against any other profile the target binary might have had. As a result,
the lack of stacking resulted in a non-namespace-related sandboxing
bypass in which attachments of other profiles that should have confined
the target binary do not get applied. Instead, we adopt a stack similar
to the one in bwrap-userns-restrict, with the exception that unshare
does not use no-new-privs and therefore only needs a two-layer stack
instead of a three-layer stack.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-02-11 11:55:19 -08:00
Julia Sarris
d5d2aa4d03 mnt mount rule change 2025-02-10 10:38:02 -05:00
John Johansen
ef4ee955f4 Merge profiles: add frr related profiles
Add several profiles for daemons included in the frr package. It have been tested following upstream testing guide https://docs.frrouting.org/projects/dev-guide/en/latest/testing.html

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1380
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-08 05:50:13 +00:00
John Johansen
0e46a51738 Merge Initial profile for iotop-c
AppArmor profile for `iotop-c`, developed and tested in Ubuntu 24.04 LTS.

Signed-off-by: Allen Huang <allen.huang@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1520
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 18:53:51 +00:00
John Johansen
61c332d25a Merge profiles: add wpa_supplicant
profile for wpa_supplicant in oracular

tested: creating, connecting, disconnecting, removing wireless networks, hotspot and p2 networks

Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1385
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 18:52:12 +00:00
Julia Sarris
2eaea1783f modification to use **/ instead of ** 2025-02-07 09:51:30 -05:00
Allen Huang
0c4f70d81b
profiles/iotop-c: remove owner, redundant rules
- Remove `owner` in /proc/ rules to enable non-root users
- add "include if exists" line to pass the pipeline
- change <abstractions/nameservice> to smaller <abstractions/nameservice-strict>

Signed-off-by: Allen Huang <allen.huang@canonical.com>
2025-02-07 13:40:14 +00:00
Sudhakar Verma
0da42927e4 profiles: add wpa_supplicant
Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com>
2025-02-07 18:46:55 +05:30
John Johansen
13caf52705 Merge profiles/apparmor.d: add wireguard profile
Add AA profiles for wireguard tools: `wg` and `wg-quick`. This profile has been tested on the latest oracular wireguard version `1.0.20210914-1.1ubuntu1` and the latest upstream version. In particular, this has been tested using the upstream tests in:
- https://git.zx2c4.com/wireguard-linux-compat/tree/src/tests/netns.sh
- https://git.zx2c4.com/wireguard-tools/tree/contrib/ncat-client-server
- https://git.zx2c4.com/wireguard-tools/tree/contrib/json
- https://git.zx2c4.com/wireguard-tools/tree/contrib/reresolve-dns

Similarly to the MR !1319 for `socat`, Few CI tests are failing due to the inclusion of apparmor.d/abstractions/strict-nameservice.

Signed-off-by: Evan Caville <evan.caville@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1323
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:34:53 +00:00
Evan Caville
4c79c382cf profiles/apparmor.d: add wireguard profile 2025-02-07 07:34:53 +00:00
John Johansen
da7288c710 Merge add tshark profile
- add profile for tshark
- sub profile for dumpcap
- tested with tests from upstream wireshark project,not all test cases 
  passed but failures unrelated to apparmor restriction

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1384
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:32:33 +00:00