Commit graph

1316 commits

Author SHA1 Message Date
John Johansen
271f0e2366 Merge firefox: updates from usage monitoring
I have a number of updates for the Firefox profile, based on monitoring AppArmor logs in the course of my own usage.

I'm going to try annotating the diff with the appropriate log messages, to see if that is a useful way of documenting the changes.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1055
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-07-01 01:06:17 +00:00
Daniel Richard G
dc5d999c5b firefox: updates from usage monitoring 2023-06-30 18:38:31 -04:00
Daniel Richard G
07919c2c70 abstractions/fonts: allow writing to fontconfig user cache files 2023-06-30 18:26:28 -04:00
Daniel Richard G
3b51143d87 abstractions/fonts: allow locking fontconfig user cache files 2023-06-29 21:26:59 -04:00
Vincas Dargis
155be0ffc4 abstactions/kde: allow reading global Debian KDE settings
New denials detected on Debian Sid:

```
type=AVC msg=audit(1687372581.246:738): apparmor="DENIED" operation="open" class="file" profile="qtox" name="/usr/share/desktop-base/kf5-settings/kdeglobals" pid=17988 comm="qtox" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0FSUID="vincas" OUID="root"
```

Debian package `desktop-base` contains some global KDE settings files:

```
$ dpkg -L desktop-base | fgrep kf5
/usr/share/desktop-base/kf5-settings
/usr/share/desktop-base/kf5-settings/baloofilerc
/usr/share/desktop-base/kf5-settings/kdeglobals
/usr/share/desktop-base/kf5-settings/kscreenlockerrc
```

