Commit graph

1416 commits

Author SHA1 Message Date
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
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
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
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
Alex Murray
f6a733de6a
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>
2025-02-04 11:28:30 +10:30
Octavio Galland
c9cfbb4668 restrict networking to localhost 2025-02-03 16:33:13 -03:00
Octavio Galland
38399e7720 disallow ${HOME}/bin 2025-02-03 16:32:58 -03:00
Octavio Galland
e296d5b04c follow rule ordering convention 2025-01-23 13:50:27 -03:00
Octavio Galland
790c795f90 always execute binaries under current profile 2025-01-23 13:50:27 -03:00
Octavio Galland
ef0d5b4cde allow networking 2025-01-23 13:50:27 -03:00
Octavio Galland
667816fe43 explictly allow binaries from certain directories 2025-01-23 13:50:27 -03:00
Octavio Galland
e7807b3761 allow any program to be executed 2025-01-23 13:50:27 -03:00
Octavio Galland
29637f19c9 allow more binaries and capabilities 2025-01-23 13:50:27 -03:00
Octavio Galland
5271d6a74a Fix syntax error, use l to specify executable link 2025-01-23 13:50:27 -03:00
Octavio Galland
486c8c26fe Initial profile for tar binary 2025-01-23 13:50:27 -03:00
Zygmunt Krynicki
5c17df0219 profiles: attach toybox profile to /usr/bin/toybox
This is the actual path used on Debian and derivatives.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2025-01-21 11:16:24 +01:00
pyllyukko
ba765e0eab
postfix-showq profile fix
Allow reading queue ID files from /var/spool/postfix/incoming/.

Similar to 3c2aae3.
2025-01-18 09:46:24 +02:00
John Johansen
e5a960a685 Merge cupsd: Add /etc/paperspecs and convert to @etc_ro/rw
I had this message in my log

```
Dez 30 08:14:46 kernel: audit: type=1400 audit(1735542886.787:307): apparmor="DENIED" operation="open" class="file" profile="/usr/sbin/cupsd" name="/etc/paperspecs" pid=317509 comm="cupsd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
```

If the second commit is bad, I can drop it.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1472
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-01-09 09:48:48 +00:00
Jörg Sommer
318fb30446 Allow write access to /run/user/*/dconf/user
Gtk applications like Firefox request write access to the file
`/run/user/1000/dconf/user`. The code in `dconf_shm_open` opens the file
with `O_RDWR | O_CREAT`.

4057f8c84f/shm/dconf-shm.c (L68)
2024-12-31 10:23:50 +01:00
Jörg Sommer
c3af6228fd cupsd: convert profile to @etc_ro/rw
While cups itself writes to /etc the others require only read-only access
and might therefore live in /usr/etc.
2024-12-31 10:12:16 +01:00
Jörg Sommer
97d7fa3f5f cupsd: Add /etc/paperspecs read access
Cups uses libpaper which accesses /etc/paperspecs.

ce42216e2e/lib/libpaper.c.in.in (L419)
2024-12-31 10:12:16 +01:00
John Johansen
8c799f4eec Merge Allow python cache under the @{HOME}/.cache/ dir
Starting with Python 3.8, you can use the PYTHONPYCACHEPREFIX environment
variable to define a cache directory for Python [1]. I think most people would set
this dir to @{HOME}/.cache/python/ , so the python abstraction should allow
writing to this location.

[1]: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPYCACHEPREFIX

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1467
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-12-24 22:33:28 +00:00
Mikhail Morfikov
03b5a29b05
Allow python cache under the @{HOME}/.cache/ dir
Starting with Python 3.8, you can use the PYTHONPYCACHEPREFIX environment
variable to define a cache directory for Python [1]. I think most people would set
this dir to @{HOME}/.cache/python/ , so the python abstraction should allow
writing to this location.

[1]: https://docs.python.org/3/using/cmdline.html#envvar-PYTHONPYCACHEPREFIX
2024-12-19 09:33:13 +01:00
Georgia Garcia
f9edc7d4c1 profiles: transmission-gtk needs attach_disconnected
From LP: #2085377, when using ip netns to torrent traffic through a
VPN, attach_disconnected is needed by the policy because ip netns sets
up a mount namespace.

Fixes: https://bugs.launchpad.net/bugs/2085377
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-12-17 09:32:18 -03:00
Alex Murray
3469c62b36
profiles/apparmor.d/rygel: enumerate specific bits for /sys and /dev
Instead of denying everything here, enumerate just the bits that are required
and also deny access to display devices since that is not actually needed by
rygel itself.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2024-12-12 13:05:52 +10:30
Alex Murray
472d002a96
profiles/apparmor.d/rygel: allow liborc bits for mx-extract child
mx-extract also uses these parts of gstreamer so allow it as well as for the
main rygel profile.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2024-12-12 13:05:06 +10:30
Alex Murray
459e5f9649
profiles/apparmor.d/rygel: allow to create gstreamer cache dir
It is possible this doesn't exist already so allow rygel to create it in that
case.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2024-12-12 13:04:33 +10:30
pyllyukko
76dcf46d4f
postfix-smtp profile fix
Allow locking for /var/spool/postfix/pid/unix.relay.
2024-12-10 19:32:49 +02:00
Alex Murray
00e4908d9f
profiles/apparmor.d/rygel: use fd.o abstraction for mx-extract child
This allows access to the freedesktop.org mime info amongst others which is
needed for rygel mx-extract to index files etc.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2024-12-10 12:03:14 +10:30
Alex Murray
62cdb6fd79
profiles/apparmor.d/rygel: add DBus rule for MountTracker
Signed-off-by: Alex Murray <alex.murray@canonical.com>
2024-12-10 12:03:00 +10:30
Alex Murray
6a23c26a12
profiles/apparmor.d/rygel: allow liborc temp files
Signed-off-by: Alex Murray <alex.murray@canonical.com>
2024-12-10 12:00:53 +10:30
Alex Murray
29e00fe11f
profiles/apparmor.d/rygel: silence unneeded /{dev,sys} accesses
Signed-off-by: Alex Murray <alex.murray@canonical.com>
2024-12-10 12:00:13 +10:30