Commit graph

5681 commits

Author SHA1 Message Date
Christian Boltz
d08d1a00a3
Fix invalid Pux (should be PUx) permissions in dhclient-script 2020-10-31 20:52:30 +01:00
John Johansen
53d812cfd2 Merge Update dovecot for SIGKILL and dh.pem denials
Running dovecot on Debian 10 (buster) produced these denials:

```
type=AVC msg=audit(1601314853.031:9327): apparmor="DENIED"
operation="signal" profile="dovecot" pid=21223 comm="dovecot"
requested_mask="send" denied_mask="send" signal=kill
peer="/usr/lib/dovecot/auth"

type=AVC msg=audit(1601315453.655:9369): apparmor="DENIED"
operation="signal" profile="dovecot" pid=21223 comm="dovecot"
requested_mask="send" denied_mask="send" signal=kill
peer="/usr/lib/dovecot/pop3"

type=AVC msg=audit(1602939754.145:101362): apparmor="DENIED"
operation="signal" profile="dovecot" pid=31632 comm="dovecot"
requested_mask="send" denied_mask="send" signal=kill
peer="/usr/lib/dovecot/pop3-login"
```

And:

```
type=AVC msg=audit(1603647096.369:24514): apparmor="DENIED"
operation="open" profile="dovecot" name="/usr/share/dovecot/dh.pem"
pid=28774 comm="doveconf" requested_mask="r" denied_mask="r" fsuid=0
ouid=0
```

These are fixed in respective comits.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/671
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-26 22:14:50 +00:00
Vincas Dargis
9d8e111abe dovecot: allow reading dh.pem
Dovecot is hit with this denial on Debian 10 (buster):
```
type=AVC msg=audit(1603647096.369:24514): apparmor="DENIED"
operation="open" profile="dovecot" name="/usr/share/dovecot/dh.pem"
pid=28774 comm="doveconf" requested_mask="r" denied_mask="r" fsuid=0
ouid=0
```

This results in fatal error:

```
Oct 25 19:31:36 dovecot[28774]: doveconf: Fatal: Error in configuration
file /etc/dovecot/conf.d/10-ssl.conf line 50: ssl_dh: Can't open file
/usr/share/dovecot/dh.pem: Permission denied
```

Add rule to allow reading dh.pem.
2020-10-25 19:30:10 +02:00
Vincas Dargis
2f9d172c64 dovecot: allow kill signal
Dovecot might try to kill related processes:

```
type=AVC msg=audit(1601314853.031:9327): apparmor="DENIED"
operation="signal" profile="dovecot" pid=21223 comm="dovecot"
requested_mask="send" denied_mask="send" signal=kill
peer="/usr/lib/dovecot/auth"

type=AVC msg=audit(1601315453.655:9369): apparmor="DENIED"
operation="signal" profile="dovecot" pid=21223 comm="dovecot"
requested_mask="send" denied_mask="send" signal=kill
peer="/usr/lib/dovecot/pop3"

type=AVC msg=audit(1602939754.145:101362): apparmor="DENIED"
operation="signal" profile="dovecot" pid=31632 comm="dovecot"
requested_mask="send" denied_mask="send" signal=kill
peer="/usr/lib/dovecot/pop3-login"
```
This discovered on low-power high-load machine (last resort timeout
handling?).

Update signal rule to allow SIGKILL.
2020-10-25 19:12:42 +02:00
John Johansen
11d3218519 Merge Fix typos
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/669
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-25 12:01:27 +00:00
intrigeri
d6e18b0db8 Fix typos
Spotted by Lintian.
2020-10-25 11:54:56 +00:00
intrigeri
0da70b173c apparmor_xattrs.7: fix whatis entry
Spotted by Lintian (bad-whatis-entry).
2020-10-25 11:54:47 +00:00
John Johansen
0cb35fda84 Merge profiles/apparmor.d/abstractions/X: make x11 socket writable again
Unfortunately in apparmor sockets need `rw` access. Currently x11 can only work if abstract socket is available and used instead so those restrictions won't trigger.

