Commit graph

1013 commits

Author SHA1 Message Date
John Johansen
0dc86bfeb3 profiles: fixup chromium profile
- drop out dated maintenance comment
- cleanup profile name rules, and fix a few broken references
- /usr/lib -> /{usr,}/lib
- lib -> lib{,32,64}

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/611
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Acked-by: Steve Beattie <steve.beattie@canonical.com>
2020-09-03 11:44:19 -07:00
Vincas Dargis
e6dbe3bfd3 nvidia_modprobe: allow creating /dev/nvidia-modeset
On Debian Sid we get this denial:

```
type=AVC msg=audit(1599065006.981:527): apparmor="DENIED"
operation="mknod" profile="nvidia_modprobe" name="/dev/nvidia-modeset"
pid=12969 comm="nvidia-modprobe" requested_mask="c" denied_mask="c"
fsuid=0 ouid=0
```

Update nvidia_modprobe profile to allow creating device file.
2020-09-03 18:20:33 +03:00
John Johansen
eb8f9302aa profiles: Add a hosts_access abstraction
Host files accessed by tcp_wrapper can reference other files, from man
5 hosts.allow

```
A string that begins with a '/' character is treated as a file name. A host name or address is matched if it matches any host name or address pattern listed in the named file. The file format is zero or more lines with zero or more host name or address patterns separated by whitespace. A file name pattern can be used anywhere a host name or address pattern can be used.
```

This means adding a file to hosts requires updating multiple profiles
Add a hosts abstraction so users only have to modify a single location.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/605
Fixes: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1864466
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2020-09-01 19:39:59 -07:00
John Johansen
e1ba76375b profiles: Add chromium-browser profile from Ubuntu
Ubuntu is dropping their chromium-browser profile because
chromium-browser has been made a snap on ubuntu. Suck in the profile
upstream as a reference profile for those who want to confine
chromium outside of a snap, and update its includes.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/606
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
2020-08-31 21:56:59 -07:00
John Johansen
cc97494528 Merge Fix access to Fips 140-2 library integrity files
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/595
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2020-08-31 17:41:11 +00:00
John Johansen
33112c324c Merge php-fpm: /run path update and peer name fixes
* fix profile name in signal and change_profile rule
* php-fpm profile: adjust /run paths

Thanks to Darix for pointing out that openSUSE now uses /run/php-fpm/

Also switch to using @{run}.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/601
Acked-by: John Johansen <john.johansen@canonical.com>
2020-08-31 06:48:33 +00:00
Christian Boltz
64ae865675
php-fpm: allow only one pid file
According to Darix, the pid is only in the main config, and it doesn't
make sense to have multiple pid files
2020-08-30 23:24:22 +02:00
Christian Boltz
9892a03270
php-fpm: fix profile name in signal and change_profile rule
Note: the change_profile rule was not really correct and only worked by
accident. We want to specify the target profile, therefore add the '->'.
2020-08-30 22:39:30 +02:00
Christian Boltz
6cf58457d7 Merge branch 'patch-1' into 'master'
Fix /usr/lib/postfix binary paths in postfix+dovecot profiles

See merge request apparmor/apparmor!602

Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.12..master
2020-08-30 18:57:11 +00:00
Alexis Grey
04394d0749 Fix /usr/lib/postfix binary paths in postfix+dovecot profiles
This makes it consistent with the other Postfix profiles.
2020-08-30 18:57:11 +00:00
Vincas Dargis
a98a4f734f nvidia_modprobe: allow reading driver parameters
On Debian Sid nvidia_modprobe is not permissive enough:

```
type=AVC msg=audit(1598788812.837:495): apparmor="DENIED"
operation="open" profile="nvidia_modprobe"
name="/proc/driver/nvidia/params" pid=31586 comm="nvidia-modprobe"
requested_mask="r" denied_mask="r" fsuid=0 ouid=0
```

Update profile to all reading /proc/driver/nvidia/params

Fixes Debian bug 969267 [0]

[0] https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=969267
2020-08-30 19:24:29 +03:00
Christian Boltz
3a4dc1f885
php-fpm profile: adjust /run paths
Thanks to Darix for pointing out that openSUSE now uses /run/php-fpm/

Also switch to using @{run}.
2020-08-28 22:23:13 +02:00
John Johansen
398bb20dfd policy: Provide example and base abi to pin pre 3.0 policy
Provide example rules in parser.conf to pin pre 3.0 policy and
appropriate abi files.

abis for vanilla upstream kernels and outoftree network patched
kernels are provided. With both ABIs dropping v8 support from
advertised by the kernel as 2.x policy/userspace did not support it.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/598
Acked-by: Steve Beattie <steve.beattie@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-08-28 12:57:00 -07:00
Steve Beattie
e463f9ad44
profiles: add FIPS-140-2 lib validation hmac files to abstractions/base
Cryptographic libraries that have had FIPS 140-2 patches applied with
read from and validate themselves against a validation file, which is in
the same directory as the library itself. As an example, A FIPS 140-2
version libgcrypt on x86-64 has the following shared library and hmac file:

  /lib/x86_64-linux-gnu/libgcrypt.so.20.2.1
  /lib/x86_64-linux-gnu/.libgcrypt.so.20.hmac

