Commit graph

5061 commits

Author SHA1 Message Date
Christian Boltz
3b4d1ed0e4 Merge branch 'feature/debuglogger-stdout' into 'master'
Extend common DebugLogger with option to log to stderr

See merge request apparmor/apparmor!325

Acked-by: Eric Chiang <ericchiang@google.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2019-02-07 18:26:19 +00:00
Otto Kekäläinen
c04a0cadef Extend common DebugLogger with option to log to stderr
This makes it possible for e.g. command line tools to have the --debug
option and when invoked print the existing debug messages directly to
stderr so the user running the command can see them.
2019-02-07 01:05:32 +02:00
Christian Boltz
365bb375d5 Merge branch 'fix-kdeglobals' into 'master'
kde: fix global settings access for Kubuntu and openSUSE

See merge request apparmor/apparmor!322

Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.12..master
2019-02-05 17:23:05 +00:00
Vincas Dargis
0f30a59021 kde: fix global settings access for Kubuntu and openSUSE
On Kubuntu, these denies are being produced:
```
type=AVC msg=audit(1549301888.419:91): apparmor="DENIED" operation="open"
profile="qtox"
name="/usr/share/kubuntu-default-settings/kf5-settings/kdeglobals" pid=1603
comm="qtox" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

type=AVC msg=audit(1549301964.008:126): apparmor="DENIED" operation="open"
profile="qtox" name="/usr/share/kubuntu-default-settings/kf5-settings/breezerc"
pid=1822 comm="qtox" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0

type=AVC msg=audit(1549302031.194:155): apparmor="DENIED" operation="open"
profile="qtox"
name="/usr/share/kubuntu-default-settings/kf5-settings/baloofilerc" pid=1899
comm="qtox" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
```

Meanwhile, on openSUSE:
```
type=AVC msg=audit(1549302286.921:205): apparmor="DENIED" operation="open" profile="qtox" name="/etc/xdg/kdeglobals" pid=12781 comm="qtox" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
```

Add read only rules for allowing access to global KDE settings.
2019-02-05 18:46:39 +02:00
Christian Boltz
a18d03767e Merge branch 'feature/aa-decode-with-python' into 'master'
Rewrite aa-decode to use inline Python as Perl is to be deprecated

See merge request apparmor/apparmor!321

Acked-by: Eric Chiang <ericchiang@google.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2019-02-05 12:17:07 +00:00
Otto Kekäläinen
707ef17923 Rewrite aa-decode to use inline Python instead of to-be-deprecated Perl 2019-02-05 00:20:47 +02:00
Otto Kekäläinen
a3ae271d1e Bugfix aa-decode test: Get stderr correctly, don't ignore stderr contents
Defining 'stderr = subprocess.STDOUT' as a default value for function
did not work and the 'stderr' was always empty, thus also 'outerr' was
always empty and not standard error contents was ever considered in any
way.

Best in fact was to remove excess function arguments as they were not even
used and replace it with a simpler and less error prone structure.

Even after reading 'stderr' correctly it did not help much as all tests
used 'assertIn' which ignored excess output. Better replace the normal
output with the error output if there ever was something, since stderr
is most likely a serious thing and tests should stop on it.
2019-02-05 00:15:13 +02:00
Christian Boltz
544bed4b98 Merge branch 'feature/json-mode-documentation' into 'master'
Clean up and document AppArmor UI module

See merge request apparmor/apparmor!323

Acked-by: Christian Boltz <apparmor@cboltz.de>
2019-02-04 20:54:46 +00:00
Otto Kekäläinen
eb378f46d5 Clean up and document AppArmor UI module
- Add documentation stub for what the UI module is and how JSON works
- Make indentation consistent
- Use pythonic 'if' clauses
- Add two spaces after function definitions (Python style)
2019-02-04 20:14:58 +02:00
John Johansen
d1634b8fb0 audio abstraction: grant read access to Alsa and libao config files
Fixes https://bugs.debian.org/920669 and https://bugs.debian.org/920670.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/320

Signed-off-by: John Johansen <john.johansen@canonical.com>
2019-01-31 11:27:45 +00:00
intrigeri
16c4713363 audio abstraction: grant read access to the libao configuration files.
Bug-Debian: https://bugs.debian.org/920670

Relevant documentation: https://xiph.org/ao/doc/config.html
2019-01-31 09:29:24 +00:00
intrigeri
2d72795f65 audio abstraction: grant read access to the system-wide asound.conf.
Bug-Debian: https://bugs.debian.org/920669

Relevant documentation: http://www.alsa-project.org/main/index.php/Asoundrc

