Commit graph

1050 commits

Author SHA1 Message Date
Julia Sarris
d5d2aa4d03 mnt mount rule change 2025-02-10 10:38:02 -05:00
Julia Sarris
2eaea1783f modification to use **/ instead of ** 2025-02-07 09:51:30 -05:00
Julia Sarris
03acee5939 revised fusermount3 profile 2025-02-06 16:11:10 -05:00
Julia Sarris
124f8efddc initial fusermount3 profile 2025-01-30 09:24:32 -05: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
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
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
Christian Boltz
d305028502
smbd: allow capability chown
This is neeed for "inherit owner = yes" in smb.conf.

From man smb.conf:

    inherit owner (S)

    The ownership of new files and directories is normally governed by
    effective uid of the connected user. This option allows the Samba
    administrator to specify that the ownership for new files and
    directories should be controlled by the ownership of the parent
    directory.

Fixes: https://bugzilla.suse.com/show_bug.cgi?id=1234327
2024-12-09 20:45:42 +01:00
pyllyukko
0a5a9c465f Dovecot profile: Allow reading of /proc/sys/kernel/core_pattern
See <https://dovecot.org/bugreport.html>
2024-11-21 16:21:17 +02:00
John Johansen
3c40aab1a0 Merge profiles: update dconf abstraction to use @{etc_ro}
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1402
Approved-by: Ryan Lee <rlee287@yahoo.com>
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-11-06 03:06:57 +00:00
Georg Pfuetzenreuter
f575817b68
php-fpm: widen allowed socket paths
It is common for packaged PHP applications to ship a PHP-FPM
configuration using a scheme of "$app.sock" or or "$app.socket" instead
of using a generic FPM socket.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-11-05 20:03:11 +01:00
Georgia Garcia
cbe8d295a5 profiles: update dconf abstraction to use @{etc_ro}
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-10-31 09:52:07 +01:00
Christian Pfeiffer
6a5432b2b0 profiles: add support for ArchLinux php-legacy package to php-fpm
ArchLinux ships a secondary PHP package called php-legacy with different
paths. As of now, the php-fpm profile will cover this binary but
inadequately restrict it.

Fixes: #454
2024-10-30 09:39:37 +01:00
John Johansen
4fe3e30abc Merge abstractions/nameservice: include nameservice-strict
... and drop all rules it contains from abstractions/nameservice.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1373
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-10-29 15:26:43 +00:00
John Johansen
82a4e70248 Merge zgrep: deny passwd access
Bash will try to read the passwd database to find the shell of a user if
$SHELL is not set. This causes zgrep to trigger

```
apparmor="DENIED" operation="open" class="file" profile="zgrep" name="/etc/nsswitch.conf" comm="zgrep" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
apparmor="DENIED" operation="open" class="file" profile="zgrep" name="/etc/passwd" comm="zgrep" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
```

if called in a sanitized environment. As the functionality of zgrep is
not impacted by a limited Bash environment, add deny rules to avoid the
potentially misleading AVC messages.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1361
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-10-29 13:50:06 +00:00
John Johansen
e48ab421b5 Merge Check if all profiles and abstractions contain abi/4.0
... and add abi/4.0 where it was missing

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1358
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-10-29 12:48:41 +00:00
John Johansen
ab16377838 Merge zgrep: allow reading /etc/nsswitch.conf and /etc/passwd
Seen on various VMs, my guess is that bash wants to translate a uid to a
username.

Log events (slightly shortened)

apparmor="DENIED" operation="open" class="file" profile="zgrep" name="/etc/nsswitch.conf" comm="zgrep" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

apparmor="DENIED" operation="open" class="file" profile="zgrep" name="/etc/passwd" comm="zgrep" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

I propose this patch for 3.0..master

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1357
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-10-29 12:45:48 +00:00
Steve Beattie
4d3b094d9e profiles: transmission-daemon needs attach_disconnected
Systemd's PrivateTmp= in transmission service is causing mount namespaces to be used leading to disconnected paths

[395201.414562] audit: type=1400 audit(1727277774.392:573): apparmor="ALLOWED" operation="sendmsg" class="file" info="Failed name lookup - disconnected path" error=-13 profile="transmission-daemon" name="run/systemd/notify" pid=193060 comm="transmission-da" requested_mask="w" denied_mask="w" fsuid=114 ouid=0