Add file rules to allow reading global KDE settings.
2023-06-26 20:09:55 +03:00
Daniel Richard G
15112b3a49 usr.sbin.sshd: Add permissions masked by internal-sftp section
Also replace /(var/)run with @{run} and /sys with @{sys}, and fix a
typo (etc.legal)
2023-06-10 16:49:24 -04:00
John Johansen
ad3750058d Merge abstractions/base: Add transparent hugepage support
Found in testing a slimmed-down `usr.sbin.sshd` profile:
```
Jun  8 21:09:38 testvm kernel: [   54.847014] audit: type=1400 audit(1686272978.009:68): apparmor="DENIED" operation="open" profile="/usr/sbin/sshd" name="/sys/kernel/mm/transparent_hugepage/hpage_pmd_size" pid=1035 comm="sshd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
```
Not sure what glibc/system call uses this, but it seems pretty broadly applicable, and read access is presumably harmless. [THP reference](https://www.kernel.org/doc/html/latest/admin-guide/mm/transhuge.html)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1050
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-06-09 08:46:31 +00:00
Daniel Richard G
3844e45220 abstractions/base: Add transparent hugepage support 2023-06-09 01:14:13 -04:00
Daniel Richard G
4b9ba3977b abstractions/authentication: Add GSSAPI mechanism modules config 2023-06-09 00:47:32 -04:00
John Johansen
6e0d776f65 Merge profiles: allow reading of /etc/ld-musl-*.path
/etc/ld-musl-*.path is required to perform dynamic linking on musl libc.
The wildcard is to match all CPU architectures, like x86_64.

type=AVC msg=audit(1686087677.497:67): apparmor="DENIED" operation="open" class="file" profile="syslog-ng" name="/etc/ld-musl-x86_64.path" pid=25866 comm="syslog-ng" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

Closes #333

Signed-off-by: Nikita Romaniuk <kelvium@yahoo.com>

Closes #333
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1047
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-06-09 01:59:53 +00:00
John Johansen
8ef7e91a38 Merge Improvements from the Ubuntu 20.04 Firefox profile
This brings in numerous improvements from the Firefox AppArmor profile that Ubuntu ships in 20.04/focal. The raw profile may be viewed [here](https://bazaar.launchpad.net/~mozillateam/firefox/firefox-trunk.head/view/head:/debian/usr.bin.firefox.apparmor.14.10) (or alternately [here](https://bazaar.launchpad.net/~mozillateam/firefox/firefox.focal/view/head:/debian/usr.bin.firefox.apparmor.14.10)).

To review, you may not only want to compare this new version against HEAD, but also against the Ubuntu profile, which has a smaller diff. I suggest preprocessing the latter with the following to reduce extraneous diffs:
```
sed 's,@{PROC}/\[0-9\]\*/,@{PROC}/@{pid}/,g; s,/@{pid}/task/\[0-9\]\*/,/@{pid}/task/@{tid}/,g; s/#\(include\)/\1/'
```

I've made a few minor edits along the way, such as using AppArmor variables instead of preprocessing directives (like `@MOZ_LIBDIR@`) that are substituted in the Firefox package build. Any feature/stylistic downgrades in the Ubuntu profile should have been filtered out.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1043
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-06-09 01:57:25 +00:00
Nikita Romaniuk
d8e25ce915
profiles: allow reading of /etc/ld-musl-*.path
/etc/ld-musl-*.path is required to perform dynamic linking on musl libc.
The wildcard is to match all CPU architectures, like x86_64.

type=AVC msg=audit(1686087677.497:67): apparmor="DENIED" operation="open" class="file" profile="syslog-ng" name="/etc/ld-musl-x86_64.path" pid=25866 comm="syslog-ng" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

Closes #333

Signed-off-by: Nikita Romaniuk <kelvium@yahoo.com>
2023-06-07 01:09:33 +03:00
Georgia Garcia
daec4bc82a profiles: add lock file permission to snap browsers
When opening snap browsers with evince using the snap_browsers
abstraction, we get the following AppArmor denials which prevent the
browsers from opening

audit: type=1400 audit(1685996894.479:225): apparmor="DENIED" operation="open" class="file" profile="/usr/bin/evince//snap_browsers" name="/var/lib/snapd/inhibit/firefox.lock" pid=13282 comm="snap" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

audit: type=1400 audit(1685997517.142:259): apparmor="DENIED" operation="file_lock" class="file" profile="/usr/bin/evince//snap_browsers" name="/var/lib/snapd/inhibit/firefox.lock" pid=14200 comm="snap" requested_mask="k" denied_mask="k" fsuid=1000 ouid=0

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2023-06-05 17:39:28 -03:00
Daniel Richard G
d367adf1f1 Improvements from the Ubuntu 20.04 Firefox profile
The Ubuntu profile is available at (trunk and branch locations)
  https://bazaar.launchpad.net/~mozillateam/firefox/firefox-trunk.head/view/head:/debian/usr.bin.firefox.apparmor.14.10
  https://bazaar.launchpad.net/~mozillateam/firefox/firefox.focal/view/head:/debian/usr.bin.firefox.apparmor.14.10
2023-05-30 15:22:25 -04:00
John Johansen
f629340d1b Merge chromium_browser: Inherit updates from apparmor-profiles repo
Bring in updates and improvements that have been made to the Chromium profile at `apparmor-profiles/ubuntu/20.04/usr.bin.chromium-browser`.

The changes are largely as follows:

* Use `@{pid}` or `@{tid}` instead of `[0-9]*`

* Use the discrete `lsb_release` profile instead of a subprofile

* Add a few additional libraries to the `sandbox` subprofile

Once this is in, the Chromium profiles in `apparmor-profiles` can be considered deprecated, and I would advise slating them for removal altogether.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1032
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: John Johansen <john@jjmx.net>
2023-05-18 16:57:59 +00:00
Daniel Richard G
bd0d401b3d nscd: add permission to allow supporting unscd
May 9 18:07:42 darkstar kernel: [ 2706.138823] audit: type=1400
audit(1683670062.580:839): apparmor="DENIED" operation="sendmsg"
profile="nscd" name="/run/systemd/notify" pid=4343 comm="nscd"
requested_mask="w" denied_mask="w" fsuid=125 ouid=0
2023-05-10 00:31:06 -04:00
Daniel Richard G
4507bdc020 chromium_browser: Inherit updates from apparmor-profiles repo
Bring in updates and improvements that have been made to the Chromium
profile at apparmor-profiles/ubuntu/20.04/usr.bin.chromium-browser
2023-05-10 00:19:55 -04:00
John Johansen
09b35f836b Merge Abstractions: better integration
This is the first MR of a possibly very long list of MR in order to upstream stable abstraction & profiles previously tested in https://github.com/roddhjav/apparmor.d

This first MR focuses on integrating abstraction completion from the `*.d` directory in [apparmor.d/abstractions](https://github.com/roddhjav/apparmor.d/tree/main/apparmor.d/abstractions)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/995
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-05-02 12:34:04 +00:00
John Johansen
fa86a7f1d9 Merge abstractions/freedesktop.org: allow custom cursors
... by allowing to read all files below ~/.icons instead of only the
directory listing.

I propose this patch for all branches.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1008
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-04-25 02:24:50 +00:00
Daniel Richard G
408e148109 Add profile for rpcbind 2023-04-18 16:35:34 -04:00
Christian Boltz
954b11fc50
abstractions/freedesktop.org: allow custom cursors
... by allowing to read all files below ~/.icons instead of only the
directory listing.
2023-04-16 16:00:27 +02:00
Alex Murray
c691b11d6e
abstractions/base: allow reading tzdata ICU zoneinfo DB
This is used by various applications including libreoffice etc so it may as well
be added to the base abstraction along with the existing zoneinfo DB access.

AVC apparmor="DENIED" operation="open" class="file" profile="snap.libreoffice.calc" name="/usr/share/zoneinfo-icu/44/le/zoneinfo64.res" pid=44742 comm="soffice.bin" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2023-04-06 11:50:06 +09:30
John Johansen
7fa20770db Merge tunables/etc: Improve comments which variable to use
The description of @{etc_ro} and @{etc_rw} were not good enough in
explaining which directories they should contain, and when to use which
of the variables in a profile.

I propose this patch for all branches.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1000
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-04-01 03:17:28 +00:00
Christian Boltz
2d213ecdc9
syslogd: allow reading /dev/kmsg
Fixes: https://gitlab.com/apparmor/apparmor/-/issues/307
2023-03-29 22:17:49 +02:00
Christian Boltz
e8e6476487
tunables/etc: Improve comments which variable to use
The description of @{etc_ro} and @{etc_rw} were not good enough in
explaining which directories they should contain, and when to use which
of the variables in a profile.
2023-03-29 14:21:17 +02:00
Alexandre Pujol
197f94244f
abstractions: vulkan, remove redundant directory listing. 2023-03-28 21:54:55 +01:00
Alexandre Pujol
bae7ed797e
abstractions: add nvidia profiles path & nvidia-xdriver.
From: https://github.com/roddhjav/apparmor.d
2023-03-25 13:07:30 +00:00
Alexandre Pujol
b67a265de0
abstractions: gtk needs more path access.
From: https://github.com/roddhjav/apparmor.d
2023-03-25 13:06:41 +00:00
Alexandre Pujol
1f0721b0ba
abstractions: add support for locally installed python lib.
From: https://github.com/roddhjav/apparmor.d
2023-03-25 13:06:12 +00:00
Alexandre Pujol
745b176926
abstractions: dbus session improvement.
- Add full access to unix stream over /tmp/dbus-*
- Add at-spi dbus support

From: https://github.com/roddhjav/apparmor.d
2023-03-25 13:04:44 +00:00
Alexandre Pujol
a8d392a204
abstractions: minor directory access fixes.
From: https://github.com/roddhjav/apparmor.d
2023-03-25 13:02:48 +00:00
Noel Power
e5654f1f81 prevent rename_src requesting 'r' access DENIES messages
nmbd, windbind & smbd all trigger

apparmor="DENIED" operation="rename_src" profile="/usr/sbin/nmbd" name="/var/log/samba/log.nmbd

type messages.

Signed-off-by: Noel Power <noel.power@suse.com>
2023-03-03 11:53:55 +00:00
Noel Power
0593a035f5 add kerberosclient to included abstractions for winbindd
prevent messages like

apparmor="DENIED" operation="file_mmap" profile="/usr/sbin/winbindd" name="/usr/lib64/krb5/plugins/authdata/sssd_pac_plugin.so" pid=2798 comm="winbindd" requested_mask="m" denied_mask="m" fsuid=52311 ouid=0

Signed-off-by: Noel Power <noel.power@suse.com>
2023-03-03 11:47:38 +00:00
Noel Power
6e94794c68 Update kerberosclient abstraction for access to authdata directory
For example winbindd when configured on a samba system using
sssd can trigger

apparmor="DENIED" operation="file_mmap" profile="/usr/sbin/winbindd" name="/usr/lib64/krb5/plugins/authdata /sssd_pac_plugin.so" pid=2798 comm="winbindd" requested_mask="m" denied_mask="m" fsuid=52311 ouid=0

Signed-off-by: Noel Power <noel.power@suse.com>
2023-03-03 11:43:45 +00:00
Noel Power
b4f5414882 adjust winbindd profile to cater for sssd kdcinfo access
winbindd (with nsswitch sssd configuration) is now getting

type=AVC msg=audit(1677832823.657:119): apparmor="DENIED" operation="open" profile="/usr/sbin/winbindd" name="/var/lib/sss/pubconf/kdcinfo.TESTDOMAIN1.MY.COM" pid=3026 comm="winbindd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

Signed-off-by: Noel Power <noel.power@suse.com>
2023-03-03 11:40:17 +00:00
nl6720
6f0d2ef7fe
profiles/apparmor.d/samba*: allow access to pid files directly in /run/
On Arch Linux, `samba-dcerpcd.pid` is in `/run/`, not `/run/samba/`.

   apparmor="DENIED" operation="mknod" profile="samba-dcerpcd" name="/run/samba-dcerpcd.pid" pid=80920 comm="samba-dcerpcd" requested_mask="c" denied_mask="c" fsuid=0 ouid=0

The same is true for `nmbd.pid`, `smbd.pid` and probably others too.
2023-02-27 15:07:35 +02:00
nl6720
763c4ecd23
profiles/apparmor.d/abstractions/samba: allow modifying /var/cache/samba/*.tdb
samba-dcerpcd requires access to `/var/cache/samba/names.tdb`.

    audit: type=1400 audit(1676835286.187:62): apparmor="DENIED" operation="open" profile="samba-dcerpcd" name="/var/cache/samba/names.tdb" pid=6948 comm="samba-dcerpcd" requested_mask="wrc" denied_mask="wrc" fsuid=0 ouid=0

See also https://bbs.archlinux.org/viewtopic.php?id=281411

Since `usr.sbin.winbindd` already has a rule for it, and `usr.sbin.nmbd`
has similar ones, simply add `/var/cache/samba/*.tdb rwk` to
`abstractions/samba`.
2023-02-27 13:26:23 +02:00
John Johansen
f223ed063e Merge abstractions/openssl: allow reading /etc/ssl/openssl-*.cnf
openSUSE Tumbleweed uses /etc/ssl/openssl-1_1.cnf to make the migration
to openssl 3 possible.

References: https://bugzilla.opensuse.org/show_bug.cgi?id=1207911

I propose this patch for at least 3.1 and master, ideally for all branches (as long as it can easily be merged)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/984
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-02-26 01:02:24 +00:00
Christian Boltz
d713f75086 Merge abstractioms/nvidia: add new cache directory
Some applications (like Firefox or Steam, but for some reason not
glxgears) now writes to ~/.cache/nvidia/*:

```
type=AVC msg=audit(1676115846.764:605): apparmor="DENIED" operation="open" profile="firefox" name="/home/vincas/.cache/nvidia/GLCache/2c0cfcdab4d7b05f8130d8f
ba8838943/ec9a05ca3988cfd1/1fee83e04c0ea4d8.toc" pid=26827 comm="firefox" requested_mask="rac" denied_mask="rac" fsuid=1000 ouid=1000^]FSUID="vincas" OUID="v
incas"
```

```
type=AVC msg=audit(1676134465.264:2166): apparmor="DENIED" operation="open" profile="steam" name="/home/vincas/.cache/nvidia/GLCache/95f6d95b1adf9af310bc94af5f19e509/6b24ef0587ddc7e4/23b502f99abb563c.toc" pid=56082 comm="steam" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000^]FSUID="vincas" OUID="vincas"
```

Update nvidia abstraction to allow create caches in .cache subdirectory.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/982
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2023-02-16 17:40:44 +00:00
Vincas Dargis
15b92cd2ee abstractioms/nvidia: add new cache directory
Some applications (like Firefox or Steam, but for some reason not
glxgears) now writes to ~/.cache/nvidia/*:

```
type=AVC msg=audit(1676115846.764:605): apparmor="DENIED" operation="open" profile="firefox" name="/home/vincas/.cache/nvidia/GLCache/2c0cfcdab4d7b05f8130d8f
ba8838943/ec9a05ca3988cfd1/1fee83e04c0ea4d8.toc" pid=26827 comm="firefox" requested_mask="rac" denied_mask="rac" fsuid=1000 ouid=1000^]FSUID="vincas" OUID="v
incas"
```

```
type=AVC msg=audit(1676134465.264:2166): apparmor="DENIED" operation="open" profile="steam" name="/home/vincas/.cache/nvidia/GLCache/95f6d95b1adf9af310bc94af5f19e509/6b24ef0587ddc7e4/23b502f99abb563c.toc" pid=56082 comm="steam" requested_mask="wr" denied_mask="wr" fsuid=1000 ouid=1000^]FSUID="vincas" OUID="vincas"
```

Update nvidia abstraction to allow create caches in .cache subdirectory.
2023-02-16 19:31:31 +02:00
Christian Boltz
4188d2b7a5
abstractions/openssl: allow reading /etc/ssl/openssl-*.cnf
openSUSE Tumbleweed uses /etc/ssl/openssl-1_1.cnf to make the migration
to openssl 3 possible.

References: https://bugzilla.opensuse.org/show_bug.cgi?id=1207911
2023-02-14 19:05:40 +01:00
Vincas Dargis
8e50c351e1 nvidia_modprobe: update for driver families and /sys path
Debian have split NVIDIA drivers into current, tesla and legacy:

```
$ apt-file search /etc/nvidia/ | grep -P -o -e
"(?<=/etc/nvidia/).[^/]*/" | sort -u
current/
current-open/
legacy-340xx/
legacy-390xx/
tesla/
tesla-418/
tesla-450/
tesla-460/
tesla-470/
tesla-510/
```

These paths are used by nvidia_modprobe -> kmod:

```
type=AVC msg=audit(1676135718.796:2592): apparmor="DENIED" operation="open" profile="nvidia_modprobe//kmod" name="/etc/nvidia/tesla-470/nvidia-blacklists-nouveau.conf" pid=62094 comm="modprobe" requested_mask="r" denied_mask="r" fsuid=0 ouid=0FSUID="root" OUID="root"
type=AVC msg=audit(1676135718.796:2593): apparmor="DENIED" operation="open" profile="nvidia_modprobe//kmod" name="/etc/nvidia/tesla-470/nvidia-options.conf" pid=62094 comm="modprobe" requested_mask="r" denied_mask="r" fsuid=0 ouid=0FSUID="root" OUID="root"
type=AVC msg=audit(1676135718.796:2594): apparmor="DENIED" operation="open" profile="nvidia_modprobe//kmod" name="/etc/nvidia/tesla-470/nvidia-modprobe.conf" pid=62094 comm="modprobe" requested_mask="r" denied_mask="r" fsuid=0 ouid=0FSUID="root" OUID="root"
```

Also, additional /sys path is accessed:

```
type=AVC msg=audit(1676136251.680:2956): apparmor="DENIED" operation="open" profile="nvidia_modprobe//kmod" name="/sys/module/drm/initstate" pid=63642 comm="modprobe" requested_mask="r" denied_mask="r" fsuid=0 ouid=0FSUID="root" OUID="root"
```

Update nvidia_modprobe profile to this these denials.
2023-02-11 19:42:58 +02:00
Christian Boltz
30679f7cc4
postfix-tlsmgr: allow reading openssl.cnf
Seen/needed on openSUSE Tumbleweed
2023-02-07 12:48:33 +01:00
Christian Boltz
8a34439593
Check if extra profiles have a local/ include
... now that they all got it added.

Also remove a superfluous backslash in another make target.
2023-02-02 13:33:58 +01:00
John Johansen
0ec11e385c Merge rename firefox and chromium_browser profile files
... to just the basename and profile name.

This also means to make the firefox and firefox.sh profiles named profiles.

Note: in the `firefox.sh` profile, the local include was added just today, therefore I think changing it (instead of adding) should be fine.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/975
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-02-02 04:10:32 +00:00
John Johansen
238eb8150b Merge Add abstractions/groff with lots of groff/nroff helpers
contributed by Werner Fink via
https://bugzilla.opensuse.org/show_bug.cgi?id=1065388 comment 25

Note that - compared to the file in bugzilla - I removed the `rix` rules
for /usr/bin/groff and /usr/bin/nroff so that people can choose to ix,
Px or Cx groff/nroff as they wish, and then include the abstraction
inside the target profile to allow executing all the helpers.

I also added `include if exists <abstractions/groff.d>`

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/973
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-02-02 04:08:47 +00:00
John Johansen
2c72dd5541 Merge avahi-daemon needs attach_disconnected
... for var/lib/nscd/passwd and var/lib/nscd/group

I propose this patch for all branches.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/960
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2023-02-02 04:00:12 +00:00
Christian Boltz
cb83ab5163
nscd: allow using systemd-userdb
If systemd-userdb is used to configure some users, nscd needs to read
the userdb files.

See also https://www.freedesktop.org/software/systemd/man/nss-systemd.html
for the list of possible filenames (and symlinks).

Fixes: http://bugzilla.opensuse.org/show_bug.cgi?id=1207698
2023-01-30 12:26:31 +01:00
Christian Boltz
d1fd198473
rename firefox and chromium_browser profile files
... to just the basename and profile name.

This also means to make the firefox and firefox.sh profiles named profiles.
2023-01-30 12:06:13 +01:00
Daniel Richard G
d0e32a326f Ensure all profiles in extras/ have optional local include + comment 2023-01-30 00:54:30 -05:00