We already grant read access to the corresponding per-user configuration file
(~/.asoundrc) so it makes sense to also grant access to the system-wide one.
2019-01-31 09:27:10 +00:00
Christian Boltz
fb256feb29
Merge branch 'cboltz/apparmor-cboltz-check-abstractions-d'
See https://gitlab.com/apparmor/apparmor/merge_requests/318

Acked-by: John Johansen <john.johansen@canonical.com>
2019-01-29 13:57:46 +01:00
Christian Boltz
85c01a56e6
add test to ensure abstractions have '#include if exists <*.d>'
Exceptions are
- ubuntu-browsers (because we already have ubuntu-browsers.d with
  different usage)
- ubuntu-helpers (which includes the sanitized_helper subprofile, so
  adding something in the global area wouldn't make much sense)

Also adjust abstractions/postfix-common to use the style all
abstractions use.
2019-01-27 20:41:28 +01:00
intrigeri
a5e74c3be3 Merge branch 'move-drircd' into 'master'
Move drirc.d access to dri-common abstraction

See merge request apparmor/apparmor!314
2019-01-27 16:37:22 +00:00
Vincas Dargis
2d8d2f06d5 Move drirc.d access to dri-common abstraction
Commit b5be596460 added ability to read
/usr/share/drirc.d/ directory to mesa abstraction.

This seems to be a mistake, as it was noted that not all GUI
applications, that need access to drirc.d, also need whole mesa-related
rules (including writing caches).

Move /usr/share/drirc.d/ access to different abstraction. This is not a
breaking change, because any GUI application will have included X
abstraction already, and in the end result - dri-common abstraction too.
2019-01-27 17:40:04 +02:00
John Johansen
b97587ec65 Make rc.apparmor.functions suitable for Debian and Ubuntu
Debian and Ubuntu currently don't use rc.apparmor.functions. They have their own code for loading profiles, their own initscript and systemd unit.

As discussed initially on https://bugs.debian.org/870697 and https://salsa.debian.org/apparmor-team/apparmor/merge_requests/6#note_29153, to fix that without introducing regressions on Debian/Ubuntu, we need to upstream a number of changes, which is what this branch is about.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/252
Acked-by: Christian Boltz <apparmor@cboltz.de>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2019-01-24 20:29:20 +00:00
John Johansen
330bd6c5f6 abstractions: fix merge conflict resoltion typo
Fix typo introduced when resolving a merge conflict for d9ab83281b
("Add support for local additions to abstractions")

Signed-off-by: John Johansen <john.johansen@canonical.com>
2019-01-24 04:34:03 -08:00
Matthew Garrett
d9ab83281b Add support for local additions to abstractions
Local policy may want to extend or override abstractions, so add support for including local updates to them.

Acked-by: Christian Boltz <apparmor@cboltz.de>
Acked-by: intrigeri <intrigeri@boum.org>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2019-01-24 03:06:03 -08:00
Marius Tomaschewski
b0bacba9db abstractions/nameservice: allow /run/netconfig/resolv.conf
Latest netconfig in openSUSE writes /run/netconfig/resolv.conf, and only
has a symlink to it in /etc

References: https://bugzilla.opensuse.org/show_bug.cgi?id=1097370
Acked-by: Christian Boltz <apparmor@cboltz.de>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2019-01-24 02:43:02 -08:00
Eric Chiang
2609f356cb parser: fix warnings about unused functions
Signed-off-by: Eric Chiang <ericchiang@google.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2019-01-24 02:36:42 -08:00
John Johansen
803cb5558f drop failing corner-case check in logparser.py
aa-logprof errors out if it hits a log event for a non-existing profile
while a profile file with the default filename for that non-existing
profile exists. This can for example happen after adding a profile name
to a profile if audit.log still contains events for the attachment-based
profile name.

Since we ignore log events for non-existing profiles in general, drop
the code for the special case "but a file matching the default filename
for that non-existing profile exists" and also silently ignore events
for this very special non-existing profile.

Also drop the now unused function get_profile_filename()

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

PR: https://gitlab.com/apparmor/apparmor/merge_requests/296
Signed-off-by: John Johansen <john.johansen@canonical.com>
2019-01-24 10:26:05 +00:00
John Johansen
3a0eea151b update mysqld profile
This updates the mysqld to what I use on my servers nowadays.

Note: my profile also has capability sys_resource,, but I'm not sure why I had to add this and therefore didn't include it in this merge request.

Speaking about "why I had added $whatever" - these changes were collected over the last years and of course ;-) I don't remember any details.

PR: https://gitlab.com/apparmor/apparmor/merge_requests/310
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2019-01-24 04:25:34 +00:00
Christian Boltz
0199edf8e7
update mysqld profile
This updates the mysqld to what I use on my servers nowadays.
2019-01-24 00:30:34 +01:00
Eric Chiang
087340a97a Merge branch 'parser_make' into 'master'
*: ensure make apparmor_parser is cached