Fixes: https://bugs.launchpad.net/bugs/2083548
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1355
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: Steve Beattie <steve+gitlab@nxnw.org>
2024-10-18 21:47:09 +00:00
Ryan Lee
c1480d761f Merge Future-proof the Python abstraction for beyond Python 3.19
See https://gitlab.com/apparmor/apparmor/-/merge_requests/1376#note_2161284748

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1381
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Ryan Lee <rlee287@yahoo.com>
2024-10-16 22:27:21 +00:00
Ryan Lee
8eb7e7f63b Future-proof the Python abstraction for beyond Python 3.19
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2024-10-16 09:36:32 -07:00
Giampaolo Fresi Roglia
5be4295b5a
abstractions/nameservice: tighten libnss_libvirt file access 2024-10-16 10:48:03 +02:00
Christian Boltz
372ad8f6b9
abstractions/nameservice: include nameservice-strict
... and drop all rules it contains from abstractions/nameservice.
2024-10-11 20:53:52 +02:00
Alexandre Pujol
1966c36c1d
abstraction: add missing abi in nameservice-strict. 2024-10-09 21:42:48 +01:00
Alexandre Pujol
62e7220271
abstraction: include nss-systemd in nameservice-strict. 2024-10-09 21:25:57 +01:00
Alexandre Pujol
1a8d8f3695
abstraction: add nameservice-strict.
Imported from gitlab.com/roddhjav/apparmor.d
2024-10-09 19:57:16 +01:00
Giampaolo Fresi Roglia
e53f300821
nameservice: add support for libnss-libvirt 2024-10-09 10:12:26 +02:00
Georg Pfuetzenreuter
48483f2ff8
zgrep: deny passwd access
Bash will try to read the passwd database to find the shell of a user if
$SHELL is not set. This causes zgrep to trigger

```
apparmor="DENIED" operation="open" class="file" profile="zgrep" name="/etc/nsswitch.conf" comm="zgrep" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
apparmor="DENIED" operation="open" class="file" profile="zgrep" name="/etc/passwd" comm="zgrep" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
```

if called in a sanitized environment. As the functionality of zgrep is
not impacted by a limited Bash environment, add deny rules to avoid the
potentially misleading AVC messages.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-10-06 23:18:52 +02:00
Christian Boltz
8c80c56252
Check if all profiles and abstractions contain abi/4.0
... and add abi/4.0 where it was missing
2024-10-06 12:07:58 +02:00
Christian Boltz
68d42c3e37
zgrep: allow reading /etc/nsswitch.conf and /etc/passwd
Seen on various VMs, my guess is that bash wants to translate a uid to a
username.

Log events (slightly shortened)

apparmor="DENIED" operation="open" class="file" profile="zgrep" name="/etc/nsswitch.conf" comm="zgrep" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

apparmor="DENIED" operation="open" class="file" profile="zgrep" name="/etc/passwd" comm="zgrep" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
2024-10-06 11:05:52 +02:00
Georgia Garcia
645320ae84 profiles: transmission-daemon needs attach_disconnected
Systemd's PrivateTmp= in transmission service is causing mount namespaces to be used leading to disconnected paths

[395201.414562] audit: type=1400 audit(1727277774.392:573): apparmor="ALLOWED" operation="sendmsg" class="file" info="Failed name lookup - disconnected path" error=-13 profile="transmission-daemon" name="run/systemd/notify" pid=193060 comm="transmission-da" requested_mask="w" denied_mask="w" fsuid=114 ouid=0

Fixes: https://bugs.launchpad.net/bugs/2083548
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-10-04 10:54:48 -03:00
Christian Boltz
4b6df10fe3 Merge ping: allow reading /proc/sys/net/ipv6/conf/all/disable_ipv6
Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082190

I propose this patch for 3.0..master.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1340
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2024-09-30 21:42:56 +00:00
Christian Boltz
df4d7cb8da
ping: allow reading /proc/sys/net/ipv6/conf/all/disable_ipv6
Fixes: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1082190
2024-09-27 12:05:29 +02:00
Christian Boltz
49b9a20997
abstractions/mesa: allow ~/.cache/mesa_shader_cache_db/
... which is used by Mesa 24.2.2

Reported by darix.

Fixes: https://bugs.launchpad.net/bugs/2081692
2024-09-24 16:39:52 +02:00
John Johansen
74f254212a Merge profiles: enable php-fpm in /usr/bin and /usr/sbin
To enable the profile in distros that merge sbin into bin.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/421
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>

Closes #421
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1301
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-08-29 18:46:47 +00:00
John Johansen
cf3428f774 Merge profiles: slirp4netns: allow pivot_root
`pivot_root` is required for running `slirp4netns --enable-sandbox` inside LXD.
- https://github.com/rootless-containers/slirp4netns/issues/348
- https://github.com/rootless-containers/slirp4netns/blob/v1.3.1/sandbox.c#L101-L234

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1298
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-08-29 18:44:15 +00:00
Georgia Garcia
2083994513 profiles: enable php-fpm in /usr/bin and /usr/sbin
To enable the profile in distros that merge sbin into bin.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/421
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-08-14 10:52:53 -03:00
Akihiro Suda
2333fbcf74
profiles: runc: allow /usr/bin/runc as well as /usr/sbin/runc
Docker, Inc's `containerd.io` package installs runc onto `/usr/bin/runc`
rather than `/usr/sbin/runc`.

```
$ wget https://download.docker.com/linux/ubuntu/dists/noble/pool/stable/amd64/containerd.io_1.7.20-1_amd64.deb
$ dpkg -c containerd.io_1.7.20-1_amd64.deb | grep /runc
-rwxr-xr-x root/root   9806280 2024-08-08 23:20 ./usr/bin/runc
```

