Commit graph

744 commits

Author SHA1 Message Date
intrigeri
1b9469eb31 dnsmasq: allow reading DNSSEC trust anchors
At least on Debian, when DNSSEC validation is enabled, dnsmasq needs to read
/usr/share/dnsmasq-base/trust-anchors.conf

Bug-Debian: https://bugs.debian.org/934869
2020-05-25 10:42:26 +00:00
Vincas Dargis
21bbfc0652 vulkan: fix device and driver enumeration
vkcube test application produces these DENIED messages on current Debian
Sid:
```
type=AVC msg=audit(1589815066.509:868): apparmor="DENIED"
operation="open" profile="/usr/bin/vkcube"
name="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/gt_min_freq_mhz"
pid=32553 comm="vkcube" requested_mask="r" denied_mask="r" fsuid=1000
ouid=0
```

```
type=AVC msg=audit(1590082079.377:1155): apparmor="DENIED"
operation="open" profile="/usr/bin/vkcube"
name="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/gt_max_freq_mhz"
pid=51348 comm="vkcube" requested_mask="r" denied_mask="r" fsuid=1000
ouid=0
```

```
type=AVC msg=audit(1590082107.057:1249): apparmor="DENIED"
operation="open" profile="/usr/bin/vkcube"
name="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/metrics/" pid=51459
comm="vkcube" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
```

```
type=AVC msg=audit(1590082519.937:1408): apparmor="DENIED"
operation="open" profile="/usr/bin/vkcube"
name="/sys/devices/pci0000:00/0000:00:02.0/drm/card0/metrics/403d8832-1a27-4aa6-a64e-f5389ce7b212/id"
pid=51960 comm="vkcube" requested_mask="r" denied_mask="r" fsuid=1000
ouid=0
```

```
type=AVC msg=audit(1590082842.193:1829): apparmor="DENIED"
operation="open" profile="/usr/bin/vkcube"
name="/etc/glvnd/egl_vendor.d/" pid=53000 comm="vkcube"
requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
```

```
type=AVC msg=audit(1590082842.193:1830): apparmor="DENIED"
operation="open" profile="/usr/bin/vkcube"
name="/usr/share/glvnd/egl_vendor.d/" pid=53000 comm="vkcube"
requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

```

Add appropriate rules to fix these enumerations.
2020-05-21 21:00:13 +03:00
Christian Boltz
110d6d214c
switch local includes to "include if exists" 2020-05-03 22:01:13 +02:00
John Johansen
dca5b452a5 LSM stacking: add missing permissions for using new kernel interfaces
LSM stacking adds the new /proc/<pid>/attr/apparmor directory
dedicated to apparmor so that it won't collide with other LSMs.

The library has already been switched to using this interface by
default, but the parser need to add permissions to access this
location when hats and/or change_profile rules are defined.

Also make sure to update the apache abstraction to support the new
interface as well.

Signed-off-by: John Johansen <john.johansen@canonical.com
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2020-05-03 01:00:18 -07:00
Jamie Strandboge
5583569a29 allow accessing the libnss-systemd VarLink sockets and DBus APIs
https://systemd.io/USER_GROUP_API/ describes the libnss-systemd VarLink
socket APIs:

"
When a client wants to look up a user or group record, it contacts all
sockets bound in this directory in parallel, and enqueues the same query
to each. The first positive reply is then returned to the application,
or if all fail the last seen error is returned instead. (Alternatively
a special Varlink service is available, io.systemd.Multiplexer which
acts as frontend and will do the parallel queries on behalf of the
client, drastically simplifying client development.)
"

This updates the nameservice abstraction to allow read/write on
well-known systemd VarLink named sockets.

In addition, allow lookups for systemd-exec's DynamicUsers via D-Bus

References:
- https://systemd.io/USER_GROUP_API/
- https://systemd.io/USER_RECORD/
- https://www.freedesktop.org/software/systemd/man/nss-systemd.html
- https://www.freedesktop.org/software/systemd/man/systemd.exec.html
- https://launchpad.net/bugs/1796911
- https://launchpad.net/bugs/1869024

Modified by John Johansen by:
- moving rules nss-systemd include
- replacing /proc/ with @{proc}/
- moving and merging commit 16f9f688 rules into nss-systemd include

PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/480
PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/474
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
2020-04-16 10:21:04 -07:00
nl6720
88c142c687
usr.sbin.dnsmasq: allow reading @{PROC}/@{pid}/fd/ as is needed by dnsmasq 2.81
See http://thekelleys.org.uk/gitweb/?p=dnsmasq.git;a=commitdiff;h=48755ebf093543113de96747a7f5f78e0640b333 .

Signed-off-by: nl6720 <nl6720@gmail.com>
2020-04-12 12:15:05 +03:00
Rich McAllister
eeac8c11c9 abstractions: add /etc/mdns.allow to /etc/apparmor.d/abstractions/mdns
In focal users of mdns get denials in apparmor confined applications.
An exampel can be found in the original bug below.

It seems it is a common pattern, see
https://github.com/lathiat/nss-mdns#etcmdnsallow

Therefore I'm asking to add
   /etc/mdns.allow r,
to the file
   /etc/apparmor.d/abstractions/mdns"
by default.

--- original bug ---

Many repetitions of

audit: type=1400 audit(1585517168.705:63): apparmor="DENIED" operation="open" profile="/usr/sbin/chronyd" name="/etc/mdns.allow" pid=1983815 comm="chronyd" requested_mask="r" denied_mask="r" fsuid=123 ouid=0

in log. I use libnss-mdns for .local name resolution, so /etc/nsswitch.conf contains

hosts: files mdns [NOTFOUND=return] myhostname dns

and /etc/mnds.allow contains the domains to resolve with mDNS (in may case, "local." and "local"; see /usr/share/doc/libnss-mdns/README.html.)

Presumably cronyd calls a gethostbyX() somewhere, thus eventually trickling down through the name service switch and opening /etc/mdns.allow, which the AppArmor profile in the chrony package does not allow.