See merge request apparmor/apparmor!307
2019-01-23 15:50:17 +00:00
Eric Chiang
cb8c3377ba *: ensure make apparmor_parser is cached
This change updates parser/Makefile to respect target dependencies and
not rebuild apparmor_parser if nothing's changed. The goal is to allow
cross-compiled tests #17 to run on a target system without the tests
attempting to rebuild the parser.

Two changes were made:

* Generate af_names.h in a script so the script timestamp is compared.
* Use FORCE instead of PHONY for libapparmor_re/libapparmor_re.a

Changes to list_af_names are intended to exactly replicate the old
behavior.

Signed-off-by: Eric Chiang <ericchiang@google.com>
2019-01-22 15:30:51 -08:00
Christian Boltz
5d384d9625 Merge branch 'cboltz-dnsmasq-libvirtd' into 'master'
dnsmasq: allow peer=libvirtd to support named profile

See merge request apparmor/apparmor!304

Acked-by: Eric Chiang <ericchiang@google.com> for 2.12..master
2019-01-22 22:23:59 +00:00
Christian Boltz
91dc2c4c29 Merge branch 'update-mesa' into 'master'
mesa: allow reading drirc.d

See merge request apparmor/apparmor!308

Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.12..master
2019-01-19 17:37:07 +00:00
Vincas Dargis
b5be596460 mesa: allow reading drirc.d
Recent Mesa update introduces new denies:

```
type=AVC msg=audit(1547905564.212:523): apparmor="DENIED"
operation="open" profile="supertuxkart" name="/usr/share/drirc.d/"
pid=15740 comm="supertuxkart" requested_mask="r" denied_mask="r"
fsuid=1000 ouid=0
```

```
type=AVC msg=audit(1547905896.307:548): apparmor="DENIED"
operation="open" profile="supertuxkart"
name="/usr/share/drirc.d/00-mesa-defaults.conf" pid=15963 c
omm="supertuxkart" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
```

Add rule to allow reading newly required paths.
2019-01-19 15:55:58 +02:00
Christian Boltz
027dcdb23f Merge branch 'fix-compose-cache' into 'master'
qt5-compose-cache-write: fix anonymous shared memory access

See merge request apparmor/apparmor!301

Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.10..master
2019-01-14 20:51:10 +00:00
Christian Boltz
3e3c90152f Merge branch 'fix-qt5-settings' into 'master'
qt5-settings-write: fix anonymous shared memory access

See merge request apparmor/apparmor!302

Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.10..master
2019-01-14 20:48:21 +00:00
Vincas Dargis
8f6a8fb194 Refactor qt5-settings-write
Merge symlink rules together with `rw` rules for brevity.
2019-01-14 19:23:49 +02:00
Christian Boltz
20fe099ced
dnsmasq: allow peer=libvirtd to support named profile
The /usr/sbin/libvirtd profile will get a profile name ("libvirtd").

This patch adjusts the dnsmasq profile to support the named profile in
addition to the "old" path-based profile name.

References: https://bugzilla.opensuse.org/show_bug.cgi?id=1118952#c3
2019-01-13 17:38:09 +01:00
Christian Boltz
808218d8ee Merge branch 'fix-alsa' into 'master'
audio: Fix alsa settings access

See merge request apparmor/apparmor!303

Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.12..master
2019-01-13 16:11:41 +00:00
Vincas Dargis
73f01196bb audio: Fix alsa settings access
OpenAL application on Debian Buster produces deny message:
```
type=AVC msg=audit(1547295526.633:732): apparmor="DENIED"
operation="open" profile="supertuxkart" name="/etc/alsa/conf.d/"
pid=13963 comm="supertuxkart" reque
sted_mask="r" denied_mask="r" fsuid=1000 ouid=0
```

Add file rule to allow reading Alsa configuration files.
2019-01-12 14:23:28 +02:00
Vincas Dargis
f1200873b8 qt5-settings-write: fix anonymous shared memory access
*Add anonymous shared memory access rule for QtSettings.conf file
itself.
* Reduce strictness of anonymous shared memory file names - numbers in
them can be smaller or bigger.
* Fix consistency - require anonymous shared memory file names to end
with digit in all rules.
2019-01-12 12:50:19 +02:00
Vincas Dargis
1250402471 qt5-compose-cache-write: fix anonymous shared memory access
Qt5 applications produces deny message when saving compose cache files:

```
type=AVC msg=audit(1547287756.436:198): apparmor="DENIED"
operation="link" profile="qtox"
name="/home/vincas/.cache/qt_compose_cache_little_endian_4982ae57498642c5997565013f7ffe4e"
pid=2878 comm="qtox" requested_mask="l" denied_mask="l" fsuid=1000
ouid=1000 target="/home/vincas/.cache/#919806"
```