A similarly named version of libgcrypt + hmac file can be seen for SUSE
systems in:

  https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp2464.pdf

and Red Hat:

  https://csrc.nist.gov/CSRC/media/projects/cryptographic-module-validation-program/documents/security-policies/140sp2657.pdf

The libraries provided by FIPS 140-2 compliant versions of OpenSSL also
include this.

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/595
2020-08-24 23:06:54 -07:00
John Johansen
345f4eaeff Merge abstractions/gnome: allow /usr/share/gtk-3.0/settings.ini
GTK+ 3 has a global settings file (see https://gitlab.gnome.org/GNOME/gtk/-/blob/gtk-3-24/gtk/gtksettings.c#L345) that should be readable as well.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/592
Acked-by: John Johansen <john.johansen@canonical.com>
2020-08-20 08:07:11 +00:00
Jonas Witschel
af6fe026e1 abstractions/gnome: allow /usr/share/gtk-3.0/settings.ini
GTK+ 3 has a global settings file that should be readable as well.
2020-08-18 12:28:53 +02:00
Antonio Russo
660ce39937 Add php-fpm isolation with apparmor hats
Adapted from https://nordisch.org/posts/php-fpm-apparmor/, port the
nextcloud-independent portion of the php-fpm worker abstractions and
php-fpm isolation for more general usage.

Signed-off-by: Antonio Russo <antonio.e.russo@gmail.com>
2020-08-16 12:11:00 -06:00
Steve Beattie
f318def665
tests: fix profiles and utils tests to find and use the swig python libraries
The fixes that landed for #98 are incomplete: they only added a check to
ensure that the parser is built, and not libapparmor as well, and also
didn't adjust the invocation of aa-logprof to actually make use of the
built libapparmor or its swig python library.

Furthermore, neither it nor the tests in utils/ add the location of the
swig libapparmor C library to the library search path, meaning that if
the system one does not exist, it will not be found and the test will
fail.

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
Bug: https://gitlab.com/apparmor/apparmor/-/issues/98
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/586
2020-07-24 23:57:26 -07:00
Steve Beattie
76162d4b84
profiles/Makefile: fix aa-logprof invocation
The commit c8b6d8b393 ("profiles: Update 'make check' to select tools
based on USE_SYSTEM") set a bunch of variables but neglected to apply
them when invoking aa-logprof. This commit addresses this by:

  * correcting the PYTHONPATH used with aa-logprof
  * setting LD_LIBRARY_PATH when invoking aa-logprof
  * adjusting LD_LIBRARY_PATH to include both the directory location
    of libapparmor but also the swig libapparmor library needed for
    python tools to function.
  * adjusts the test for the presence of libapparmor to not use
    LD_LIBRARY_PATH but instead a libapparmor specific variable
    LIBAPPARMOR_PATH

Bug: https://gitlab.com/apparmor/apparmor/-/issues/98
Fixes: c8b6d8b393
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/586
2020-07-24 23:52:36 -07:00
Steve Beattie
2d94faeb5b
profiles/Makefile: add check for built libapparmor
When running the 'check-logprof' test using tools in the tree,
libapparmor needs to have been built for the python utilities to work.
Add a check for its existence to the test-dependencies target.

Bug: https://gitlab.com/apparmor/apparmor/-/issues/98
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/586
2020-07-24 23:52:27 -07:00
Steve Beattie
75c02604be
profiles/Makefile: local target does not depend on parser
The "local" make target does not depend on the parser having been
built. Create a separate "test-dependencies" target and have the tests
that need them depend on that and the "local" target, when validating
the profile set against the apparmor tools.

Fixes: c8b6d8b393
Bug: https://gitlab.com/apparmor/apparmor/-/issues/98
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/586
2020-07-24 23:52:16 -07:00
Christian Boltz
4c14516341
Convert abstractions from /{usr/,}etc/ to @{etc_ro}
The authentication, base and nameservice abstraction used /{usr/,}etc/
in several rules. Switch that to the more readable (and tunable)
@{etc_ro} variable.
2020-07-23 20:51:25 +02:00
Christian Boltz
715589f8dd
Introduce tunables/etc with @{etc_ro} and @{etc_rw}
This helps to adjust profiles in a readable way for
https://en.opensuse.org/openSUSE:Packaging_UsrEtc
and similar initiatives.
2020-07-23 20:51:25 +02:00
John Johansen
c8b6d8b393 profiles: Update 'make check' to select tools based on USE_SYSTEM
The profiles dirs make check is not always using the correct tools.
Update it to be similar to other Makefiles where the var USE_SYSTEM

  make check USE_SYSTEM=1

is used to indicated that the system installed tools should be used
and

  make check

is used to run the tests against the in tree tools

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/580
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2020-07-22 13:37:43 -07:00
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