Commit graph

1139 commits

Author SHA1 Message Date
Christian Boltz
35f033ca7c
abstractions/X: add another xauth path
Future sddm version will use $XDG_RUNTIME_DIR/xauth_XXXXXX

References:
- https://bugzilla.opensuse.org/show_bug.cgi?id=1174290
- https://bugzilla.suse.com/show_bug.cgi?id=1174293
- https://github.com/sddm/sddm/pull/1230
- https://github.com/jonls/redshift/issues/763
2020-07-20 20:30:34 +02:00
John Johansen
da4bab8368 profiles: add support for perfmon and bpf caps to the supported abi
To be able to use perfmon and bpf in policy they need to be in the abi file.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-07-07 09:43:48 -07:00
Vincas Dargis
7b7e98a549 Update fonts abstraction for Debian
Mikhail Morfikov has discovered [0] that some font packages in Debian
ships font files in /usr/bin/fonts-foo-bar (like
/usr/share/fonts-font-awesome/ for example). This produces denials for
GUI applications.

Update fonts abstraction to allow reading /usr/bin/fonts-* directories.

Also, refactor abstraction to aggregate two old rules into one.

Closes #94

[0] https://gitlab.com/apparmor/apparmor/-/issues/94
2020-06-27 11:48:22 +03:00
Jochen Sprickerhof
178f5d5e77 Support libenchant-2-2 2020-06-17 09:20:25 +02:00
John Johansen
1e9987a719 Merge Dovecot profile updates
* allow reading my.cnf in dovecot-dict profile (seen with the mail users in a mysql database)
* allow /proc/\*/attr/current in dovecot imap and lmtp (needed when using the "apparmor" plugin which means dovecot switches to user-specific hats)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/566
Acked-by: John Johansen <john.johansen@canonical.com>
2020-06-12 21:23:22 +00:00
Steve Beattie
777a819fcb
profiles: fix sbin.dhclient profile
Merge branch 'antnesterov/apparmor-fix-dhclient-profile'

@smb: converted read permission to /etc/openssl.cnf to use the openssl
abstraction instead.

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/570
2020-06-12 10:00:21 -07:00
Anton Nesterov
48d9414776 Fix sbin.dhclient profile 2020-06-12 15:54:06 +00:00
Christian Boltz
f7ab91f423
allow reading my.cnf in dovecot-dict profile
Seen on openSUSE Tumbleweed with the mail users in a mysql database.
2020-06-11 15:07:10 +02:00
Christian Boltz
6a388859f8
Allow /proc/*/attr/current in dovecot imap and lmtp
This is needed when using the "apparmor" plugin which means dovecot
switches to user-specific hats.

Seen on openSUSE Tumbleweed.
2020-06-11 15:05:14 +02:00
Christian Boltz
39f7e5723c
add profile names to dovecot profiles 2020-06-11 12:57:53 +02:00
Christian Boltz
71a730fe39
Change #include to include in extra profiles 2020-06-09 23:35:11 +02:00
Christian Boltz
f0491d0d64
Change #include to include in active profiles 2020-06-09 23:30:24 +02:00
Christian Boltz
9aa5e3f388
Change #include to include in abstractions and tunables 2020-06-09 23:28:41 +02:00
John Johansen
870dcc9bc0 Merge Add abi rules to some extra profiles
... which were missed in 730db17607

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/555
Acked-by: John Johansen <john.johansen@canonical.com>
2020-06-01 08:56:12 +00:00
John Johansen
3b4e9ed7e3 Merge Define abi when checking abstractions
This fixes lots of warnings like

```
*** Checking abstractions from ./apparmor.d/abstractions against apparmor_parser
Warning from stdin (stdin line 1): ../parser/apparmor_parser: File 'stdin' missing feature abi, falling back to default policy feature abi
Warning from stdin ([...]/profiles/./apparmor.d/abstractions/apparmor_api/change_profile line 9): ../parser/apparmor_parser: [...]/profiles/./apparmor.d/abstractions/apparmor_api/change_profile features abi 'abi/3.0' differes from policy declared feature abi, using the features abi declared in policy
```

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/554
Acked-by: John Johansen <john.johansen@canonical.com>
2020-06-01 08:54:17 +00:00
Christian Boltz
7b176cbb48
Add abi rules to some extra profiles
... which were missed in 730db17607
2020-05-31 01:05:52 +02:00
Christian Boltz
35a6676744
Define abi when checking abstractions
This fixes lots of warnings like

```
*** Checking abstractions from ./apparmor.d/abstractions against apparmor_parser
Warning from stdin (stdin line 1): ../parser/apparmor_parser: File 'stdin' missing feature abi, falling back to default policy feature abi
Warning from stdin ([...]/profiles/./apparmor.d/abstractions/apparmor_api/change_profile line 9): ../parser/apparmor_parser: [...]/profiles/./apparmor.d/abstractions/apparmor_api/change_profile features abi 'abi/3.0' differes from policy declared feature abi, using the features abi declared in policy
```
2020-05-31 00:45:17 +02:00
Christian Boltz
9fc8e43c67
abstractions: remove '#' from 'include if exists'
This matches what we use in the profiles for local abstractions.

Also adjust the check in the Makefile to expect the variant without '#'.
2020-05-30 19:53:49 +02:00
John Johansen
730db17607 policy: tag policy with the AppArmor 3.0 abi
Tag profiles and abstractions with abi information.

Tagging abstractions is not strictly necessary but allows the parser
to detect when their is a mismatch and that policy will need an
update for abi.

We do not currently tag the tunables because variable declarations
are not currently affected by abi.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/491
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <sbeattie@ubuntu.com>
2020-05-29 00:23:17 -07:00
John Johansen
1aa80fd14d Merge Allow to read icu *.dat files in postfix-related profiles
This is needed for postdrop, postmap, postqueue and sendmail

Seen on openSUSE Tumbleweed.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/546
Acked-by: John Johansen <john.johansen@canonical.com>
2020-05-26 07:38:41 +00:00
Christian Boltz
b23aa00b81
Allow to read icu *.dat files in postfix-related profiles
This is needed for postdrop, postmap, postqueue and sendmail

Seen on openSUSE Tumbleweed.
2020-05-25 13:33:07 +02:00
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
John Johansen
c386d93581 docs: update documentation to point bug reporting to gitlab
Move suggested bug reporting from launchpad to gitlab

Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
2020-05-05 00:10:53 -07:00
Christian Boltz
bb2409f935
adjust check for local/ includes to "include if exists" 2020-05-03 22:01:16 +02: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
65bb277d8b Merge branch 'cboltz-ci-check-includes' into 'master'
run "make -C profiles check-abstractions.d" in ci

See merge request apparmor/apparmor!449

Acked-by: John Johansen <john.johansen@canonical.com>
2020-02-03 21:30:22 +00:00