Add file rule to enable writing anonymous shared memory file.
2019-01-12 12:34:22 +02:00
intrigeri
fad38ca93f Merge branch 'make-tunables-share-play-well-with-aliases' into 'master'
Make tunables/share play well with aliases

See merge request apparmor/apparmor!300
2019-01-09 17:49:53 +00:00
intrigeri
a91d199ab1 Make tunables/share play well with aliases.
This reverts commit aa3022208f.

Space-separated list of values don't play well with aliases.
For example, in Tails, despite this alias rule:

  alias / -> /lib/live/mount/rootfs/*.squashfs/,

… the Tor Browser profile denies access to
/lib/live/mount/rootfs/filesystem.squashfs/usr/share/mime/mime.cache, which
should be equivalent to /usr/share/mime/mime.cache. That's fixed by using
alternations instead; too bad they're less readable.

Possibly related:
https://bugs.launchpad.net/apparmor/+bug/888077
https://bugs.launchpad.net/apparmor/+bug/1703692
https://bugs.launchpad.net/apparmor/+bug/1703692
2019-01-07 12:58:56 +00:00
Christian Boltz
a772ee0f8b Merge branch 'EmersonBernier/shellcheck' into 'master'
parser/apparmor.systemd: fix minor issues detected by shellcheck

See merge request apparmor/apparmor!293

Acked-by: Christian Boltz <apparmor@cboltz.de> for master and 2.13
2019-01-03 17:41:56 +00:00
Christian Boltz
1f53de174d Merge branch 'var-lib-dehydrated' into 'master'
abstractions/ssl_{certs,keys}: dehydrated uses /var/lib on Debian

See merge request apparmor/apparmor!299

Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.10..master
2019-01-03 17:32:51 +00:00
Simon Deziel
04b2842e1c abstractions/ssl_{certs,keys}: allow reading ocsp.der maintained by dehydrated for OCSP stapling
Signed-off-by: Simon Deziel <simon@sdeziel.info>
2019-01-03 08:31:06 -05:00
Simon Deziel
c5a89d5daf abstractions/ssl_{certs,keys}: sort the alternation for dehydrated and drop the "-" from the filenames
Signed-off-by: Simon Deziel <simon@sdeziel.info>
2019-01-03 08:29:21 -05:00
Simon Deziel
1306f9a64d abstractions/ssl_{certs,keys}: dehydrated uses /var/lib on Debian
Signed-off-by: Simon Deziel <simon@sdeziel.info>
2019-01-02 19:33:19 -05:00
Christian Boltz
ed692337a5
Drop get_profile_filename() from logparser.py
This function is unused since the last commit.
2019-01-02 20:42:57 +01:00
Christian Boltz
03ea5b82b7
drop failing corner-case check in logparser.py
aa-logprof errors out if it hits a log event for a non-existing profile
while a profile file with the default filename for that non-existing
profile exists. This can for example happen after adding a profile name
to a profile if audit.log still contains events for the attachment-based
profile name.

Since we ignore log events for non-existing profiles in general, drop
the code for the special case "but a file matching the default filename
for that non-existing profile exists" and also silently ignore events
for this very special non-existing profile.

References: https://bugzilla.opensuse.org/show_bug.cgi?id=1120472
2019-01-02 20:30:54 +01:00
intrigeri
775835db64 Fix is_apparmor_present() regression which breaks the Debian initscript.
Commit 0d5ab43d59 removed support for loading
modules and introduced a caller, in apparmor_start(), that passes no argument to
is_apparmor_present(), which breaks that function when /bin/sh → /bin/dash.

Passing a module name as argument does not make sense since we dropped support
for the long obsolete "subdomain" module, so let's simplify
is_apparmor_present() and adjust its callers accordingly.

Bug-Debian: https://bugs.debian.org/917874
2019-01-01 17:55:48 +00:00
intrigeri
1bd401bb35 Stop looking for apparmor.conf.
As per the discussion that starts at
https://gitlab.com/apparmor/apparmor/merge_requests/252#note_125983293,
apparmor.conf was never documented nor explicitly supported.
It's not really clear what problem it was meant to solve.
2018-12-28 16:34:17 +00:00
intrigeri
93f0c2d9ca Don't call the obsolete configure_owlsm function.
It was removed in commit 94ff870f.
2018-12-28 16:27:58 +00:00
intrigeri
3b997c79b4 Don't try to list files in a non-existent directory.
Thanks to Jamie Strandboge for spotting this during review.
2018-12-27 17:54:11 +00:00