partially reverts c7b8368216

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/664
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-25 11:32:06 +00:00
John Johansen
24855edd11 Merge Add Fontmatrix to abstractions/fonts
[Fontmatrix](https://github.com/fontmatrix/fontmatrix) [adds \~/.Fontmatrix/Activated to fonts.conf](https://github.com/fontmatrix/fontmatrix/blob/75552e2/src/typotek.cpp#L1081-L1088). This causes programs which use [Fontconfig](https://gitlab.freedesktop.org/fontconfig/fontconfig) (directly or indirectly through libraries such as [Pango](https://pango.gnome.org/)) to include that directory in their font search path, which causes errors such as:

```
audit: type=1400 audit(1602678958.525:53): apparmor="DENIED" operation="open" profile="fr.emersion.Mako" name="/home/username/.Fontmatrix/Activated/.uuid" pid=48553 comm="mako" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
audit: type=1400 audit(1602678958.525:54): apparmor="DENIED" operation="open" profile="fr.emersion.Mako" name="/home/username/.Fontmatrix/Activated/" pid=48553 comm="mako" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
```

if the program does not explicitly include this directory in its AppArmor profile. As with other common font locations, add `~/.Fontmatrix/Activated` to the fonts abstraction for read-only access.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/657
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-25 11:24:58 +00:00
John Johansen
32d748ab0f Merge add Dovecot and other mail related profiles
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/644
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-25 11:22:24 +00:00
John Johansen
1961bb7719 Merge Adjust to support brave in ubuntu abstractions
See Bug-Ubuntu: https://launchpad.net/bugs/1889699

Fixes: https://launchpad.net/bugs/1889699
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/667
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-25 11:13:43 +00:00
John Johansen
3ff07adda5 Merge Adjust ubuntu-integration to use abstractions/exo-open
see Bug-Ubuntu: https://launchpad.net/bugs/1891338

Fixes: https://launchpad.net/bugs/1891338
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/666
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-25 11:11:39 +00:00
Christian Boltz
dbb1b900b8 Merge branch 'adjust-for-new-ICEauthority-path-in-run' into 'master'
Adjust for new ICEauthority path in /run

Bug-Ubuntu: https://launchpad.net/bugs/1881357

See merge request apparmor/apparmor!668


Acked-by: Christian Boltz <apparmor@cboltz.de> for 3.0 and master
2020-10-25 10:16:26 +00:00
Jamie Strandboge
1abe101734 Adjust for new ICEauthority path in /run
Bug-Ubuntu: https://launchpad.net/bugs/1881357
2020-10-25 09:56:34 +00:00
Francois Marier
9b30f9306d Adjust to support brave in ubuntu abstractions
Bug-Ubuntu: https://launchpad.net/bugs/1889699
2020-10-25 09:53:44 +00:00
Jamie Strandboge
9ff0bbb69e Adjust ubuntu-integration to use abstractions/exo-open
Bug-Ubuntu: https://launchpad.net/bugs/1891338
2020-10-25 09:48:25 +00:00
John Johansen
6039d1580a Merge abstractions: mesa - tightens cache location and add fallback
This tightens the cache location in @{HOME}/.cache and also adds the tmp fallback location.

Currently there are the following entries in the mesa abstraction:

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/91
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/652
Acked-by: Christian Boltz <apparmor@cboltz.de>
2020-10-25 09:14:40 +00:00
John Johansen
cfc57c08e6 Merge profiles: nscd: service fails with apparmor 3.0.0-2 on Arch Linux
After a recent upgrade of apparmor on Arch Linux the nscd systemd service fails to start. Arch Linux has /var/db/nscd and that path is missing from the profile AFAICT.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/124
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/651
Acked-by: Christian Boltz <apparmor@cboltz.de>
2020-10-25 09:08:06 +00:00
Erick555
81867f9424 profiles/apparmor.d/abstractions/X: make x11 socket writable again
Unfortunately in apparmor sockets need rw access. Currently x11 can only work if abstract socket is available and used instead so those restrictions won't trigger. This partially reverts c7b8368216
2020-10-23 12:22:10 +00:00
John Johansen
15dc06248c utils: fix make -C profiles check-logprof fails
On arch
  make -C profiles check-logprof

fails with
  *** Checking profiles from ./apparmor.d against logprof

  ERROR: Can't find AppArmor profiles in /etc/apparmor.d
  make: *** [Makefile:113: check-logprof] Error 1
  make: Leaving directory '/build/apparmor/src/apparmor-2.13.3/profiles'

because /etc/apparmor.d/ is not available in the build environment
and aa-logprofs --dir argument, is not being passed to init_aa()
but used to update profiles_dir after the fact.

Fix this by passing profiledir as an argument to init_aa()

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/36
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/663
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2020-10-22 14:56:09 -07:00
John Johansen
8ea7630b6d aa-notify: Stop aa-notify from exit after 100s of polling
When run with the -p flag, aa-notify works fine for 100 seconds and then it exits.
I suspect that the issue arises from the following check on line 259 in utils/aa-notify
if debug_logger.debug_level <= 10 and int(time.time()) - start_time > 100:
    debug_logger.debug('Debug mode detected: aborting notification emitter after 100 seconds.')
    sys.exit(0)
together with line 301 in utils/apparmor/common.py which initializes debug_logger.debug_level to logging.DEBUG which has the numerical value 10.
A simple solution might be to just remove the check as I'm not quit sure why one would want aa-notify to exit when run in debug mode in the first place.
Alternatively, one could check against debug_logger.debugging (initialized to False) or change the initialization of debug_logger.debug_level to something else, but I don't know how that would affect other consumers of utils/apparmor/common.py.

For now just add dbugger_logger.debugging as an additional check as the
reason for timing out after 100s during debugging are unclear.

Suggested-by: vicvbcun
Fixes: https://gitlab.com/apparmor/apparmor/-/issues/126
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/660
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Otto Kekäläinen <otto@kekalainen.net>
2020-10-21 16:59:28 -07:00
John Johansen
43eb54d13c utils: split linting with PYFLAKES into a separate target.
This a step towards addressing the linting of the utils causing
problems in a build vs dev environment. See
  https://gitlab.com/apparmor/apparmor/-/issues/121

Split off linting with PYFLAKES into its own target as a step towards
making the running of the lint checks as a configuration option.

https://gitlab.com/apparmor/apparmor/-/merge_requests/662
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2020-10-21 16:55:41 -07:00
John Johansen
38c611ed31 Merge Revert "Merge dnsmasq: Permit access to /proc/self/fd/"
This reverts merge request !628. My reason for this proposal is that commit 88c142c6 already provided this change, something I must have missed when I opened the initial merge request. This resulted in duplicate entries in the profile, something that is also potentially confusing to users or other contributors.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/659
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-19 22:22:23 +00:00
FallenWarrior2k
e0b20a4d2f Revert "Merge dnsmasq: Permit access to /proc/self/fd/"
This reverts merge request !628
2020-10-19 20:29:43 +00:00
John Johansen
89fc65592b Merge Add CAP_CHECKPOINT_RESTORE to severity.db
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/656
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-15 09:48:42 +00:00
Kevin Locke
17cb8f0418 Add Fontmatrix to abstractions/fonts
[Fontmatrix] [adds ~/.Fontmatrix/Activated to fonts.conf].  This causes
programs which use [Fontconfig] (directly or indirectly through
libraries such as [pango]) to include that directory in their font
search path, which causes errors such as:

    audit: type=1400 audit(1602678958.525:53): apparmor="DENIED" operation="open" profile="fr.emersion.Mako" name="/home/username/.Fontmatrix/Activated/.uuid" pid=48553 comm="mako" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000
    audit: type=1400 audit(1602678958.525:54): apparmor="DENIED" operation="open" profile="fr.emersion.Mako" name="/home/username/.Fontmatrix/Activated/" pid=48553 comm="mako" requested_mask="r" denied_mask="r" fsuid=1000 ouid=1000

if the program does not explicitly include this directory in its
AppArmor profile.  As with other common font locations, add
~/.Fontmatrix/Activated to the fonts abstraction for read-only access.

[Fontconfig]: https://gitlab.freedesktop.org/fontconfig/fontconfig
[Fontmatrix]: https://github.com/fontmatrix/fontmatrix
[Pango]: https://pango.gnome.org/
[adds ~/.Fontmatrix/Activated to fonts.conf]: https://github.com/fontmatrix/fontmatrix/blob/75552e2/src/typotek.cpp#L1081-L1088

Signed-off-by: Kevin Locke <kevin@kevinlocke.name>
2020-10-14 19:45:23 -06:00
Christian Boltz
2c2dbdc3a3
Add CAP_CHECKPOINT_RESTORE to severity.db 2020-10-14 14:01:55 +02:00
John Johansen
4a226637f5 translations: update generated pot files
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-14 03:56:38 -07:00
John Johansen
644a473971 parser: Add support for CAP_CHECKPOINT_RESTORE
Linux 5.9 added CAP_CHECKPOINT_RESTORE add it to the set of supported
capabilities.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/654
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2020-10-13 21:30:19 -07:00
John Johansen
71a51fcb18 Merge regression test: Fix regression tests when using in tree parser
When using the in tree parser we should not be using the system parser.conf file, as if the system apparmor is newer than the tree being tested the parser.conf file could contain options not understood by the in tree apparmor_parser.

Use --config-file to specify the default in tree parser.conf

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/653
Acked-by: Steve Beattie <steve.beattie@canonical.com>
2020-10-13 12:01:22 +00:00
John Johansen
1033e19171 regression tests: fix aa_policy_cache to use correct config file
The aa_policy_cache test is using the system parser.conf file even
when the tests are set to use source. This can lead to failures
if the system parser.conf contain options not understood by
the source parser.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/653
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-13 04:49:59 -07:00
John Johansen
5ac368bce7 regression test: Fix regression tests when using in tree parser
When using the in tree parser we should not be using the system
parser.conf file, as if the system apparmor is newer than the
tree being tested the parser.conf file could contain options not
understood by the in tree apparmor_parser.

Use --config-file to specify the default in tree parser.conf

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/653
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-13 04:48:15 -07:00
Mikhail Morfikov
5aa6db68e0 abstractions: mesa - tightens cache location and add fallback
This tightens the cache location in @{HOME}/.cache and also adds
the tmp fallback location.

Currently there are the following entries in the mesa abstraction:

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/91
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-11 05:08:32 -07:00
glitsj16
821f9fe42d profiles: nscd: service fails with apparmor 3.0.0-2 on Arch Linux
After a recent upgrade of apparmor on Arch Linux the nscd systemd service fails to start. Arch Linux has /var/db/nscd and that path is missing from the profile AFAICT.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/651
Fixes: https://gitlab.com/apparmor/apparmor/-/issues/124
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-11 04:50:49 -07:00
John Johansen
40b7019d72 Merge Fix wording of some warnings
pwarn() prints "Warning" itsself, therefore it doesn't make sense to include/repeat that word in the actual warning text.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/650
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-11 11:34:29 +00:00
John Johansen
21060e802a parser: Fix warning message when complain mode is forced
when a profile is being forced to complain a variation of the
following message is displayed

  Warning from /etc/apparmor.d/usr.sbin.sssd (/etc/apparmor.d/usr.sbin.sssd line 54): Warning failed to create cache: usr.sbin.sssd

This is incorrect in that the parser doesn't even try to create the
cache, it just can't cache force complain profiles.

Output a warning message for this case that is correct.

Fixes: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1899218
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/649
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
2020-10-11 03:34:37 -07:00
Christian Boltz
01f5954b5c
Fix wording of some warnings
pwarn() prints "Warning" itsself, therefore it doesn't make sense to
include/repeat that word in the actual warning text.
2020-10-11 12:22:23 +02:00
John Johansen
ec19ff9f72 parser: fix parser.conf commenting on pinning an abi
The comments describing the example rules to pin the abi are wrong.
The comments of the two example rules are swapped resulting in confusion.

While we are at it. Add a reference to the wiki doc on abi, and
how to disable abi warnings without pinning.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/648
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2020-10-09 13:25:49 -07:00
John Johansen
042a75a6a5 Merge Fix dhclient and dhclient-script profiles to work on debian buster
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/645
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-08 06:33:08 +00:00
John Johansen
05acf374b1 Merge aa_status: Fix build issue with musl
add limits.h

aa_status.c:269:22: error: 'PATH_MAX' undeclared (first use in this function); did you mean 'AF_MAX'? | 269 | real_exe = calloc(PATH_MAX + 1, sizeof(char));

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/647
Signed-off-by: Armin Kuster [akuster808@gmail.com](mailto:akuster808@gmail.com)
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-08 06:31:02 +00:00
Armin Kuster
0dbcbee700 parser/Makefile: dont force host cpp to detect reallocarray
In cross build environments, using the hosts cpp gives incorrect
detection of reallocarray. Change cpp to a variable.

fixes:
parser_misc.c: In function 'int capable_add_cap(const char*, int, unsigned int, capability_flags)':
| parser_misc.c:297:37: error: 'reallocarray' was not declared in this scope
|   297 |   tmp = (struct capability_table *) reallocarray(cap_table, sizeof(struct capability_table), cap_table_size+1);

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2020-10-07 20:55:52 -07:00
Bernhard M. Wiedemann
bd1e22ad07 profiles: add pyzorsocket and razorsocket
Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
2020-10-07 20:26:01 +02:00
Bernhard M. Wiedemann
c343f052c0 profiles: add haproxy
Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
2020-10-07 20:26:01 +02:00
Bernhard M. Wiedemann
2eea414c68 profiles: add clamd
Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
2020-10-07 20:26:01 +02:00
Bernhard M. Wiedemann
8319bc5dc7 profiles: Add 3 more dovecot services
Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
2020-10-07 20:26:01 +02:00
Bernhard M. Wiedemann
286f071259 profile: Allow SSL access to freshclam
Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
2020-10-07 20:12:45 +02:00
Bernhard M. Wiedemann
6e908f28d6 profiles: Drop duplicate line
already covered by dovecot-common

Signed-off-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
2020-10-07 20:12:45 +02:00
Armin Kuster
a2a0d14b9c aa_status: Fix build issue with musl
add limits.h

aa_status.c:269:22: error: 'PATH_MAX' undeclared (first use in this function); did you mean 'AF_MAX'?
|   269 |    real_exe = calloc(PATH_MAX + 1, sizeof(char));

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2020-10-07 09:10:43 -07:00
Christian Boltz
17c55b3bf8 Merge branch 'master' into 'master'
apparmor: fix manpage order

See merge request apparmor/apparmor!646

Acked-by: Christian Boltz <apparmor@cboltz.de>
2020-10-07 15:48:28 +00:00
Armin Kuster
37b9028499 apparmor: fix manpage order
It trys to create a symlink before the man pages are installed.

 ln -sf aa-status.8 /(path}/apparmor/3.0-r0/image/usr/share/man/man8/apparmor_status.8
 | ln: failed to create symbolic link '{path}/apparmor/3.0-r0/image/usr/share/man/man8/apparmor_status.8': No such file or directory

...

install -d /{path}/apparmor/3.0-r0/image/usr/share/man/man8 ; install -m 644 aa-status.8 /{path}/apparmor/3.0-r0/image/usr/share/man/man8;

Signed-off-by: Armin Kuster <akuster808@gmail.com>
2020-10-07 06:30:33 -07:00