Commit graph

1457 commits

Author SHA1 Message Date
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
Shishir Subedi
594f391502 add tshark profile 2025-02-07 07:32:32 +00:00
John Johansen
d8a96615d8 Merge Add a profile for ZNC
Some weirdnesses:
- The Perl abstraction specifies an ix execution mode for Perl, while my impression from the Python abstraction is that we shouldn't be specifying execution modes for the script interpreter in the abstractions. It's probably too late to change that though.
- Tcl apparently doesn't have an abstraction available. Given the way it's embedded into applications like ZNC, I'm assuming that Tcl doesn't have support files the way Python does.

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1376
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:31:50 +00:00
John Johansen
c7be379d1b Merge profiles/apparmor.d: add tnftp profile
Add AA profile for tnftp. This profile has been tested on the latest oracular tnftp version 20230507-2build3 which is also the latest upstream version. This profile limits the file downloads to common download directories and /tmp. It also cripples the "!" command denying access to network and allowing the execution of binaries located directories for which we deny write access. Any feedback is welcome.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1363
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:31:25 +00:00
John Johansen
91849b31e0 Merge Add remmina profile
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1348
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:30:14 +00:00
John Johansen
54fc2c2ba1 Merge socat: add profile
Add AA profile for `socat`. This profile has been tested on the latest oracular socat version `1.8.0.0-4build3` and the latest upstream version `1.8.0.1`. I raised the PR and this profile has already been merged on the `roddhjav/apparmor.d` repo, [here](https://github.com/roddhjav/apparmor.d/pull/454). For now, I have added this profile in "extra", but let me know if you think otherwise, any feedback is welcome.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1319
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:22:48 +00:00
John Johansen
d01373a748 Merge profiles/apparmor.d: add rygel profile
Signed-off-by: Alex Murray <alex.murray@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1311
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:22:06 +00:00
Julia Sarris
03acee5939 revised fusermount3 profile 2025-02-06 16:11:10 -05:00
John Johansen
b378da1f9c Merge Add an Alsamixer profile
This profile deliberately does not use `abstractions/audio`, instead listing only the subset of the interfaces required to enumerate audio devices and control their volume, without the parts needed to actually send or receive audio from them. This could also be a useful basis for splitting `abstractions/audio` into finer-grained subcomponents.

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1517
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-06 20:26:59 +00:00
Ryan Lee
b5b1944f58 Merge profiles: fix unshare for deleted files
Unfortunately similar to bwrap unshare will need the mediate_deleted
flag in some cases.

see
  commit 6488e1fb7 "profiles: add mediate_deleted to bwrap"

Signed-off-by: John Johansen <john.johansen@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1521
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: Ryan Lee <rlee287@yahoo.com>
2025-02-06 19:44:21 +00:00
John Johansen
5585a4fc9e Merge profiles/apparmor.d: add profile for tinyproxy
This was tested using the test-tinyproxy.py script from qa-regression-testing as
well as by running the upstream test suite with a brief hack to ensure it
invokes tinyproxy with aa-exec -p tinyproxy first.

Signed-off-by: Alex Murray <alex.murray@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1477
Approved-by: Ryan Lee <rlee287@yahoo.com>
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: John Johansen <john@jjmx.net>
2025-02-06 19:28:41 +00:00
John Johansen
c157eb0cb6 profiles: fix unshare for deleted files
Unfortunately similar to bwrap unshare will need the mediate_deleted
flag in some cases.

see
  commit 6488e1fb7 "profiles: add mediate_deleted to bwrap"

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-02-06 11:25:35 -08:00
John Johansen
e86fe8c96c Merge Add lsblk profile
AppArmor profile for the lsblk binary, developed and tested on Ubuntu 24.04.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1437
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-06 19:21:14 +00:00
Ryan Lee
49babf1d17 Add an Alsamixer profile
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-02-06 11:08:46 -08:00
Allen Huang
e53cda33a3
profiles/iotop-c: use @{HOME}
Signed-off-by: Allen Huang <allen.huang@canonical.com>
2025-02-06 14:55:16 +00:00
Allen Huang
7bd505aa65
profiles/iotop-c: add profile name and rename the file
Signed-off-by: Allen Huang <allen.huang@canonical.com>
2025-02-06 14:54:39 +00:00
Allen Huang
5b874f45f3
Add iotop-c profile
Signed-off-by: Allen Huang <allen.huang@canonical.com>
2025-02-06 11:32:58 +00:00
Alex Murray
94d494d8fe
profiles/apparmor.d/tinyproxy: allow capability set[ug]id
Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-06 18:52:32 +10:30
Alex Murray
965a678cb7
profiles/apparmor.d/tinyproxy: allow capability setgid
tinyproxy drops privileges in some configurations so ensure we allow it.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-06 18:15:18 +10:30
Alex Murray
f2a6860767
profiles/apparmor.d/tinyproxy: allow dgram and netlink network access
This is required for DNS resolution

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-06 18:15:00 +10:30
Jorge Sancho Larraz
42297559e8 profiles/bgpd: remove redundant /etc/services 2025-02-05 17:00:22 +01:00
Jorge Sancho Larraz
a6c2efcb4a profiles/a/frr: allow any file in log directory 2025-02-05 16:32:54 +01:00
Jorge Sancho Larraz
4fa3a02127 profiles/a/frr: add additional configuration file location 2025-02-05 16:31:45 +01:00
Jorge Sancho Larraz
c67061c64f profiles/a/frr: clean up rules only needed by topotests 2025-02-05 16:31:03 +01:00
Jorge Sancho Larraz
7a98040b1b profiles/a/frr: remove owner keyword causing failures 2025-02-05 16:29:29 +01:00
Jorge Sancho Larraz
fa28d65f44 profiles/a/frr-snmp: use abstractions/openssl 2025-02-05 16:27:57 +01:00
Alex Murray
861be3904b
profiles/apparmor.d/tinyproxy: use nameservice-strict abstraction
tinyproxy does not need all of nameservice, nameservice-strict is
sufficient. Thanks to @cboltz for the suggestion.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-04 11:28:31 +10:30
Alex Murray
503a89e5ef
profiles/apparmor.d/tinyproxy: clarify comments regarding capabilities
As suggested by @cboltz.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-04 11:28:30 +10:30
Alex Murray
3ba204a635
profiles/apparmor.d/tinyproxy: clarify use of local override
Add comments to the profile to explain the use of the local override if the
default configuration is changed. As suggested by @rlee287.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-04 11:28:30 +10:30
Alex Murray
6f961edaf9
profiles/apparmor.d/tinyproxy: allow flexibility in deployment
Add rules to allow tinyproxy to bind to privileged ports and access files even
when run as unprivileged/privileged users when using non-standard
configurations. As suggested by @rlee287.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-04 11:28:30 +10:30