Similar to 9ab45d "profiles: support distributions which merge sbin into bin".

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-08-14 18:32:35 +09:00
Akihiro Suda
bf5db67284
profiles: slirp4netns: allow pivot_root
`pivot_root` is required for running `slirp4netns --enable-sandbox` inside LXD.
- https://github.com/rootless-containers/slirp4netns/issues/348
- https://github.com/rootless-containers/slirp4netns/blob/v1.3.1/sandbox.c#L101-L234

Signed-off-by: Akihiro Suda <akihiro.suda.cz@hco.ntt.co.jp>
2024-08-14 17:29:13 +09:00
Georg Pfuetzenreuter
2a9fe26459
abstractions/base: allow reading of fips_enabled
Commonly used by applications to determine if Linux is running in
FIPS mode. As we already allow access to FIPS specific library files
as part of base, allow this there as well.

Signed-off-by: Georg Pfuetzenreuter <mail@georg-pfuetzenreuter.net>
2024-08-04 20:25:05 +02:00
John Johansen
899c0b3942 Merge samba-dcerpcd: allow to execute rpcd_witness
... and extend the samba-rpcd profile to also include rpcd_witness.

Patch by Noel Power <nopower@suse.com>

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1225811

I propose this patch for 3.x, 4.0 and master.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1256
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-07-17 08:30:00 +00:00
Christian Boltz
da9a3bd37b
abstractions/wutmp: allow writing wtmpdb
/var/lib/wtmpdb/ contains the Y2038-safe version of wtmpdb.

Proposed by darix.
2024-07-03 22:26:25 +02:00
John Johansen
121dbec671 Merge abstractions/X: add another xauth path
This time it's   /tmp/xauth_?????? r,   which gets used by latest sddm.

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1223900

I propose this fix for 4.0 and master, optionally also for 3.x.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1249
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-06-11 06:27:28 +00:00
Christian Boltz
94ccd111de
samba-dcerpcd: allow to execute rpcd_witness
... and extend the samba-rpcd profile to also include rpcd_witness.

Patch by Noel Power <nopower@suse.com>

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1225811
2024-06-08 22:46:53 +02:00
Georgia Garcia
49aa7ae328 profiles: installation of php-fpm needs w @{run}/systemd/notify
Installation of php-fpm fails on Ubuntu because the profile does not
allow writing to /run/systemd/notify.

Fixes: https://bugs.launchpad.net/bugs/2061113

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2024-06-05 09:43:05 -03:00
Christian Boltz
0c6e031c02
abstractions/X: add another xauth path
This time it's   /tmp/xauth_?????? r,   which gets used by latest sddm.

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1223900
2024-06-04 21:46:39 +02:00
Christian Boltz
64469afa2c
Add openSUSE path to plasmashell profile
While on it,
- add some comments explaining what the profile does
- adjust the rule with the Debian/Ubuntu path to work with Qt6

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1225961
2024-06-04 21:24:53 +02:00
Simon Deziel
7770cd718d
abstractions/nameservice: allow reading @{PROC}/@{pid}/net/ipv6_route
This file contains the same kind of information as @{PROC}/@{pid}/net/route
and both files are world readable:

```
$ ls -l /proc/self/net/*route
-r--r--r-- 1 root root 0 Jun  3 15:33 /proc/self/net/ipv6_route
-r--r--r-- 1 root root 0 Jun  3 15:33 /proc/self/net/route
```

Signed-off-by: Simon Deziel <simon.deziel@canonical.com>
2024-06-03 15:34:37 -04:00
John Johansen
b460539eeb Merge profiles/Makefile: Clean up rules to better support extra profiles
In the course of preparing !1207, I found that the validation rules in `profiles/Makefile` did not take kindly to the new `profiles/apparmor/profiles/extras/abstractions/` directory. I tried a couple rounds of quick fixes, but it became clear that the rules as currently written were just not amenable to the new addition, and needed more attention than I could give it by-the-by.

So I separated out that commit, and revised the makefile more thoroughly. The updated rules now rely more on `find(1)` than `$(wildcard)`, and have a number of [what I believe to be] small quality-of-life improvements. Taken together, `make check` passes cleanly with the new files from my other MR present.

One thing I noticed was that the profiles under `apparmor.d/` were not previously being checked for the `include if exists <local/*>` bit---only the ones under `extras/`. I've thus included a fix to the `sbuild-shell` profile, which fortunately was the only one that failed the check.

Note that at present, you'll get a couple of harmless `find: ‘./apparmor/profiles/extras/abstractions’: No such file or directory` errors when running the checks, since that directory won't appear until the other MR is merged. I figure, better to bear that for now, and not have to touch the makefile again later.

NOTE: The CI pipeline here will need to be updated to invoke the `check-local` target instead of `check-extras`. This target was renamed as it is no longer limited in scope to the profiles under `extras/`.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1214
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2024-05-30 19:12:31 +00:00