Fixes: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1869629
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-03-31 21:03:52 -07:00
John Johansen
b2d0d87eba Merge exo-open: allow reading ~/.local/share/xfce4/helpers/*.desktop
Fixes: https://gitlab.com/apparmor/apparmor/-/issues/73
PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/467
Acked-by: John Johansen <john.johansen@canonical.com>
2020-03-31 23:05:51 +00:00
Christian Boltz
2a67d5e1ee
exo-open: allow reading ~/.local/share/xfce4/helpers/*.desktop
Fixes https://gitlab.com/apparmor/apparmor/-/issues/73
2020-04-01 00:46:55 +02:00
intrigeri
61571da1a8 abstractions/mesa: allow checking if the kernel supports the i915 perf interface
On current Debian sid, applications that use mesa need this access.
2020-03-31 09:15:14 +00:00
John Johansen
d4296d217c Merge: abstractions/nameservice: allow accessing /run/systemd/userdb/
On systems with systemd 245, `nss-systemd` additionally queries NSS records from `systemd-userdbd.service`. See https://systemd.io/USER_GROUP_API/ .

This does not bring full support for `systemd-homed`, but I don't use that service so I can't help with that.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/82
PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/459
Acked-by: John Johansen <john.johansen@canonical.com>
2020-03-29 08:51:55 +00:00
nl6720
16f9f6885a
abstractions/nameservice: allow accessing /run/systemd/userdb/
On systems with systemd 245, nss-systemd additionally queries NSS records from systemd-userdbd.service. See https://systemd.io/USER_GROUP_API/ .

Signed-off-by: nl6720 <nl6720@gmail.com>
2020-03-29 11:08:38 +03:00
Vladimir “Equidamoid” Shapranov @equidamoid
e731b8a335 policy: invalid path to libvirt_leaseshelper in usr.sbin.dnsmasq
Another instance of using libvirt_leaseshelper without having
libexec access. As addressed in the previous patch.

issue: https://gitlab.com/apparmor/apparmor/-/issues/87
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-03-28 14:00:58 -07:00
Vladimir “Equidamoid” Shapranov @equidamoid
28fce5f76d Invalid path to libvirt_leaseshelper in usr.sbin.dnsmasq
The error:

type=AVC msg=audit(1585403559.846:34317577): apparmor="DENIED" operation="exec" profile="/usr/sbin/dnsmasq" name="/usr/libexec/libvirt_leaseshelper" pid=7162 comm="sh" requested_mas
k="x" denied_mask="x" fsuid=0 ouid=0
type=AVC msg=audit(1585403559.846:34317578): apparmor="DENIED" operation="open" profile="/usr/sbin/dnsmasq" name="/usr/libexec/libvirt_leaseshelper" pid=7162 comm="sh" requested_mas
k="r" denied_mask="r" fsuid=0 ouid=0

Looks like the path to libvirt_leasehelper is incorrect usr.sbin.dnsmasq, at least in gentoo. Patching the file fixes the problem:

issue: https://gitlab.com/apparmor/apparmor/-/issues/87
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-03-28 12:42:13 -07:00
Samuel Cabrero
2c3001c7a1 Update usr.sbin.winbindd profile to allow krb5 rcache files locking
Samba 4.12.0 together with krb5 1.18 needs file locking permissions in
the krb5 rache directory:

type=AVC msg=audit(1584708328.422:76): apparmor="DENIED" operation="file_lock"
  profile="winbindd" name="/var/cache/krb5rcache/krb5_20500.rcache2"
  pid=1461 comm="winbindd" requested_mask="k" denied_mask="k"
  fsuid=20500 ouid=20500

Signed-off-by: Samuel Cabrero <scabrero@suse.de>
2020-03-20 13:57:18 +01:00
John Johansen
9bccf457d1 Merge usr.sbin.dnsmasq: add configuration files created by openresolv
See https://roy.marples.name/projects/openresolv/configuration.html#dnsmasq .

PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/457
Acked-by: John Johansen <john.johansen@canonical.com>
2020-02-20 16:55:15 +00:00
nl6720
8b92f50e2c usr.sbin.dnsmasq: add configuration files created by openresolv
See https://roy.marples.name/projects/openresolv/configuration.html#dnsmasq .

Signed-off-by: nl6720 <nl6720@gmail.com>
2020-02-20 11:42:16 +02:00
nl6720
ef591a67ce Add trailing slash to the run variable definition
Signed-off-by: nl6720 <nl6720@gmail.com>
2020-02-20 10:43:21 +02:00
John Johansen
2cb932441c Merge usr.sbin.smbd: add usershare directory
See https://wiki.archlinux.org/index.php/Samba#Enable_Usershares .

AFAIK the `/var/lib/samba/usershares` directory is also used by Ubuntu.

PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/455
Acked-by: John Johansen <john.johansen@canonical.com>
2020-02-20 08:18:37 +00:00
nl6720
c13cee8bbc usr.sbin.smbd: add usershare directory
Signed-off-by: nl6720 <nl6720@gmail.com>
2020-02-13 14:12:24 +02:00
nl6720
c9252827f4 Use "PROC" variable in profiles
Signed-off-by: nl6720 <nl6720@gmail.com>
2020-02-13 11:07:42 +02:00
nl6720
7a9a4824d4 Use "run" variable in profiles
Signed-off-by: nl6720 <nl6720@gmail.com>
2020-02-13 11:02:49 +02:00
nl6720
452b5b8735 Add "run" variable
Signed-off-by: nl6720 <nl6720@gmail.com>
2020-02-13 13:45:45 +02:00
Christian Boltz
aa8fa18552
Add #include if exists <*.d> to new abstractions
This was missing, and catched by a previously enabled test.
2020-02-08 17:14:38 +01:00
Christian Boltz
fbe8641026 Merge branch 'cboltz-nameservice-usretc' into 'master'
adjust abstractions/base and nameservice for /usr/etc/ move

See merge request apparmor/apparmor!447

Acked-by: John Johansen <john.johansen@canonical.com> for 2.12..master
2020-02-03 21:34:38 +00:00
John Johansen
d257afd309 Add xdg-open (and friends) abstraction
Implement set of abstractions to handle opening uris via xdg-open and similar helpers used on different desktop environments.

Abstractions are intended to be included into child profile, together with bundle abstractions such as ubuntu-browsers, ubuntu-email and others, for fine-grained control on what confined application can actually open via xdg-open and similar helpers.

PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/404
Acked-by: John Johansen <john.johansen@canonical.com>
2020-02-03 21:32:21 +00:00
Christian Boltz
cf15b241e7
adjust abstractions/base and nameservice for /usr/etc/ move
References: http://bugzilla.opensuse.org/show_bug.cgi?id=1161756
2020-02-03 22:23:15 +01:00
Christian Boltz
80bf920929 Merge branch 'run-uuidd-request' into 'master'
abstractions/base: allow read access to /run/uuidd/request

See merge request apparmor/apparmor!445

Acked-by: John Johansen <john.johansen@canonical.com> for 2.11..master
Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.11..master
2020-02-03 21:17:28 +00:00
Christian Boltz
3becbbab2c Merge branch 'gnome-abstraction-more-mimeapps' into 'master'
abstractions/gnome: also allow /etc/xdg/mimeapps.list

See merge request apparmor/apparmor!444

Acked-by: John Johansen <john.johansen@canonical.com> for 2.11..master
Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.11..master
2020-02-03 21:16:36 +00:00
Christian Boltz
24895ea302 Merge branch 'ecryptfs-top-dir' into 'master'
abstractions/base: allow read access to top-level ecryptfs directories

See merge request apparmor/apparmor!443

Acked-by: John Johansen <john.johansen@canonical.com> for 2.11..master
Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.11..master
2020-02-03 21:15:38 +00:00
Christian Boltz
50535283e8
add missing *.d include to dbus-network-manager-strict abstraction 2020-01-25 19:54:09 +01:00
Jamie Strandboge
45fffc129f abstractions/base: allow read access to /run/uuidd/request
/run/uuidd/request is hardcoded in libuuid from util-linux and uuidd
listens on this socket to provide random and time-based UUIDs in a
secure manner (man 8 uuidd). Some applications (eg, python's uuid)
prefer to use this socket, falling back to getrandom(), /dev/urandom,
etc. Eg:

$ strace -f aa-exec -p test -- \
  python3 -c 'import uuid ; print("%s\n" % str(uuid.uuid1()))'
...
socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = -1 EACCES (Permission denied)
getrandom("\x8e\x89\xa5\xe7\x39\x1b", 6, GRND_NONBLOCK) = 6
...

uuidd itself produces random numbers using getrandom() and
/dev/{,u}random (falling back to time-based if not), which are already
allowed in the base abstraction. The uuidd daemon, when available, runs
unprivileged under a dedicated user, so allowing read-only access to
/run/uuidd/request is reasonable.
2019-12-17 15:56:23 -06:00
Jamie Strandboge
67cf4fa340 abstractions/gnome: also allow /etc/xdg/mimeapps.list
References:
- https://launchpad.net/bugs/1792027
2019-12-17 15:52:47 -06:00
Jamie Strandboge
fbd8981e92 abstractions/base: allow read access to top-level ecryptfs directories
References:
- https://launchpad.net/bugs/1848919
2019-12-17 15:44:44 -06:00
intrigeri
852c1e766d gnome abstraction: allow reading per-user themes from $XDG_DATA_HOME
Bug-Debian: https://bugs.debian.org/930031

As per https://developer.gnome.org/gtk3/stable/ch32s03.html,
since GTK+ 3.6, $XDG_DATA_HOME/themes is preferred over $HOME/.themes.
We already support the latter, let's also support the former.
2019-12-11 06:31:37 +00:00
Vincas Dargis
162e5086a5 xdg-open: update usage example
Add notes about optional abstractions that can be useful for making
(rare) message boxes created by *-open helpers work correctly.
2019-12-08 15:59:58 +02:00
Vincas Dargis
8b481d469b kde-open5: do not enable gstreamer support by default
Make kde-open5 abstraction more conservative by removing gstreamer
support by default. Update usage example to suggest conditionally including
gstreamer abstraction if required.
2019-12-08 15:53:36 +02:00
Vincas Dargis
d35faafdd2 kde-open5: do not enable a11y by default
Update kde-open5 abstraction to not include accessibility abstraction by
default.

Update documentation to suggest adding it manually in child profile when
using kde-open5 if accessibility access is required by profile author.
2019-12-08 15:25:52 +02:00
Vincas Dargis
e77abfa56a exo-open: update comment about DBUS denial
Make comment more clear about denied DBUS access, no need to raise
questions. Remove redundant comment.
2019-12-08 15:13:33 +02:00
Vincas Dargis
0a55babe9a exo-open: do not enable a11y by default
Update exo-open abstraction to not include accessibility abstraction by
default.

Update documentation to suggest adding it manually in child profile when
using exo-open if accessibility access is required by profile author.
2019-12-08 15:07:57 +02:00
Vincas Dargis
501aada843 gio-open: fix denies Ubuntu Eoan
gio-open abstraction is outdated for latest Ubuntu with Gnome.

Add rule to remove denial for reading snapd-related files.
2019-12-08 13:40:22 +02:00
Vincas Dargis
ac08dc66ec kde-open5: fix denies Ubuntu Eoan
kde-open5 abstraction is outdated for latest Ubuntu with KDE.

Add rules to make kde-open5 work again.
2019-12-08 13:17:38 +02:00
Vincas Dargis
80514906f0 kde-open5: use dbus-network-manager-strict abstraction
Remove inline dbus rules and include new dbus-network-manager-strict
abstraction instead.
2019-12-08 12:40:35 +02:00
Vincas Dargis
f07f077174 exo-open: Allow playing alert sounds
In case of error (for example failing to open provided uri) message box
is show, and alert sound is played. Currently `exo-open` abstraction
does not allow access to audio subsystems in result producing denials in
system logs.

Update abstraction to include `abstractions/audio`.
2019-12-08 12:22:52 +02:00
Vincas Dargis
af278ca691 exo-open: Fix denials on OpenSUSE
exo-open fails on OpenSUSE due to different/missing paths.

Update abstraction to fix denials on OpenSUSE.
2019-12-08 12:22:52 +02:00
Vincas Dargis
622fc44bd0 Add xdg-open (and friends) abstraction
Implement set of abstractions to handle opening uris via xdg-open and similar
helpers used on different desktop environments.

Abstractions are intended to be included into child profile, together
with bundle abstractions such as ubuntu-browsers, ubuntu-email and others, for
fine-grained control on what confined application can actually open via xdg-open
and similar helpers.
2019-12-08 12:22:52 +02:00
Christian Boltz
1cfd4d4bbc Merge branch 'cboltz-usr-etc' into 'master'
Allow /usr/etc/ in abstractions/authentication

openSUSE (and hopefully some other distributions) work on moving shipped
config files from /etc/ to /usr/etc/ so that /etc/ only contains files
written by the admin of each system.

See https://en.opensuse.org/openSUSE:Packaging_UsrEtc for details and
the first moved files.

Updating abstractions/authentication is the first step, and also fixes
bugzilla.opensuse.org/show_bug.cgi?id=1153162

See merge request apparmor/apparmor!426

Acked-by: John Johansen <john.johansen@canonical.com> for 2.12..master
2019-11-27 19:40:47 +00:00
John Johansen
a10fa57fb6 Add dbus-network-manager-strict abstraction
Some applications queries network configuration (using QNetworkConfigurationManager class in Qt and similar), and that produces DBus denials under AppArmor confinement when NetworkManager backend is used.

Add abstraction that allows most common read-only DBus queries for getting current network configuration from NetworkManager backend.


PR: https://gitlab.com/apparmor/apparmor/merge_requests/409
Acked-by: John Johansen <john.johansen@canonical.com>
2019-11-27 18:01:42 +00:00
John Johansen
48fdd0ef76 Remove a selection of obsolete support
Requires NPAPI which no major browsers support anymore: Mozplugger npviewer / nspluginwrapper

The following have been discontinued Google Talk (and plugin) f-spot conkeror galeon Mozilla Prism rekonq Adobe Reader for Linux

Other gnome-codec-install is not in Ubuntu anymore gstreamer0.10 was replaced by 1.0

PR: https://gitlab.com/apparmor/apparmor/merge_requests/417
Acked-by: John Johansen <john.johansen@canonical.com>
2019-11-27 06:14:05 +00:00
Christian Boltz
663546c284 Merge branch 'cboltz-abstractions-kerberos' into 'master'
abstractions/kerberosclient: allow reading /etc/krb5.conf.d/

See merge request apparmor/apparmor!425

Acked-by: Steve Beattie <steve@nxnw.org> for 2.10..master
Acked-by: John Johansen <john.johansen@canonical.com> for 2.10..master
2019-11-18 21:35:29 +00:00