2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-31 14:25:52 +00:00

Compare commits

...

178 Commits

Author SHA1 Message Date
John Johansen
b51a2d271d Prepare for AppArmor 2.13.7 release
- update version file

Signed-off-by: John Johansen <john.johansen@canonical.com>
2022-11-21 15:34:09 -08:00
Christian Ehrhardt
f8286feada Allow access to possible cpus for glibc-2.36
Glibc in 2.36 and later will [1] access sysfs at
/sys/devices/system/cpu/possible when usig sysconf
for _SC_NPROCESSORS_CONF.

That will make a lot of different code, for example
anything linked against libnuma, trigger this apparmor
denial.

  apparmor="DENIED" operation="open" class="file" ...
  name="/sys/devices/system/cpu/possible" ...
  requested_mask="r" denied_mask="r" fsuid=0 ouid=0

This entry seems rather safe, and it follows others
that are already in place. Instead of fixing each
software individually this should go into the base
profile as well.

Initially reported via
https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1989073
Fixes: https://gitlab.com/apparmor/apparmor/-/issues/267
MR: none - ML
Signed-off-by: Christian Ehrhardt <christian.ehrhardt@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit c159d0925a)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2022-11-14 21:48:08 -08:00
John Johansen
5700ff9e40 Merge syslog-ng: allow reading *.journal in flatter directory structure
On openSUSE Leap 15.4 (and probably also 15.3), the journal lives in
/var/log/journal/*.journal - without an additional subdirectory level.

I propose this patch for 2.13..master.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/932
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
(cherry picked from commit e049b31c04)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2022-10-28 06:02:47 -07:00
Christian Boltz
ee0ae96566 Merge [2.13+3.0] Use string startswith() and endswith() methods
... instead of slicing to check for prefixes and suffixes.

This change prevents a crash in aa-mergeprof - if `replacement` is empty,
trying to access `replacement[0]` causes an IndexError.
Using `.startswith()` works without crashing.

This backports parts of the severity.py changes in
commit 091c6ad59d
by Mark Grassi.

I propose this fix for 2.13 and 3.0. (3.1 and master already have this fix.)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/931
Approved-by: Jon Tourville <jon.tourville@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>


(cherry picked from commit 7ebb259610)

e1714b96 Use string startswith() and endswith() methods
2022-10-11 16:18:43 +00:00
John Johansen
67e7b302a4 Merge dnsmasq: Add missing r permissions for libvirt_leaseshelper
Note: This was reported for /usr/libexec/libvirt_leaseshelper, but since
this is probably unrelated to the path or a path change, this commit
also adds r permissions for the previous path.

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1202161

I propose this patch for 3.0 and master (optionally also for 2.12 and 2.13 - please tell me if you want that after reviewing the patch, or just merge ;-)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/905
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>


(cherry picked from commit f51049ea2e)

c9c5208f dnsmasq: Add missing r permissions for libvirt_leaseshelper
2022-08-22 21:52:43 +00:00
John Johansen
157c8ee36a Merge [2.11..2.13] Add 'mctp' network domain keyword [only to utils]
Reported as comment on https://build.opensuse.org/request/show/951354
(update to glibc 2.35)

This is a partial backport of
https://gitlab.com/apparmor/apparmor/-/merge_requests/832

I propose this patch for 2.11, 2.12 and 2.13.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/911
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2022-08-22 21:44:14 +00:00
Christian Boltz
d62b5a9a7d Add 'mctp' network domain keyword [only to utils]
Reported as comment on https://build.opensuse.org/request/show/951354
(update to glibc 2.35)

This is a partial backport of
https://gitlab.com/apparmor/apparmor/-/merge_requests/832
2022-08-22 23:32:29 +02:00
John Johansen
3c047517a4 Merge [2.11..2.13] Support setuptools >= 61.2 in Python tests
Fix for #253, by mirroring the change from 1c23f5e1e4

On top of that, fix setuptools version detection in buildpath.py. libraries/libapparmor/swig/python/test/buildpath.py: The changes introduced in cc7f549665 targetted a wrong setuptools version (61.2). The change in build directory naming has been introduced with 62.0.

Fixes #259 Fixes #39

The first 3 commits are based on https://gitlab.com/apparmor/apparmor/-/merge_requests/897, the other two come from https://gitlab.com/apparmor/apparmor/-/merge_requests/904. Since there are several differences between 2.13 and >= 3.0, I had to adjust the patches at several places.

I propose this MR for 2.11, 2.12 and 2.13.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/910
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2022-08-22 21:31:33 +00:00
David Runge
9fff1c5c6a Use basepath.py in profiles Makefile
profiles/Makefile:
Set PYTHON_DIST_BUILD_PATH using
libraries/libapparmor/swig/python/test/buildpath.py as it solves the
problem of setting the build directory generically.

(cherry picked from commit 1ff0c2c7d6,
 adjusted to 2.13 which used a different python command before)
2022-08-22 22:24:21 +02:00
David Runge
d415e48646 Fix setuptools version detection in buildpath.py
libraries/libapparmor/swig/python/test/buildpath.py:
The changes introduced in
cc7f549665
targetted a wrong setuptools version (61.2).
The change in build directory naming has been introduced with 62.1
(1c23f5e1e4).

(cherry picked from commit fda390983f)
2022-08-22 22:22:40 +02:00
Ben Greiner
63751d20e2 reviewed edits
(cherry picked from commit d442584a0a)
2022-08-22 22:21:11 +02:00
Christian Boltz
411249b3b5 add setuptools to test-utils CI job
This is based on 85734c3bac, but the
.gitlab-ci.yml (and therefore also this patch) is completely different
in 2.13.
2022-08-22 22:19:22 +02:00
Ben Greiner
8921644ab4 use new build_platlib path with setuptools >= 61.2
(cherry picked from commit 47d68dac0f,
 adjusted to the 2.13 branch which used slightly different python
 commands. Also, utils/test/README.md doesn't exist in 2.13, therefore
 drop the part that changes it)
2022-08-22 22:16:09 +02:00
Christian Boltz
fd1b463643 Merge [2.11..2.13] Grep away deprecation warning for distutils
... which will be removed in Python 3.12, and that probably won't be
used on systems running the AppArmor 2.1x branches.

This prevents CI failures on gitlab.com, which uses a new-enough python
to show

    DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives

For 3.0 and master, the proper fix (switching to setuptools) was done in
!813.

I propose this patch for 2.11, 2.12 and 2.13.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/908
Approved-by: John Johansen <john@jjmx.net>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2022-08-22 20:02:46 +00:00
Christian Boltz
ca3e5be507 Grep away deprecation warning for distutils
... which will be removed in Python 3.12, and that probably won't be
used on systems running the AppArmor 2.1x branches.

This prevents CI failures on gitlab.com, which uses a new-enough python
to show

    DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives

For 3.0 and master, the proper fix (switching to setuptools) was done in
!813.
2022-08-16 23:24:44 +02:00
Christian Boltz
37d938b815 Merge Set (instead of compare) exresult
Interestingly this accidentally worked because `if exresult` is true for
both a non-empty string ("PASS") as well as a real `True` value.

Found by Mark Grassi as part of
https://gitlab.com/apparmor/apparmor/-/merge_requests/906

I propose this patch for all branches.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/907
Approved-by: Jon Tourville <jon.tourville@canonical.com>
Merged-by: Christian Boltz <apparmor@cboltz.de>


(cherry picked from commit c06ea77445)

5a2fb856 Set (instead of compare) exresult
2022-08-16 19:27:04 +00:00
John Johansen
3f4e97e228 Merge Update for the mesa abstraction
I noticed that some apps return the following errors when launched:

```
  kernel: audit: type=1400 audit(1651244478.255:5501): apparmor="DENIED" operation="open" profile="some_app" name="/sys/devices/pci0000:00/0000:00:02.0/revision" pid=1877976 comm="some_app" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
  kernel: audit: type=1400 audit(1651244478.255:5502): apparmor="DENIED" operation="open" profile="some_app" name="/sys/devices/pci0000:00/0000:00:02.0/config" pid=1877976 comm="some_app" requested_mask="r" denied_mask="r" fsuid=1000 ouid=0
```

Blocking the files results in the following errors when the app is executed in a terminal:

```
  MESA: error: Failed to query drm device.
  libGL error: failed to create dri screen
  libGL error: failed to load driver: crocus
  MESA: error: Failed to query drm device.
  libGL error: failed to create dri screen
  libGL error: failed to load driver: crocus
```

Since they have something to do with MESA, I think the mesa abstraction should
be updated to fix the issue.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/879
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2022-05-23 15:37:14 -07:00
John Johansen
7e6df95729 Merge profiles: update snap_browsers permissions
The snap_browsers abstraction requires more permissions
due to updates on snaps.

Some of the permissions are not required in older versions of
Ubuntu that use 2.12 and 2.13, but are introduced for unification
and ease of maintenance purposes. These include:
```
    all dbus permissions,
    @{PROC}/sys/kernel/random/uuid r,
    owner @{PROC}/@{pid}/cgroup r,
    /var/lib/snapd/sequence/{chromium,firefox,opera}.json r,
```

I also propose a cherry-pick of this commit to 2.12, 2.13 and 3.0

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/877
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
(cherry picked from commit bfa67b369d)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2022-04-19 11:38:07 -07:00
Christian Boltz
1a3b81857a Merge Allow dovecot to use all signals
similar to commit 2f9d172c64
we discovered that there was a service outage
when dovecot tried to send a usr1 signal

type=AVC msg=audit(1648024138.249:184964): apparmor="DENIED" operation="signal" profile="dovecot" pid=1690 comm="dovecot" requested_mask="send" denied_mask="send" signal=usr1 peer="dovecot-imap-login"

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/865
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Christian Boltz <apparmor@cboltz.de>


(cherry picked from commit 83685ba703)

f0919f83 Allow dovecot to use all signals
2022-03-25 20:53:20 +00:00
Georgia Garcia
e3371f871f add snap-browsers profile
Whenever the evince deb package tries to open a snap browser which was
selected as the default, we get the following denial:

audit[2110]: AVC apparmor="DENIED" operation="exec" profile="/usr/bin/evince" name="/usr/bin/snap" pid=2110 comm="env" requested_mask="x" denied_mask="x" fsuid=1000 ouid=0

As a short-term solution, we are adding a snap-browsers profile
which restricts what snaps opened by evince can do.
The long-term solution is currently not available, but could be
accomplished by using enhanced environment variable filtering/mediation
and delegation of open fds.

Bug: https://launchpad.net/bugs/1794064

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
(cherry picked from commit fb3283f37e)
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/863
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2022-03-17 09:42:07 -03:00
John Johansen
2d6380c26a Merge smbd, samba-bgqd: allow reading openssl.cnf
References: https://bugzilla.opensuse.org/show_bug.cgi?id=1195463#c10

I propose this patch for 3.0 and master. (<= 2.13 don't have the samba-bgpd profile - if we want to backport to 2.x, we'll have to pick only the smbd part.)

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1195463#c10
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/862
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>

backport: drop ../profiles/apparmor.d/samba-bgqd
(cherry picked from commit c3f64513f2)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2022-03-13 08:13:00 -07:00
John Johansen
5f3f4ba087 Merge [2.x..3.0] aa-remove-unknown: abort on parser failure
If apparmor_parser -N (in profiles_names_list()) fails,
aa-remove-unknown possibly gets an incomplete list of profiles in
/etc/apparmor.d/ and therefore might remove more profiles than it
should.

Replace the profiles_names_list() call with a direct apparmor_parser
call, and abort aa-remove-unknown if it exits with $? != 0

Before:
```
aa-remove-unknown -n
AppArmor parser error for /etc/apparmor.d/broken in profile /etc/apparmor.d/broken at line 1: syntax error, unexpected TOK_ID, expecting TOK_OPEN
Would remove 'delete_me'
```

After:
```
./aa-remove-unknown -n
AppArmor parser error for /etc/apparmor.d in profile /etc/apparmor.d/zbroken at line 1: syntax error, unexpected TOK_ID, expecting TOK_OPEN
apparmor_parser exited with failure, aborting.
```

And of course, after fixing the broken profile:
```
./aa-remove-unknown -n
Would remove 'delete_me'
```

(cherry picked from commit 5053a01d84)

This backports the fix in `aa-remove-unknown` from !836, but doesn't backport the cleanup in `rc.apparmor.functions`.

I propose this patch for 3.0 and all 2.x branches.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/859
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
(cherry picked from commit c6324c2a3e)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2022-03-09 16:56:16 -08:00
John Johansen
4540cb2f50 libapparmor: fix building with link time optimization (lto)
Currently libapparmor fails to build when lto is used because it uses
the asm directive to provide different version of some symbols.
Unfortunately gcc does not recognize this and the symbols defined by
asm are lost and optimized out by lto and then the link fails.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/214
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/831
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 7cde91f57f)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2022-02-04 15:51:28 -08:00
John Johansen
3cdfe944ac Merge Fix: Opening links with Chrome
Permission denied when Evince tries to use Chrome to open link.

In config is missing the bin: `/opt/google/chrome/crashpad_handler`.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/830
Acked-by: John Johansen <john@jjmx.net>
(cherry picked from commit 08f32ac703)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2022-02-04 02:18:41 -08:00
John Johansen
15e5b5c459 Merge abstractions/openssl: allow /etc/ssl/{engdef,engines}.d/
These directories were introduced in openssl in https://patchwork.ozlabs.org/project/openwrt/patch/20210429153530.10020-2-cotequeiroz@gmail.com/

I propose this patch for 3.0 and master. Optionally also for older branches, even if it's unlikely that systems using 2.13.x or older get a new-enough openssl to need this ;-)

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/818
Acked-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 2b270216aa)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2022-01-17 12:10:18 -08:00
John Johansen
3da24e0116 Merge Add missing /proc permissions to avahi-daemon profile
Fixes: https://gitlab.com/apparmor/apparmor/-/issues/203

MR:https://gitlab.com/apparmor/apparmor/-/merge_requests/811
Acked-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit ee9e61aad2)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-10-30 02:18:48 -07:00
Christian Boltz
be8ab7d538 Merge branch 'fix-lexer' into 'master'
parser: Fix unknown state condition RLIMIT_MODEINCLDE

See merge request apparmor/apparmor!803

Acked-by: Christian Boltz for all branches

(cherry picked from commit b0bc0d5323)

dc7755e5 parser: Fix unknown state condition RLIMIT_MODEINCLDE
2021-09-24 11:26:55 +00:00
Steve Beattie
b469e1f3e8 utils: Add new python versions to logprof.conf
Adding everything up to 3.19 should make the file future-proof for a
while ;-)

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/193
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/795
Acked-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 4559a2997c)
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
2021-08-26 10:55:00 -07:00
Christian Boltz
2993533d61 Merge branch 'fix-video-abstraction' into 'master'
add a missing slash at the end of the sys rule

See merge request apparmor/apparmor!791

Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.12..master

(cherry picked from commit 4fd7bcc289)

b3dcd02d add a missing slash at the end of the sys rule
2021-08-20 18:16:32 +00:00
Christian Boltz
5d7b35d30d Merge branch 'cboltz-typo' into 'master'
Fix typo in manpage

Closes #192

See merge request apparmor/apparmor!789

Acked-by: Acked-by: Seth Arnold <seth.arnold@canonical.com> for all branches

(cherry picked from commit 131ae8425b)

1459f49b Fix typo in manpage
2021-08-17 18:26:30 +00:00
John Johansen
2686a0af6c Merge Update abstractions/python and profiles for python 3.10
Add support for python 3.10 in abstractions and profiles.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/187
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/783
Acked-by: John Johansen <john.johansen@canonical.com>
(backported from commit 31fda3eee7)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-08-13 13:37:06 -07:00
John Johansen
9de934c3e7 Merge allow Prometheus metrics end-point in dovecot/stats
Patch by Michael Ströder <michael@stroeder.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/776
Acked-by: John Johansen <john@jjmx.net>
(cherry picked from commit d8ec3dafb7)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-07-21 12:30:15 -07:00
John Johansen
701943948c parser: fix cache time stamp check to include dir time stamps
Currently for directory includes the directory timestamp is ignored.
This is wrong as operations like removing a file from the dir won't
be considered in the timestamp check.

Fix this by updating the timestamp check to include the included
directories timestamp.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/760
Signed-off-by: John Johansen <john@jjmx.net>
Acked-by: Georgia Garcia  <georgia.garcia@canonical.com>
(cherry picked from commit 3d1232e640)
2021-07-13 18:44:04 -07:00
Georgia Garcia
47bb1a31b0 tests: fix i18n.sh regression test on arm64
The following errors are happening on the regression tests
of i18n.sh on arm64 hirsute/impish:

Error: open failed. Test 'i18n (194) OPEN (octal) "/tmp/sdtest.3654-6536-J2ZwFM/file__post" RW' was expected to 'pass'. Reason for failure 'FAIL: open /tmp/sdtest.3654-6536-J2ZwFM/file__post failed - Permission denied'
...

The cause is a bash bug handling UTF-8 on subshells.

Fixes: https://bugs.launchpad.net/apparmor/+bug/1932331
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/765

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 458a981b62)
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2021-06-28 15:49:46 -03:00
Christian Boltz
898c2cda7a abstractions/php: support PHP 8
Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1186267
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/755
(cherry picked from commit 5853f52233)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-05-24 03:11:42 -07:00
John Johansen
14ed051657 profiles: dhclient: allow setting task comm name
dhclient wants to set its thread names to functional names for
introspection purposes. Eg.

$ pstree -at 3395
dhclient ens3
  ├─{isc-socket}
  ├─{isc-timer}
  └─{isc-worker0000}

When denied this can result in dhclient breaking and failing to obtain
IPv4 addresses.

Fixes: https://bugs.launchpad.net/ubuntu/+source/isc-dhcp/+bug/1918410
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
(cherry picked from commit c734839551)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-03-31 03:02:21 -07:00
John Johansen
8e04e39b7c Merge look up python-config using AC_PATH_TOOL
Doing so adds the $ac_tool_prefix during cross compilation and will end up using the correct, architecture-dependent python-config.

This is the second and last upstreamable change from https://bugs.debian.org/984582. It looks a little simpler here, because apparmor evolved upstream compared to the Debian version. Fortunately, it got a lot simpler in the process.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/729
Acked-by: John Johansen <john.johansen@canonical.com>
(debian version of commit c32c970d00)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-03-20 03:35:06 -07:00
John Johansen
552ee5d621 Merge Do not abuse AC_CHECK_FILE
AC_CHECK_FILE is meant to check for host files and therefore fails hard during cross compilation unless one supplies a cached check result. Here we want to know about the presence of a build system file though, so AC_CHECK_FILE is the wrong tool.

This is part of https://bugs.debian.org/984582.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/728
Acked-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit f17143b5c3)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-03-20 03:13:50 -07:00
John Johansen
c8e57213f9 profiles: dhcpd: add rule for port_range
The following AppArmor denial errors are shown on startup:

Oct 25 00:52:00 xxx kernel: [  556.231990] audit: type=1400 audit(1603601520.710:32): apparmor="DENIED" operation="open" profile="/usr/sbin/dhcpd" name="/proc/sys/net/ipv4/ip_local_port_range" pid=1982 comm="dhcpd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

Oct 25 00:52:00 xxx kernel: [  556.232257] audit: type=1400 audit(1603601520.710:33): apparmor="DENIED" operation="open" profile="/usr/sbin/dhcpd" name="/proc/sys/net/ipv4/ip_local_port_range" pid=1982 comm="dhcpd" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

Fixes: https://bugs.launchpad.net/bugs/1901373
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/726
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 277677daf3)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-03-15 23:58:50 -07:00
John Johansen
44e6f90f23 parser: fix filter slashes for link targets
The parser is failing to properly filter the slashes in the link name
after variable expansion. Causing match failures when multiple slashes
occur.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/153
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/723
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 2852e1ecdf)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-03-15 00:53:06 -07:00
Mikhail Morfikov
dd03484866 abstractions: Add missing rule in wutmp abstraction
Currently the wutmp abstraction has the following rules:
  /var/log/lastlog  rwk,
  /var/log/wtmp     wk,
  @{run}/utmp       rwk,

According to what I see in my apparmor profiles, just a few apps want
to interact with the files listed above, especially with the
/var/log/wtmp . But when the apps do this, they sometimes want the
read access to this file. An example could be the last command. Is
there any reason for not having the r in the rule?  The second thing
is the file /var/log/btmp (which isn't included in the
abstracion). Whenever I see an app, which wants to access the
/var/log/wtmp file, it also tries to interact with the /var/log/btmp
file, for instance lightdm/sddm or su . Most of the time they need
just wk permissions, but sometimes apps need also r on this file, an
example could be the lastb command, which is just a link to last.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/152
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/724
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit d4e0a94511)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-03-14 11:55:27 -07:00
John Johansen
00396b8f13 parser: fix backport of MR700
The backport of
  855dbd4a parser: fix rule downgrade for unix rules

using the rule_t::warn_once which doesn't exist in the 2.x parser
series. Switch this the the static function warn_once.

Fixes: 3d85e123 parser: fix rule downgrade for unix rules
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-03-14 09:02:27 -07:00
John Johansen
3d85e1234a parser: fix rule downgrade for unix rules
Rule downgrades are used to provide some confinement when a feature
is only partially supported by the kernel.

  Eg. On a kernel that doesn't support fine grained af_unix mediation
      but does support network mediation.

        unix (connect, receive, send)
              type=stream
              peer=(addr="@/tmp/.ICE-unix/[0-9]*"),

      will be downgraded to

        network unix type=stream,

Which while more permissive still provides some mediation while
allowing the appication to still function. However making the rule
a deny rule result in tightening the profile.

  Eg.
        deny unix (connect, receive, send)
              type=stream
              peer=(addr="@/tmp/.ICE-unix/[0-9]*"),

      will be downgraded to

        deny network unix type=stream,

and that deny rule will take priority over any allow rule. Which means
that if the profile also had unix allow rules they will get blocked by
the downgraded deny rule, because deny rules have a higher priority,
and the application will break. Even worse there is no way to add the
functionality back to the profile without deleting the offending deny
rule.

To fix this we drop deny rules that can't be downgraded in a way that
won't break the application.

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1180766
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/700
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 855dbd4ac8)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-03-14 07:19:16 -07:00
Rose Kunkel
4c8ac78605 Fix nscd conflict with systemd-homed
My main user account is managed by systemd-homed. When I enable
AppArmor and have nscd running, I get inconsistent behavior with my
user account - sometimes I can't log in, sometimes I can log in but
not use sudo, etc.

This is the output of getent passwd:
  $ getent passwd
  root0:0::/root:/usr/bin/zsh
  bin1:1::/:/sbin/nologin
  daemon2:2::/:/sbin/nologin
  mail8:12::/var/spool/mail:/sbin/nologin
  ftp14:11::/srv/ftp:/sbin/nologin
  http33:33::/srv/http:/sbin/nologin
  nobody65534:65534:Nobody:/:/sbin/nologin
  dbus81:81:System Message Bus:/:/sbin/nologin
  [...]
  rose1000:1000:Rose Kunkel:/home/rose:/usr/bin/zsh

But getent passwd rose and getent passwd 1000 both return no output.
Stopping nscd.service fixes these problems. Checking the apparmor
logs, I noticed that nscd was denied access to
/etc/machine-id. Allowing access to that file seems to have fixed the
issue.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/707
Fixes: https://gitlab.com/apparmor/apparmor/-/issues/145
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit ee5303c8a0)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-02-11 22:56:09 -08:00
Seth Arnold
17032f2254 profiles: firefox Add support for widevine DRM
Ubuntu 18.04, Firefox 60.0.1+build2-0ubuntu0.18.04.1

Running firefix, then going to netflix.com and attempting to play a
movie. The widevinecdm plugin crashes, the following is found in
syslog:

Jun 15 19:13:22 xplt kernel: [301351.553043] audit: type=1400 audit(1529046802.585:246): apparmor="DENIED" operation="file_mmap" profile="/usr/lib/firefox/firefox{,*[^s][^h]}" name="/home/xav/.mozilla/firefox/wiavokxk.default-1510977878171/gmp-widevinecdm/1.4.8.1008/libwidevinecdm.so" pid=16118 comm="plugin-containe" requested_mask="m" denied_mask="m" fsuid=1000 ouid=1000
Jun 15 19:13:22 xplt kernel: [301351.553236] audit: type=1400 audit(1529046802.585:247): apparmor="DENIED" operation="ptrace" profile="/usr/lib/firefox/firefox{,*[^s][^h]}" pid=24714 comm="firefox" requested_mask="trace" denied_mask="trace" peer="/usr/lib/firefox/firefox{,*[^s][^h]}"
Jun 15 19:13:22 xplt kernel: [301351.553259] plugin-containe[16118]: segfault at 0 ip 00007fcdfdaa76af sp 00007ffc1ff03e28 error 6 in libxul.so[7fcdfb77a000+6111000]
Jun 15 19:13:22 xplt snmpd[2334]: error on subcontainer 'ia_addr' insert
...

Fixes: https://bugs.launchpad.net/ubuntu/+source/firefox/+bug/1777070
Reported-by: Xav Paice <xav.paice@canonical.com>
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/684
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 656f2103ed)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2021-02-11 19:40:38 -08:00
John Johansen
de784f55d3 parser: fix --jobs so job scaling is applied correctly
job scaling allows the parser to resample the number of cpus available
and increase the number of jobs that can be launched if cpu available
increases.

Unfortunately job scaling was being applied even when a fixed number
of jobs was specified. So
  --jobs=2

doesn't actually clamp the compile at 2 jobs.

Instead job scaling should only be applied when --jobs=auto or when
jobs are set to a multiple of the cpus.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/703
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 65ba20b955)
2021-02-10 19:20:27 -08:00
Steve Beattie
ad0a6ac6bf profiles: add new deny path for kwallet (used in KDE 5)
Reported on IRC by finalspacevoid

Acked-by: Steve Beattie <steve@nxnw.org>
Merge branch 'cboltz-kwallet-path' into 'master'
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/704

(cherry picked from commit 15e897cad0)
(Fixed up conflict due to 2.13 not containing the include rule for
 abstractions/private-files-strict.d/)
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
2021-02-07 22:04:03 -08:00
Christian Boltz
95aa5b5895 apparmor.vim: add support for abi rules
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/690
(cherry picked from commit c421fcd38a)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-12-11 14:56:00 -08:00
John Johansen
c16fff8cb4 Release: Bump revisions for 2.13.6 release
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-12-07 03:27:44 -08:00
Christian Boltz
2db3d94ce2 aa-autodep: load abstractions on start
So far, aa-autodep "accidently" loaded the abstractions when parsing the
existing profiles. Obviously, this only worked if there is at least one
profile in the active or extra profile directory.

Without any existing profiles, aa-autodep crashed with
KeyError: '/tmp/apparmor.d/abstractions/base'

Prevent this crash by explicitely loading the abstractions on start.

Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1178527#c1 [1]
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/682
(cherry picked from commit f6b3de7116)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-11-28 05:13:51 -08:00
Christian Boltz
b174705a31 abstractions/X: Allow (only) reading X compose cache
... (/var/cache/libx11/compose/*), and deny any write attempts

Reported by darix,
https://git.nordisch.org/darix/apparmor-profiles-nordisch/-/blob/master/apparmor.d/teams

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/685
(cherry picked from commit 78bd811e2a)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-11-17 02:07:11 -08:00
John Johansen
56cc87aace Merge [2.13] Check hotkey conflicts case-insensitive
This is needed to catch conflicts between uppercase and lowercase hotkeys of the same letter, as seen with `(B)enannt` and `A(b)lehnen` in the german utils translations.

(cherry picked from commit 07bd11390e)

Also fix hotkey conflict in utils id.po and sv.po (cherry picked from commit 7cf54f2cd8)

Note that 7cf54f2cd8 also included fixes for de.po which are not needed in the 2.13 branch.

This is the 2.13 variant of MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/675.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/678
Acked-by: John Johansen <john.johansen@canonical.com>
2020-11-03 09:43:39 +00:00
Christian Boltz
ca0d9f758b Fix hotkey conflict in utils id.po and sv.po
(cherry picked from commit 7cf54f2cd8)

Note that 7cf54f2cd8 also included fixes
for de.po which are not needed in the 2.13 branch.
2020-11-01 22:58:19 +01:00
Christian Boltz
a606a59d96 Check hotkey conflicts case-insensitive
This is needed to catch conflicts between uppercase and lowercase
hotkeys of the same letter, as seen with `(B)enannt` and `A(b)lehnen` in
the german utils translations.

(cherry picked from commit 07bd11390e)
2020-11-01 22:39:49 +01:00
John Johansen
6a8a5de637 Merge dovecot: backport usr.lib.dovecot.script-login to 2.13
Backport profile to fix denials in Debian Buster+Bullseye.

Add hashes for #include's, remove abi specification.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/672
Acked-by: Christian Boltz <apparmor@cboltz.de>
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-27 20:56:09 +00:00
Vincas Dargis
1bcf85737b dovecot: backport usr.lib.dovecot.script-login to 2.13
Backport profile to fix denials in Debian Buster+Bullseye.

Add hashes for #include's, remove abi specification.
2020-10-27 21:14:37 +02:00
Vincas Dargis
ea55ef22e7 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.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/671
(cherry picked from commit 9d8e111abe)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-26 15:20:31 -07:00
Vincas Dargis
dc3e2c39fb 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.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/671
(cherry picked from commit 2f9d172c64)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-26 15:20:14 -07:00
John Johansen
1335b80ff4 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>
(backported from commit 15dc06248c)
2020-10-25 01:44:11 -07:00
John Johansen
1808d14e35 Merge Fix 2.13 libapparmor so version
ab0f4ab2ed increased `AA_LIB_REVISION` and `AA_LIB_AGE`, with the result that 2.13.5 builds `libapparmor.so.0.7.3`, while 2.13.4 had `libapparmor-1.6.2`

This patch reverts the `AA_LIB_AGE` increase to fix the so name so that we'll get `libapparmor-1.6.3`.

Note: If you want to apply this fix on top of the 2.13.5 tarball, you'll need to also apply the patch to `Makefile.in`.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/658
Acked-by: John Johansen <john.johansen@canonical.com>
2020-10-20 10:39:27 +00:00
Christian Boltz
145136f604 Fix 2.13 libapparmor so version
ab0f4ab2ed increased AA_LIB_REVISION and
AA_LIB_AGE, with the result that 2.13.5 builds libapparmor.so.0.7.3,
while 2.13.4 had libapparmor-1.6.2

This patch reverts the AA_LIB_AGE increase to fix the so name so that
we'll get libapparmor-1.6.3.

Note: If you want to apply this fix on top of the 2.13.5 tarball, you'll
need to also apply the patch to Makefile.in.
2020-10-17 17:30:39 +02:00
John Johansen
ab0f4ab2ed Release: Bump revisions for 2.13.5 release
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-15 03:14:22 -07:00
John Johansen
5c47e448b4 libapparmor: Bump revision in preparation for release.
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-15 03:03:58 -07:00
Christian Boltz
72f97a98e7 Add CAP_CHECKPOINT_RESTORE to severity.db
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/656
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 2c2dbdc3a3)
2020-10-15 03:03:58 -07:00
John Johansen
726c3fc129 parser: Make sure apparmor can build on old kernels
With the backport of static caps to support caps from newer kernels
in older build environments. Builds against older kernels broke
because not all of the newer capabilities are defined in the kernel
headers, nor in apparmor.

In particular

CAP_AUDIT_READ was added to the kernel in 3.16

and

CAP_AUDIT_WRITE, CAP_AUDIT_CONTROL, CAP_SETFCAP, CAP_MAC_OVERRIDE,
CAP_MAC_ADMIN, CAP_SYSLOG, CAP_WAKE_ALARM, CAP_BLOCK_SUSPEND in 3.8

The apparmor kernel module was merge into the upstream kernel in 2.6.36.
In order to support all upstream kernels with apparmor add the set
of capabilities introduced since apparmor was merged upstream.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/655
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
2020-10-14 15:05:04 -07:00
John Johansen
be05b4497f translations: update generated pot files
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-14 03:50:46 -07:00
John Johansen
fac184d923 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>
(backported from commit 644a473971)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-13 21:44:47 -07:00
Steve Beattie
a090a6377b socketpair regression test: add aa_getpeercon() enabled perm
Because of the need to be stacking LSM aware, aa_getpeercon() calls
aa_enable to ensure that apparmor is enabled. Without the permission,
aa_getpeercon() fails, causing test failures.

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit fb773fec36)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-13 05:15:57 -07:00
John Johansen
4527abd028 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>
(cherry picked from commit 1033e19171)
2020-10-13 05:07:28 -07:00
John Johansen
350b4a5358 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>
(cherry picked from commit 5ac368bce7)
2020-10-13 05:07:23 -07:00
Steve Beattie
3f8cfac384 parser/Makefile: fix generated cap comparison against known list
The sed command to manipulate the known cap list (base_cap_names.h) into
a format to match the generated_cap_names.h was buggy because the
trailing '}' would never match anything, leading to failures when built
against 5.8 kernel headers, due to it not replacing the base capabilities
correctly.

Fix this by removing the trailing '}" match and instead match the third
comma-delimited field that matches a capability name, and replace that.

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/596
(cherry picked from commit a7fc8bb500)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-13 03:00:53 -07:00
John Johansen
054079b271 parser: call filter slashes for mount conditionals
The mnt_point and devices conditionals in mount rules are generally
paths and should have slashes filtered after variable expansion.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/607
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit a1978fb1b2)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-09 02:44:50 -07:00
John Johansen
f6eb8553dc parser: call filter slashes for the dbus path conditional
Similar to unix addr rules, the dbus path conditional is more a path
than a profile name and should get its slashes filtered after variable
expansion.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/607
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 35f6d49ec6)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-09 02:44:50 -07:00
John Johansen
8b5e4a45a9 parser: enable variable expansion for mount type= and options=
Currently mount options type= and options= do not expand variables
but they should. Fix it.

Note: this does not treat either as paths because their use is
too device dependent for it to be safe to filter slashes.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/99
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/638
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 882380ad3d)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-09 02:44:50 -07:00
Patrick Steinhardt
8771cff94b libapparmor: add missing include for socklen_t
While `include/sys/apparmor.h` makes use of `socklen_t`, it doesn't
include the `<sys/socket.h>` header to make its declaration available.
While this works on systems using glibc via transitive includes, it
breaks compilation on musl libc.

Fix the issue by including the header.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
(cherry picked from commit 47263a3a74)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-10-03 13:21:32 -07:00
Patrick Steinhardt
351014c3f6 libapparmor: add _aa_asprintf to private symbols
While `_aa_asprintf` is supposed to be of private visibility, it's used
by apparmor_parser and thus required to be visible when linking. This
commit thus adds it to the list of private symbols to make it available
for linking in apparmor_parser.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/643
Signed-off-by: Patrick Steinhardt <ps@pks.im>
(cherry picked from commit 9a8fee6bf1)
2020-10-03 12:24:40 -07:00
John Johansen
903e743b87 parser: Fix expansion of variables in unix rules addr= conditional
The parser is not treating unix addr as a path and filtering slashes
after variable expansion. This can lead to errors where

@{foo}=/a/
unix bind addr=@{foo}/bar,

will always fail because addr is being matched as /a//bar instead of
/a/bar.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/607
Fixes: https://bugs.launchpad.net/apparmor/+bug/1856738
Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 6af05006d9)
2020-09-29 12:00:40 -07:00
John Johansen
7a7c7fb346 regression tests: Don't build syscall_sysctl if missing kernel headers
sys/sysctl.h is not guaranteed to exist anymore since
https://sourceware.org/pipermail/glibc-cvs/2020q2/069366.html

which is a follow on to the kernel commit
61a47c1ad3a4 sysctl: Remove the sysctl system call

While the syscall_sysctl currently checks if the kernel supports
sysctrs before running the tests. The tests can't even build if the
kernel headers don't have the sysctl defines.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/119
Fixes: https://bugs.launchpad.net/apparmor/+bug/1897288
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/637
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 2e5a266eb7)
2020-09-29 11:55:36 -07:00
John Johansen
58e4e8169c parser: Fix automatic adding of rule for change_hat interface
The parser is supposed to add a rule to profiles if they are a hat
or contain hats granting write access to the kernel interfaces
used to perform the change_hat operation.

Unfortunately the check is broken and currently won't add the
rule to hats (it does add it for the parent).

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/625
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Acked-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 5b850c154f)
2020-09-17 15:04:24 -07:00
John Johansen
4cab2dbc17 Merge [2.13] Refresh postfix profiles
Refresh the postfix profiles in the 2.13 branch with (mostly) all changes in master.

The most important changes are:

* support having the `postfix/*` binaries in `/usr/lib/postfix/bin/` (like for example openSUSE has now)
* add profile names
* rename the profile files to `postfix-*`
* several "smaller" changes (especially added permissions), see the individual commits for all details

Note that some changes were not backported to the 2.13 branch:

* adding abi rules
* changing `#include` to `include`
* removal of "superfluous" rules covered by abstractions (dd4903efc6)
* removal of `peer=/usr/lib/postfix/...` rules

20/20 Revert renaming usr.lib.postfix.* to postfix.* in 2.13 branch
19/20 postfix-master: allow access to postlog socket
18/20 Allow to read icu *.dat files in postfix-related profiles
17/20 postfix/master needs to execute postfix/error
16/20 Add several permissions to the postfix.* profiles
15/20 adjust postfix profiles for openSUSE path
14/20 profiles/postfix-smtpd: Include ssl_certs, ssl_keys
13/20 profiles/postdrop: Allow reading from pickup socket
12/20 profiles/postfix-pickup: Allow reading from cleanup socket
11/20 postfix.local: Minor adjustments to make it work
10/20 postfix.*: Adapt for new queue names, and extra locking and r/w communication
9/20 postfix.tlsmgr: Connect to urandom and prng exchange
8/20 postfix.master: Change path of child processes
7/20 profiles/postfix: add locking perm to pid files
6/20 profiles: add a postfix dnsblog profile
5/20 profiles: add a postfix postscreen profile
4/20 profiles/postfix-master: grant signal+unix communication with children
3/20 profiles/postfix: use named profiles
2/20 profiles/postfix-master: use profile name instead of match pattern
1/20 allow locking /etc/aliases.db

Note: Backport Exception Requested by OpenSuse, updated profiles needed, on a 2.13 release
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/621
Acked-by: John Johansen <john.johansen@canonical.com>
2020-09-09 20:14:01 +00:00
Christian Boltz
8501ed822e Revert renaming usr.lib.postfix.* to postfix.* in 2.13 branch
... as discussed/proposed in !621

This means the postfix.* filenames stay master-only.
2020-09-09 21:30:22 +02:00
Christian Boltz
e54fdf8e2b postfix-master: allow access to postlog socket
(cherry picked from commit d55ca8b624)
2020-09-09 21:28:20 +02:00
Christian Boltz
57f6315783 Allow to read icu *.dat files in postfix-related profiles
This is needed for postdrop, postmap, postqueue and sendmail

Seen on openSUSE Tumbleweed.

(cherry picked from commit b23aa00b81)
2020-09-08 21:23:18 +02:00
Christian Boltz
6fae03d142 postfix/master needs to execute postfix/error
(cherry picked from commit f250e94240)
2020-09-08 21:22:51 +02:00
Christian Boltz
bd401448fa Add several permissions to the postfix.* profiles
... needed on openSUSE Leap 15.1

(cherry picked from commit 7016ac954b)
2020-09-08 21:22:37 +02:00
Christian Boltz
6e2de0806c adjust postfix profiles for openSUSE path
On openSUSE Leap 15.1, the postfix binaries live in
/usr/lib/postfix/bin/ which was not covered in the postfix.* attachment
and mrix rules.

(cherry picked from commit f668f31bf0)
2020-09-08 21:20:56 +02:00
Julian Andres Klode
583fb1c0cd profiles/postfix-smtpd: Include ssl_certs, ssl_keys
This is needed for serving TLS.

(cherry picked from commit 4c85a7ec9e)
2020-09-08 21:18:28 +02:00
Julian Andres Klode
54806dce22 profiles/postdrop: Allow reading from pickup socket
(cherry picked from commit b858428dd1)
2020-09-08 21:18:16 +02:00
Julian Andres Klode
25338e4691 profiles/postfix-pickup: Allow reading from cleanup socket
(cherry picked from commit d1ab0a021e)
2020-09-08 21:18:04 +02:00
Julian Andres Klode
9051288c3d postfix.local: Minor adjustments to make it work
This connects queue manager to local.

(cherry picked from commit 60d203b622)
2020-09-08 21:17:52 +02:00
Julian Andres Klode
0107d57915 postfix.*: Adapt for new queue names, and extra locking and r/w communication
This gets us to the local process now, which comes next.

(cherry picked from commit 02528133d2)

Note: this cherry-pick doesn't include the removal of the path-based
signal and unix rules in postfix-master.
2020-09-08 21:16:46 +02:00
Julian Andres Klode
1909ca0dcb postfix.tlsmgr: Connect to urandom and prng exchange
(cherry picked from commit e8841a0953)
2020-09-08 21:12:23 +02:00
Julian Andres Klode
d6ebf87d2b postfix.master: Change path of child processes
(cherry picked from commit f4bfd78164)
2020-09-08 21:11:39 +02:00
Steve Beattie
43af5f9751 profiles/postfix: add locking perm to pid files
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 9943da2f52)
2020-09-08 21:11:06 +02:00
Steve Beattie
065546c312 profiles: add a postfix dnsblog profile
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 889503f623)
2020-09-08 21:08:19 +02:00
Steve Beattie
2060ccde22 profiles: add a postfix postscreen profile
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 1c9459825a)
2020-09-08 21:08:03 +02:00
Steve Beattie
df9cfced8c profiles/postfix-master: grant signal+unix communication with children
Grant the ability to communicate with the postfix named child profiles
via signals and unix sockets. Include the path-based match names as
a fallback on upgrades.

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 35d84895fe)
2020-09-08 21:07:42 +02:00
Steve Beattie
9a9c2f9793 profiles/postfix: use named profiles
Convert all the postfix subprocesses to using named profiles instead of
path match profiles, and adjust exec paths for newer debian/ubuntu
releses. Rename profiles to match profile names.

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 39ca2adff6)
2020-09-08 21:07:29 +02:00
Steve Beattie
8b0e2bdc94 profiles/postfix-master: use profile name instead of match pattern
Convert postfix's master profile to use a named profile
(postfix-master) rather than the exec path match pattern. Adjust
postfix-common abstraction to take this into account. Rename profile
name in the profiles/apparmor/profiles/extras/ directory to match
the profile name.

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit 01648c6a61)
2020-09-08 21:02:35 +02:00
Christian Boltz
68316d265b allow locking /etc/aliases.db
This is needed for "newaliases" on current openSUSE Tumbleweed / postfix 3.3.1

(cherry picked from commit f74edd5d5a)
2020-09-08 20:59:06 +02:00
Christian Boltz
e32cbfc0e6 Merge branch 'cboltz-2.13-dnsmasq' into 'apparmor-2.13'
[2.12+2.13] dnsmasq: Backport support for /usr/libexec/libvirt_leaseshelper path

References: https://build.opensuse.org/request/show/831960

See merge request apparmor/apparmor!618

Acked-by: John Johansen <john.johansen@canonical.com> for 2.12 and 2.13
2020-09-06 18:06:33 +00:00
Vladimir “Equidamoid” Shapranov @equidamoid
f2e09aa234 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>
(cherry picked from commit e731b8a335)
2020-09-06 12:24:29 +02:00
Vladimir “Equidamoid” Shapranov @equidamoid
af6bf82389 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>
(cherry picked from commit 28fce5f76d)
2020-09-06 12:23:59 +02:00
Christian Boltz
02dce59d29 postfix-common: allow reading icu *.dat
several postfix-* binaries on openSUSE Tumbleweed need to read
/usr/share/icu/[0-9]*.[0-9]*/*.dat.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/615
(cherry picked from commit 39ef7c508f)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-09-05 02:45:21 -07:00
Vincas Dargis
dab520aae9 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.

(cherry picked from commit e6dbe3bfd3)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-09-03 11:04:15 -07:00
John Johansen
70d3183a23 Merge [2.13] add abstractions/hosts_access
This is a partial backport of eb8f9302aa (only adding the abstraction) to the 2.13 branch.

Note that the 2.13 version of the abstraction doesn't have

* the abi rule
* the `include if exists <abstractions/hosts_access.d>`

because both are new in master and would cause interesting\[tm\] problems with the 2.13 tools.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/612
Acked-by: John Johansen <john.johansen@canonical.com>
2020-09-02 20:48:32 +00:00
Christian Boltz
64dfc797dd add abstractions/hosts_access
This is a partial backport of eb8f9302aa
(only adding the abstraction) to the 2.13 branch.

Note that the 2.13 version of the abstraction doesn't have
- the abi rule
- the `include if exists <abstractions/hosts_access.d>`
because both are new in master and would cause interesting[tm] problems
with the 2.13 tools.
2020-09-02 22:36:39 +02:00
Steve Beattie
ad45b80789 parser: add CAP_BPF/PERFMON; convert to pregenerated cap list
Add support for CAP BPF and PERFMON

Backport from !578 the subset of patches that convert the parser to a pregenerated list of capability names instead of a dynamically generated list.

The dynamically generated list is still created and compared to the pregenerated list and the build will fail if new capabilities are added to the dynamically generated list that are not in the pregenerated list.

This enables the parser to support new capabilities like CAP BPF and PERFMON that are might not be in the kernel that the parser is being built against.

This patch series adds support CAP BPF and PERFMON in the pregenerated list of capabilities

See merge request apparmor/apparmor!594
2020-09-01 04:40:02 +00:00
Christian Boltz
aca6adea2a 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

(cherry picked from commit 6cf58457d7)

c4f90ec1 Fix smtpd path in sendmail profile
9fbe599c Fix /usr/lib/postfix binary paths in postfix+dovecot profiles
2020-08-30 18:57:22 +00:00
Christian Boltz
2a3752c4c4 Merge branch 'update-nvidia-modprobe' into 'master'
nvidia_modprobe: allow reading driver parameters

See merge request apparmor/apparmor!603

Acked-by: Christian Boltz <apparmor@cboltz.de> for master and 2.13

(cherry picked from commit 112e2bc9fb)

a98a4f73 nvidia_modprobe: allow reading driver parameters
2020-08-30 18:49:54 +00:00
Steve Beattie
a07de3f095 regression tests/prologue: adjust sed to not use ~ as regex separators
prologue.inc:settest() in same cases invokes a sed command that uses
'~' as a pattern separator, on things that can contain filesystem
paths. However, in the debian/ubuntu world, '~' can be used in version
strings, particularly for pre-release versions, and when this happens
and the version is embedded in the path, the sed command breaks
because of the extraneous separator. Fix this by using '#' as a
separator, which has the benefit of being considered a comment if
accidentally interpreted by a shell.

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: Christian Boltz <apparmor@cboltz.de>
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/599
(cherry picked from commit efc6590409)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-08-28 02:05:28 -07:00
John Johansen
60007d3fe4 parser: Add warning to capability_table about the need to update the Makefile
The autogenerated capabilities comparison needs to be updated if the
capability_table structure changes. Add a note by the structure to
make sure the Makefile will get updated if the structure is changed.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/597
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
(backported from commit 139fac6062)
2020-08-27 01:26:11 -07:00
John Johansen
ef8d514138 parser/Makefile: use LC_ALL=C when invoking sed
Acked-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/596
(backported from commit 33ff79a9e5)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-08-26 23:55:46 -07:00
John Johansen
4e194b2f3a parser: unify capability name handling
There are currently two capability name tables the one that is
autogenerated and an internal hardcoded name table.

Now that the autogenerated table has been converted to a base
static table we can drop the internal static table. This
removes the chance of getting the tables getting out of sync.

Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit fb9c5f9bcf)
2020-08-24 02:28:25 -07:00
John Johansen
ed61e482cb parser: cleanup capability_table generation by dropping cap sys_log
The static cap sys_log declaration is no longer needed as
base_cap_names.h contains it and ensures that it will always be
present.

Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit fdba3a571c)
2020-08-24 02:28:13 -07:00
John Johansen
efb6952e0c parser: Move to a pre-generated cap_names.h
The auto-generated cap_names.h has problems when the parser if the
parser is built against a kernel with a smaller capability list than
the kernel policy is being compiled for.

Moving to a pre-generated list lets us support all capabilities even
when we build against older kernels. However we don't want to only use
the pre-generated list as that would make it too easy to miss when a
new capability has been added.

Keep auto generating the caps list and compare it to the pre-generated
caps list so we can detect when new capabilities are added, and fail
the build so that the pre-generated list can be updated. We screen the
diff for only additions so that the parser can continue to build on
older kernels that don't have the full capability list without errors.

Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 270fb0a2b2)
2020-08-24 02:07:25 -07:00
Jonas Witschel
aecc9e1cb6 abstractions/gnome: allow /usr/share/gtk-3.0/settings.ini
GTK+ 3 has a global settings file that should be readable as well.

(cherry picked from commit af6fe026e1)
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/592
2020-08-20 14:01:02 -07:00
John Johansen
489fa60fda Merge utils make check_severity_db: say ERROR for failing the build
utils `make check_severity_db` will fail the build if a (probably new) capability in not listed in severity.db. This also means it should print out an ERROR, not a warning.

This is a follow-up of lp#1890547 and https://gitlab.com/apparmor/apparmor/-/merge_requests/589

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/591
Acked-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 2f5d5e1b24)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-08-20 01:15:16 -07:00
Christian Boltz
cd4a161350 Add CAP_BPF and CAP_PERFMON to severity.db
These capabilities were introduced in Linux 5.8

References: https://bugs.launchpad.net/bugs/1890547
(cherry picked from commit ae01250209)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-08-07 13:51:55 -07:00
Christian Boltz
701b3ba29c Handle symlink log events in aa-logprof
Nobody told the tools that log events with operation="symlink" exist.
Add this keyword to the list of file or network operations (I don't
expect network symlinks ;-) but keeping everything in that list makes
things easier than special-casing it.)

Also add the log sample and expected result to the libapparmor tests.

Fixes https://gitlab.com/apparmor/apparmor/-/issues/107

(cherry picked from commit 98bf187323)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-08-06 11:19:34 -07:00
Steve Beattie
c63cc73672 utils/tests: add libaparmor swig library path
Similar to the profiles/ check using the python utilities, the
tests for the python utilities were not including the path for the
swig libapparmor library in the LD_LIBRARY_PATH variable, only in
PYTHONPATH. This commit fixes that, renaming the variable used for
the built libapparmor check.

v2:
 - actually use the LIBAPPARMOR_PATH variable when defining
   LD_LIBRARY_PATH

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-25 00:54:57 -07:00
Steve Beattie
a65078494e 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-25 00:54:57 -07:00
Steve Beattie
d1d74e8950 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-25 00:54:57 -07:00
Steve Beattie
88517e9768 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-25 00:54:57 -07:00
John Johansen
6016f931eb 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>
(cherry picked from commit c8b6d8b393)
2020-07-22 16:17:11 -07:00
John Johansen
f25770c27b Merge Fix lexer 2.13
This is a backport of the fix-lexer patch series for 2.13

Atm it has more patches than are strictly necessary. The open question is how much of that series do we actually want to bring back?

technically the only patch we need to keep CI working and fix the issues that have been discovered are

```
Remove TODO for half-quoted abi rule
parser: split newline and end of rule handling into separate rules
parser: update rule to process newlines to include states that eat WS
parser: add ABI_MODE to WS consumption state
```

However that would keep us from being able to catch other errors. If we want to be able to catch other potential lexer pass-through errors, at a minimum we need to include.

```
Error out on unhandled parts when parsing a profile
```

Which excludes only

```
parser: add missing states to the default rule and improve the error msg
```

While its nice to have better debug output, I am not sure it is worth backporting this patch
Summary of Discussion: The debug output is worth having

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/572
Acked-by: Steve Beattie <sbeattie@ubuntu.com>
2020-07-21 22:53:20 +00:00
John Johansen
5623881bfa Merge [2.11..2.13] 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

This is the 2.13 version of 35f033ca7c / https://gitlab.com/apparmor/apparmor/-/merge_requests/581

The difference is that this commit avoids using the @{run} variable.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/582
Acked-by: John Johansen <john.johansen@canonical.com>
2020-07-21 22:34:49 +00:00
John Johansen
9528672c36 libapparmor: fix hashing of the feature set
The hashing of the featue set is wrong because it is hashing the
whole feature structure instead of just the feature string.

This results in the refcount and hash field becoming part of the
hash and the feature string not being completely hashed as the
bytes of the refcount and hash field are being counted in the
as part of the string length when the hash is taken.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/583
Reported-by: Samuele Pedroni <samuele.pedroni@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <steve.beattie@canonical.com>
(cherry picked from commit b8be1c3ff8)
2020-07-21 15:18:49 -07:00
Christian Boltz
02b9090eda 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

This is the 2.13 version of 35f033ca7c /
https://gitlab.com/apparmor/apparmor/-/merge_requests/581

The difference is that this commit avoids using the @{run} variable.
2020-07-20 20:35:41 +02:00
Christian Boltz
7c5c8a0cc1 Merge branch 'update-debian-fonts' into 'master'
Update fonts abstraction for Debian

Closes #94

See merge request apparmor/apparmor!575

Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.12..master

(cherry picked from commit 5b4a40ea58)

7b7e98a5 Update fonts abstraction for Debian
2020-06-27 18:35:01 +00:00
Christian Boltz
ac4bf706e5 Merge branch 'cboltz-2.13-tests-profile-dir' into 'apparmor-2.13'
[2.11..2.13] fix setting apparmor.aa.profile_dir in some tests

cherry picked from commit 6fe4b5e59a -
but only the test-aa.py changes because test-profile-list.py didn't have
the affected tests in 2.13 yet.

See merge request apparmor/apparmor!574

Acked-by: Steve Beattie <steve.beattie@canonical.com> for 2.11..2.13
2020-06-19 11:42:57 +00:00
Jochen Sprickerhof
53a95a58e6 enchant abstraction: support libenchant-2-2
PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/573
(cherry picked from commit 178f5d5e77)
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
2020-06-19 00:53:25 -07:00
Christian Boltz
583ea724b2 fix setting apparmor.aa.profile_dir in some tests
cherry picked from commit 6fe4b5e59a -
but only the test-aa.py changes because test-profile-list.py didn't have
the affected tests in 2.13 yet
2020-06-17 13:16:36 +02:00
John Johansen
b3560008dd parser: add ABI_MODE to WS consumption state
ABI_MODE needs to be able to consume white space, unfortunately this
was missed, and only showed up with the basckport of the patches
to stop unmatched input from being passed through.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-06-14 01:36:49 -07:00
John Johansen
2f04bf6498 parser: update rule to process newlines to include states that eat WS
Newlines should generally be treated as whitespace. Expand the list
of states using the newline rule to include almost all rules that
eat WS.

There are two exceptions assign and comment which have special handling
of newlines.

this fixes the failures

not ok 71543 - ./simple_tests//vars/vars_simple_assignment_13.sd: quoted commas should not trigger an error

not ok 71544 - ./simple_tests//vars/vars_simple_assignment_14.sd: quoted commas should not trigger an error

found by introducing nodefault

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/569
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <sbeattie@ubuntu.com>
(cherry picked from commit 21498ff9a4)
2020-06-14 00:01:42 -07:00
John Johansen
438d2794e1 parser: split newline and end of rule handling into separate rules
Split the newline processing into a separate rule block so that it can
be shared with states that need to process newlines without processing
end of rule conditions.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/569
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <sbeattie@ubuntu.com>
(cherry picked from commit fffca2ffa0)
2020-06-14 00:01:24 -07:00
John Johansen
711a1747a2 parser: add missing states to the default rule and improve the error msg
There were several states missing from the default rule which catches
unexpected input in a state.

Update the default rule to catch all input including newlines and
update its error message to include information about which state the
failure occured in. Also update the comment about what to do when
adding new states.

While the lexer now has the "nodefault" option set, it doesn't provide
as much information as the default rule does, so we prefer states
to use our provided default rule.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/569
Signed-off-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <sbeattie@ubuntu.com>
(cherry picked from commit 1a4288886b)
2020-06-13 23:51:47 -07:00
Christian Boltz
b302327ac8 Remove TODO for half-quoted abi rule
With %option nodefault, the parser now errors out as expected, even if
the error message isn't too helpful.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/569
Signed-off-by: Christian Boltz <apparmor@cboltz.de>                            Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <sbeattie@ubuntu.com>
(cherry picked from commit 7d062917aa)
2020-06-13 23:51:35 -07:00
Christian Boltz
af32be0fb4 Error out on unhandled parts when parsing a profile
... (using `%option nodefault`) instead of echoing the unknown parts to
stdout, and ignoring the error.

This will cause the parser to error out with

    flex scanner jammed

and $?=2 if a profile contains unknown/invalid parts. That's not really
a helpful error message, but still better than ignoring errors.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/569
Signed-off-by: Christian Boltz <apparmor@cboltz.de>
Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Steve Beattie <sbeattie@ubuntu.com>
(cherry picked from commit c01ed1d57b)
2020-06-13 23:51:21 -07:00
Christian Boltz
0c858fb34d allow reading my.cnf in dovecot-dict profile
Seen on openSUSE Tumbleweed with the mail users in a mysql database.

(cherry picked from commit f7ab91f423)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-06-13 01:56:09 -07:00
Christian Boltz
8a3b92cd62 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.

(backported from commit 6a388859f8)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-06-13 01:55:28 -07:00
Jörg Sommer
1842231253 profiles/gnome: Allow access of /run/mount/utab
When a filesystem is mounted with the option *user*, the file selection
dialogue, e.g. in *Evince*, triggers an access of */run/mount/utab*, which
comes from *libmount* and should be allowed.

Reported-by: JrgSommer[m] in #apparmor
(cherry picked from commit cd3532f792)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-05-27 00:43:48 -07:00
Christian Boltz
2d0358c95c Fix strip_quotes() to handle empty strings
strip_quotes() assumed its parameter is at least one character long, and
errored out on an empty string.

It also converted a string consisting of a single quote to an empty
string because that single quote had a quote as first and last char.

This commit fixes these two bugs.

Also rewrite TestStripQuotes to use tests[], and add some test for an empty
string, a one-char path (just a slash) and a single quote.

(cherry picked from commit 373e8e23b1)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-05-26 00:44:30 -07:00
Christian Boltz
5929c1519b Merge branch 'dnsmasq-trust-anchors' into 'master'
dnsmasq: allow reading DNSSEC trust anchors

See merge request apparmor/apparmor!547

Acked-by: Christian Boltz <apparmor@cboltz.de

(cherry picked from commit 5d04922f00)

1b9469eb dnsmasq: allow reading DNSSEC trust anchors
2020-05-25 18:25:55 +00:00
Vincas Dargis
53798e90d5 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.

(cherry picked from commit 21bbfc0652)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-05-21 12:56:17 -07:00
Christian Boltz
5f61bd4cf2 Merge branch 'cboltz-2.13-collapse-log' into 'apparmor-2.13'
[2.12+2.13] collapse_log(): avoid accidently initializing aa[profile]

See merge request apparmor/apparmor!539

Acked-by: John Johansen <john.johansen@canonical.com> for 2.12 and 2.13
2020-05-20 19:23:21 +00:00
Christian Boltz
72c2a7d2de collapse_log(): avoid accidently initializing aa[profile]
... or calling is_known_rule() on events for non-existing hats.

It's the usual hasher() "fun" again - accessing a non-existing element
will create its parent.

In theory this commit might be worth a backport. In practise, it doesn't cause
any visible problem.

However, starting with the next commit, it will cause lots of test errors.

Also add a missing is_known_rule() call for dbus rules, which might have
caused similar hasher() "fun".

(Backported from 9f1b2f4014)
2020-05-20 20:06:27 +02:00
Christian Boltz
e038123f8f Merge branch 'cboltz-fail-verbose' into 'master'
read_profile(): don't fail silently

See merge request apparmor/apparmor!530

Acked-by: Steve Beattie <steve.beattie@canonical.com> for 2.11..master

(cherry picked from commit e0f9b7cb07)

af8b9dc5 read_profile(): don't fail silently
2020-05-12 19:43:59 +00:00
nl6720
2841103039 profiles: add trailing slash to the run variable definition
Merge request apparmor/apparmor!466 (454fca7483) pulled back the
@{run} variable definition from apparmor/apparmor!454 (452b5b8735)
to the 2.13 and 2.12 branches, to make backporting profile changes
easier.  However, it did not include the followup fix to the @{run}
definition to include trailing slashes to ensure they are treated as
directories (apparmor/apparmor!456 ef591a67ce).

Signed-off-by: nl6720 <nl6720@gmail.com>
(cherry picked from commit ef591a67ce)
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/533
2020-05-12 12:30:11 -07:00
Christian Boltz
0e89e79a32 Merge branch 'cboltz-vim-alias' into 'master'
apparmor.vim: allow leading whitespace for alias rules

See merge request apparmor/apparmor!527

Acked-by: Steve Beattie <steve.beattie@canonical.com> for 2.11..master

(cherry picked from commit ae70ecfbaa)

c636580f apparmor.vim: allow leading whitespace for alias rules
2020-05-10 22:54:44 +00:00
Christian Boltz
0ad7109eea Merge branch 'cboltz-less-shell' into 'master'
less shell ;-)

See merge request apparmor/apparmor!520

Acked-by: John Johansen <john.johansen@canonical.com>

(cherry picked from commit 6b55794074)

48bae9e3 less shell ;-)
2020-05-07 17:59:16 +00:00
Christian Boltz
eb5185c961 Merge branch 'cboltz-2.13-genprof-fix-json' into 'apparmor-2.13'
[2.11..2.13] Fix showing the local inactive profile in json mode

See merge request apparmor/apparmor!516

Acked-by: Steve Beattie <steve.beattie@canonical.com> for 2.12 and 2.13
2020-05-07 10:18:12 +00:00
Christian Boltz
da07cdf79c Fix showing the local inactive profile in json mode
When aa-genprof proposes a local inactive profile, it had a hardcoded
call to 'less' to display that profile.

Unsurprisingly, this doesn't work in JSON mode and breaks YaST (luckily
it's only a case of "the button doesn't work").

References: https://bugzilla.opensuse.org/show_bug.cgi?id=1171315
(cherry picked from commit 68a258b006)
(cherry picked from commit cb95e9a2568b19e2e7601c0af363e0605a6889d9)
2020-05-07 01:06:41 +02:00
Christian Boltz
6e9dd6494b Split off UI_ShowFile() from UI_Changes
UI_ShowFile() is more generic and can be used to display various (text)
files, not only diffs.

(cherry picked from commit bb3803b931,
adjusted for 2.13 branch)
2020-05-07 01:06:05 +02:00
Christian Boltz
6c638c97c5 Merge branch 'cboltz-vim-if-exists' into 'master'
apparmor.vim: support 'include if exists'

See merge request apparmor/apparmor!500

Acked-by: John Johansen <john.johansen@canonical.com> for 2.12..master

(cherry picked from commit a4864146e2)

efa7c6d6 apparmor.vim: support 'include if exists'
2020-05-03 19:28:09 +00:00
Christian Boltz
b3dff41eb7 Merge branch 'privacy' into 'master'
Privacy statement

See merge request apparmor/apparmor!441

Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.11..master

(cherry picked from commit 4281b58c89)

bfde89a6 infrastructure: Add privacy statement to the README
2020-04-26 11:43:26 +00:00
John Johansen
cca58df6f5 Merge Fixings for crosscompilation
This series adds a couple of patches to make the software more crosscompilation friendly. They are based on the work I'm doing to fix the package on buildroot

PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/485
Acked-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 9ba2334423)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-04-26 03:00:34 -07:00
Daniel Gerber
95b75a628a fix fails to load profiles in busybox with:
egrep: bad regex '^/.[ \t]+flags[ \t]=[ \t]*([ \t]complain[ \t])[ \t]+{': Invalid contents of {}

Note the final non-escaped {.
The issue is not present any more in branch master.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/80
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-04-20 16:51:40 -07:00
Christian Boltz
ddb747c0a9 Merge branch 'profile-usr.sbin.dnsmasq' into 'master'
usr.sbin.dnsmasq: update to support dnsmasq 2.81

See merge request apparmor/apparmor!475

Acked-by: Christian Boltz for 2.11..master

(cherry picked from commit acafe9de82)

88c142c6 usr.sbin.dnsmasq: allow reading @{PROC}/@{pid}/fd/ as is needed by dnsmasq 2.81
2020-04-12 09:45:24 +00:00
John Johansen
01841ade3a Merge Better error handling when creating apparmor.vim
See the individual commits for details and bug references.

PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/472
Acked-by: John Johansen <john.johansen@canonical.com>
2020-04-08 01:37:44 -07:00
John Johansen
e02a017014 Merge Backport xdg open
@Talkless requested xdg-open and friends be cherry-picked into 2.13

This is the set of commits (and fixes) to do that without modifying them.

We could drop backporting dbus-strict by modifying both the adding missing .d dirs, and add xdg-open and friends patches.

This series does not currently include the make check test and its fixes for the .d directories, as they were not required but we may want to include them to catch any potential errors.
PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/471
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-04-03 01:47:03 +00:00
John Johansen
0b31930b3b 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>
(cherry picked from commit b2d0d87eba)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-04-02 03:17:19 -07:00
Christian Boltz
b9af6564a5 Merge branch 'cboltz-exoopen-local' into 'master'
Add #include if exists <*.d> to new abstractions

See merge request apparmor/apparmor!453

Acked-by: Seth Arnold <seth.arnold@canonical.com>
(cherry picked from commit 962f1e7a7b)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-04-02 03:17:04 -07:00
John Johansen
632fb92bc5 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>
(cherry picked from commit d257afd309)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-04-02 03:16:51 -07:00
Christian Boltz
79e942bf2a Merge branch 'cboltz-abstractions-missing-include' into 'master'
add missing *.d include to dbus-network-manager-strict abstraction

See merge request apparmor/apparmor!448

Acked-by: Seth Arnold <seth.arnold@canonical.com>
(cherry picked from commit eae474bb5c)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-04-02 03:09:36 -07:00
John Johansen
c046bc83dc 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>
(cherry picked from commit a10fa57fb6)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-04-02 03:09:21 -07:00
Rich McAllister
dda6825ff2 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>

(cherry picked from commit eeac8c11c9)
2020-03-31 21:04:45 -07:00
John Johansen
92f6679da9 Merge [2.13] fix build with make 4.3
his MR backports the patches for make 4.3 compability to the 2.13 branch.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/74
Fixes: https://bugzilla.opensuse.org/show_bug.cgi?id=1167953
Acked-by: John Johansen <john.johansen@canonical.com>
2020-03-31 22:05:47 +00:00
John Johansen
03acdebf07 Merge [2.12 + 2.13] Add "run" variable
Define the "run" variable in 2.12 and 2.13 to make backporting profile updates easier.

Fixes: https://gitlab.com/apparmor/apparmor/-/issues/88
PR: https://gitlab.com/apparmor/apparmor/-/merge_requests/466

Acked-by: John Johansen <john.johansen@canonical.com>
2020-03-31 21:59:34 +00:00
nl6720
1f319c3870 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/ .

(cherry picked from commit 16f9f6885a)
Fixes: https://gitlab.com/apparmor/apparmor/-/issues/82
Signed-off-by: nl6720 <nl6720@gmail.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-03-31 14:05:15 -07:00
Christian Boltz
411af09c97 Merge branch 'mesa-20.0' into 'master'
abstractions/mesa: allow checking if the kernel supports the i915 perf interface

See merge request apparmor/apparmor!464

Acked-by: Vincas Dargis <vindrg@gmail.com>
Acked-by: Christian Boltz <apparmor@cboltz.de> for master and 2.13

(cherry picked from commit f56bab3f75)

61571da1 abstractions/mesa: allow checking if the kernel supports the i915 perf interface
2020-03-31 19:50:52 +00:00
nl6720
454fca7483 Add "run" variable
Signed-off-by: nl6720 <nl6720@gmail.com>
(cherry picked from commit 452b5b8735)
2020-03-31 21:29:45 +02:00
Christian Boltz
af0c288fcd fix capabilities in apparmor.vim
https://gitlab.com/apparmor/apparmor/-/merge_requests/461 /
e92da079ca changed creating the
capabilities to use a script.

A side effect is that the list is now separated by \n instead of
spaces. Adjust create-apparmor.vim.py to the new output.

(cherry picked from commit 60b005788e)
2020-03-31 20:57:53 +02:00
allgdante
0d8e4cda3f Generate CAPABILITIES in a script due to make 4.3
This way we could generate the capabilities in a way that works with
every version of make.
Changes to list_capabilities are intended to exactly replicate the old
behavior.

(cherry picked from commit e92da079ca)
2020-03-31 20:57:53 +02:00
John Johansen
69651fc656 Revert "utils/test-network.py: fix failing testcase"
This reverts commit 378519d23f.
this commit was meant for the 2.13 branch not master

Signed-off-by: John Johansen <john.johansen@canonical.com>
(cherry picked from commit 9144e39d25)
2020-03-31 20:55:27 +02:00
Eric Chiang
fc2beaca9d *: 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>
(cherry picked from commit cb8c3377ba)
2020-03-31 20:55:17 +02:00
Christian Boltz
5972adc7e3 Merge branch 'master' into 'master'
Update usr.sbin.winbindd profile to allow krb5 rcache files locking

See merge request apparmor/apparmor!460

Acked-by: Christian Boltz <apparmor@cboltz.de> for 2.11..master

(cherry picked from commit 5c1932d0d6)

2c3001c7 Update usr.sbin.winbindd profile to allow krb5 rcache files locking
2020-03-23 20:14:39 +00:00
Christian Boltz
2e2529bae8 Replace deprecated assertEquals with assertEqual
assertEquals is deprecated since Python 2.7 and 3.2.

(cherry picked from commit 62abfe38e8)
Signed-off-by: John Johansen <john.johansen@canonical.com>
2020-03-17 13:25:02 -07:00
156 changed files with 1761 additions and 495 deletions

1
.gitignore vendored
View File

@@ -8,6 +8,7 @@ binutils/po/*.mo
parser/po/*.mo
parser/af_names.h
parser/cap_names.h
parser/generated_cap_names.h
parser/tst_lib
parser/tst_misc
parser/tst_regex

View File

@@ -1,7 +1,7 @@
---
image: ubuntu:latest
before_script:
- export DEBIAN_FRONTEND=noninteractive && apt-get update -qq && apt-get install --no-install-recommends -y build-essential apache2-dev autoconf automake bison dejagnu flex libpam-dev libtool perl liblocale-gettext-perl pkg-config python-all-dev python3-all-dev pyflakes3 ruby-dev swig lsb-release python3-notify2 python3-psutil zlib1g-dev
- export DEBIAN_FRONTEND=noninteractive && apt-get update -qq && apt-get install --no-install-recommends -y build-essential apache2-dev autoconf automake bison dejagnu flex libpam-dev libtool perl liblocale-gettext-perl pkg-config python-all-dev python3-all-dev pyflakes3 ruby-dev swig lsb-release python3-notify2 python3-psutil python3-setuptools zlib1g-dev
- lsb_release -a
- uname -a

View File

@@ -45,6 +45,24 @@ Security issues can be filed as security bugs on launchpad
or directed to `security@apparmor.net`. Additional details can be found
in the [wiki](https://gitlab.com/apparmor/apparmor/wikis/home#reporting-security-vulnerabilities).
--------------
Privacy Policy
--------------
The AppArmor security project respects users privacy and data and does not collect data from or on its users beyond what is required for a given component to function.
The AppArmor kernel security module will log violations to the audit subsystem, and those will be logged/forwarded/recorded on the user's system(s) according to how the administrator has logging configured. Again this is not forwarded to or collected by the AppArmor project.
The AppArmor userspace tools do not collect information on the system user beyond the logs and information needed to interact with the user. This is not forwarded to, nor collected by the AppArmor project.
Users may submit information as part of an email, bug report or merge request, etc. and that will be recorded as part of the mailing list, bug/issue tracker, or code repository but only as part of a user initiated action.
The AppArmor project does not collect information from contributors beyond their interactions with the AppArmor project, code, and community. However contributors are subject to the terms and conditions and privacy policy of the individual platforms (currently GitLab and LaunchPad) should they choose to contribute through those platforms. And those platforms may collect data on the user that the AppArmor project does not.
Currently both GitLab an LaunchPad require a user account to submit patches or report bugs and issues. If a contributor does not wish to create an account for these platforms the mailing list is available. Membership in the list is not required. Content from non-list members will be sent to moderation, to ensure that it is on topic, so there may be a delay in choosing to interact in this way.
-------------
Source Layout
-------------

View File

@@ -54,6 +54,10 @@ TOOLS = aa-enabled aa-exec
AALIB = -Wl,-Bstatic -lapparmor -Wl,-Bdynamic -lpthread
ifdef WITH_LIBINTL
AALIB += -lintl
endif
ifdef USE_SYSTEM
# Using the system libapparmor so Makefile dependencies can't be used
LIBAPPARMOR_A =

View File

@@ -0,0 +1,67 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Canonical Ltd
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: apparmor@lists.ubuntu.com\n"
"POT-Creation-Date: 2020-10-14 03:36-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../aa_enabled.c:21
#, c-format
msgid ""
"%s: [options]\n"
" options:\n"
" -q | --quiet Don't print out any messages\n"
" -h | --help Print help\n"
msgstr ""
#: ../aa_enabled.c:38
#, c-format
msgid "No - not available on this system.\n"
msgstr ""
#: ../aa_enabled.c:42
#, c-format
msgid "No - disabled at boot.\n"
msgstr ""
#: ../aa_enabled.c:46
#, c-format
msgid "Maybe - policy interface not available.\n"
msgstr ""
#: ../aa_enabled.c:51
#, c-format
msgid "Maybe - insufficient permissions to determine availability.\n"
msgstr ""
#: ../aa_enabled.c:56
#, c-format
msgid "Error - %s\n"
msgstr ""
#: ../aa_enabled.c:70
#, c-format
msgid "unknown or incompatible options\n"
msgstr ""
#: ../aa_enabled.c:80
#, c-format
msgid "unknown option '%s'\n"
msgstr ""
#: ../aa_enabled.c:90
#, c-format
msgid "Yes\n"
msgstr ""

52
binutils/po/aa_exec.pot Normal file
View File

@@ -0,0 +1,52 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR Canonical Ltd
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: apparmor@lists.ubuntu.com\n"
"POT-Creation-Date: 2020-10-14 03:37-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../aa_exec.c:48
#, c-format
msgid ""
"USAGE: %s [OPTIONS] <prog> <args>\n"
"\n"
"Confine <prog> with the specified PROFILE.\n"
"\n"
"OPTIONS:\n"
" -p PROFILE, --profile=PROFILE\t\tPROFILE to confine <prog> with\n"
" -n NAMESPACE, --namespace=NAMESPACE\tNAMESPACE to confine <prog> in\n"
" -d, --debug\t\t\t\tshow messages with debugging information\n"
" -i, --immediate\t\t\tchange profile immediately instead of at exec\n"
" -v, --verbose\t\t\t\tshow messages with stats\n"
" -h, --help\t\t\t\tdisplay this help\n"
"\n"
msgstr ""
#: ../aa_exec.c:63
msgid "aa-exec: ERROR: "
msgstr ""
#: ../aa_exec.c:74
msgid "aa-exec: DEBUG: "
msgstr ""
#: ../aa_exec.c:87
msgid "\n"
msgstr ""
#: ../aa_exec.c:105
#, c-format
msgid "exec"
msgstr ""

View File

@@ -74,40 +74,6 @@ endif
pod_clean:
-rm -f ${MANPAGES} *.[0-9].gz ${HTMLMANPAGES} pod2htm*.tmp
# =====================
# generate list of capabilities based on
# /usr/include/linux/capabilities.h for use in multiple locations in
# the source tree
# =====================
# emits defined capabilities in a simple list, e.g. "CAP_NAME CAP_NAME2"
CAPABILITIES=$(shell echo "\#include <linux/capability.h>" | cpp -dM | LC_ALL=C sed -n -e '/CAP_EMPTY_SET/d' -e 's/^\#define[ \t]\+CAP_\([A-Z0-9_]\+\)[ \t]\+\([0-9xa-f]\+\)\(.*\)$$/CAP_\1/p' | LC_ALL=C sort)
.PHONY: list_capabilities
list_capabilities: /usr/include/linux/capability.h
@echo "$(CAPABILITIES)"
# =====================
# generate list of network protocols based on
# sys/socket.h for use in multiple locations in
# the source tree
# =====================
# These are the families that it doesn't make sense for apparmor
# to mediate. We use PF_ here since that is what is required in
# bits/socket.h, but we will rewrite these as AF_.
FILTER_FAMILIES=PF_UNIX
__FILTER=$(shell echo $(strip $(FILTER_FAMILIES)) | sed -e 's/ /\\\|/g')
# emits the AF names in a "AF_NAME NUMBER," pattern
AF_NAMES=$(shell echo "\#include <sys/socket.h>" | cpp -dM | LC_ALL=C sed -n -e '/$(__FILTER)/d' -e 's/PF_LOCAL/PF_UNIX/' -e 's/^\#define[ \t]\+PF_\([A-Z0-9_]\+\)[ \t]\+\([0-9]\+\).*$$/AF_\1 \2,/p' | sort -n -k2)
.PHONY: list_af_names
list_af_names:
@echo "$(AF_NAMES)"
# =====================
# manpages
# =====================

View File

@@ -1 +1 @@
2.13.4
2.13.7

19
common/list_af_names.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/bash -e
# =====================
# generate list of network protocols based on
# sys/socket.h for use in multiple locations in
# the source tree
# =====================
# It doesn't make sence for AppArmor to mediate PF_UNIX, filter it out. Search
# for "PF_" constants since that is what is required in bits/socket.h, but
# rewrite as "AF_".
echo "#include <sys/socket.h>" | \
cpp -dM | \
LC_ALL=C sed -n \
-e '/PF_UNIX/d' \
-e 's/PF_LOCAL/PF_UNIX/' \
-e 's/^#define[ \t]\+PF_\([A-Z0-9_]\+\)[ \t]\+\([0-9]\+\).*$/AF_\1 \2,/p' | \
sort -n -k2

14
common/list_capabilities.sh Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash -e
# =====================
# generate list of capabilities based on
# /usr/include/linux/capabilities.h for use in multiple locations in
# the source tree
# =====================
echo "#include <linux/capability.h>" | \
cpp -dM | \
LC_ALL=C sed -n \
-e '/CAP_EMPTY_SET/d' \
-e 's/^\#define[ \t]\+CAP_\([A-Z0-9_]\+\)[ \t]\+\([0-9xa-f]\+\)\(.*\)$/CAP_\1/p' | \
LC_ALL=C sort

View File

@@ -58,7 +58,7 @@ if test "$with_perl" = "yes"; then
AC_PATH_PROG(PERL, perl)
test -z "$PERL" && AC_MSG_ERROR([perl is required when enabling perl bindings])
perl_includedir="`$PERL -e 'use Config; print $Config{archlib}'`/CORE"
AC_CHECK_FILE($perl_includedir/perl.h, enable_perl=yes, enable_perl=no)
AS_IF([test -e "$perl_includedir/perl.h"], enable_perl=yes, enable_perl=no)
fi

View File

@@ -20,6 +20,7 @@
#include <stdbool.h>
#include <stdint.h>
#include <sys/socket.h>
#include <sys/types.h>
#ifdef __cplusplus

View File

@@ -64,7 +64,7 @@ variable to configure. See ``configure --help'' for reference.
# Check if you have distutils, else fail
#
AC_MSG_CHECKING([for the distutils Python package])
ac_distutils_result=`$PYTHON -c "import distutils" 2>&1`
ac_distutils_result=`$PYTHON -c "import distutils" 2>&1 | grep -v DeprecationWarning`
if test -z "$ac_distutils_result"; then
AC_MSG_RESULT([yes])
else
@@ -75,12 +75,14 @@ $ac_distutils_result])
PYTHON_VERSION=""
fi
AC_PATH_TOOL([PYTHON_CONFIG],[`basename $PYTHON`-config])
#
# Check for Python include path
#
AC_MSG_CHECKING([for Python include path])
if type $PYTHON-config; then
PYTHON_CPPFLAGS=`$PYTHON-config --includes`
if test -n "$PYTHON_CONFIG"; then
PYTHON_CPPFLAGS=`$PYTHON_CONFIG --includes`
fi
if test -z "$PYTHON_CPPFLAGS"; then
python_path=`$PYTHON -c "import sys; import distutils.sysconfig;\
@@ -97,8 +99,8 @@ sys.stdout.write('%s\n' % distutils.sysconfig.get_python_inc());"`
# Check for Python library path
#
AC_MSG_CHECKING([for Python library path])
if type $PYTHON-config; then
PYTHON_LDFLAGS=`$PYTHON-config --ldflags`
if test -n "$PYTHON_CONFIG"; then
PYTHON_LDFLAGS=`$PYTHON_CONFIG --ldflags`
fi
if test -z "$PYTHON_LDFLAGS"; then
# (makes two attempts to ensure we've got a version number

View File

@@ -27,7 +27,7 @@ INCLUDES = $(all_includes)
# http://www.gnu.org/software/libtool/manual/html_node/Libtool-versioning.html
#
AA_LIB_CURRENT = 7
AA_LIB_REVISION = 2
AA_LIB_REVISION = 3
AA_LIB_AGE = 6
SUFFIXES = .pc.in .pc
@@ -35,7 +35,7 @@ SUFFIXES = .pc.in .pc
BUILT_SOURCES = grammar.h scanner.h af_protos.h
AM_LFLAGS = -v
AM_YFLAGS = -d -p aalogparse_
AM_CFLAGS = -Wall
AM_CFLAGS = -Wall -flto-partition=none
AM_CPPFLAGS = -D_GNU_SOURCE -I$(top_srcdir)/include/
scanner.h: scanner.l
$(LEX) -v $<

View File

@@ -219,7 +219,7 @@ static int init_features_hash(aa_features *features)
/* portable murmur3 hash
* https://github.com/aappleby/smhasher/wiki/MurmurHash3
*/
PMurHash32_Process(&hash, &carry, features, len);
PMurHash32_Process(&hash, &carry, string, len);
hash = PMurHash32_Result(hash, carry, len);
if (snprintf(features->hash, HASH_SIZE,

View File

@@ -43,6 +43,7 @@
__asm__ (".symver " #real "," #name "@" #version)
#define default_symbol_version(real, name, version) \
__asm__ (".symver " #real "," #name "@@" #version)
#define DLLEXPORT __attribute__((visibility("default"),externally_visible))
#define UNCONFINED "unconfined"
#define UNCONFINED_SIZE strlen(UNCONFINED)
@@ -500,7 +501,7 @@ int aa_change_onexec(const char *profile)
}
/* create an alias for the old change_hat@IMMUNIX_1.0 symbol */
extern typeof((__change_hat)) __old_change_hat __attribute__((alias ("__change_hat")));
DLLEXPORT extern typeof((__change_hat)) __old_change_hat __attribute__((alias ("__change_hat")));
symbol_version(__old_change_hat, change_hat, IMMUNIX_1.0);
default_symbol_version(__change_hat, change_hat, APPARMOR_1.0);
@@ -889,7 +890,7 @@ int query_label(uint32_t mask, char *query, size_t size, int *allowed,
/* export multiple aa_query_label symbols to compensate for downstream
* releases with differing symbol versions. */
extern typeof((query_label)) __aa_query_label __attribute__((alias ("query_label")));
DLLEXPORT extern typeof((query_label)) __aa_query_label __attribute__((alias ("query_label")));
symbol_version(__aa_query_label, aa_query_label, APPARMOR_1.1);
default_symbol_version(query_label, aa_query_label, APPARMOR_2.9);

View File

@@ -6,14 +6,14 @@
IMMUNIX_1.0 {
global:
change_hat;
change_hat; __old_change_hat;
local:
*;
};
APPARMOR_1.0 {
global:
change_hat;
change_hat; __change_hat;
parse_record;
free_record;
local:
@@ -24,7 +24,7 @@ APPARMOR_1.1 {
global:
aa_is_enabled;
aa_find_mountpoint;
aa_change_hat;
aa_change_hat; __old_change_hat;
aa_change_hatv;
aa_change_hat_vargs;
aa_change_profile;
@@ -37,7 +37,7 @@ APPARMOR_1.1 {
free_record;
aa_getprocattr_raw;
aa_getprocattr;
aa_query_label;
aa_query_label; __aa_query_label;
# no more symbols here, please
@@ -47,7 +47,7 @@ APPARMOR_1.1 {
APPARMOR_2.9 {
global:
aa_query_label;
aa_query_label; query_label;
local:
*;
} APPARMOR_1.1;
@@ -118,6 +118,7 @@ APPARMOR_2.13.1 {
PRIVATE {
global:
_aa_is_blacklisted;
_aa_asprintf;
_aa_autofree;
_aa_autoclose;
_aa_autofclose;

View File

@@ -10,8 +10,7 @@ test_python.py: test_python.py.in $(top_builddir)/config.status
CLEANFILES = test_python.py
# bah, how brittle is this?
PYTHON_DIST_BUILD_PATH = '$(builddir)/../build/$$($(PYTHON) -c "import distutils.util; import platform; print(\"lib.%s-%s\" %(distutils.util.get_platform(), platform.python_version()[:3]))")'
PYTHON_DIST_BUILD_PATH = '$(builddir)/../build/$$($(PYTHON) buildpath.py)'
TESTS = test_python.py
TESTS_ENVIRONMENT = \

View File

@@ -0,0 +1,13 @@
#!/usr/bin/python3
# the build path has changed in setuptools 62.1:
# https://github.com/pypa/setuptools/commit/1c23f5e1e4b18b50081cbabb2dea22bf345f5894
import sys
import sysconfig
import setuptools
if tuple(map(int, setuptools.__version__.split("."))) >= (62, 1):
identifier = sys.implementation.cache_tag
else:
identifier = "%d.%d" % sys.version_info[:2]
print("lib.%s-%s" % (sysconfig.get_platform(), identifier))

View File

@@ -74,7 +74,7 @@ class AAPythonBindingsTests(unittest.TestCase):
libapparmor.free_record(swig_record)
expected = self.parse_output_file(outfile)
self.assertEquals(expected, record,
self.assertEqual(expected, record,
"expected records did not match\n" +
"expected = %s\nactual = %s" % (expected, record))
@@ -90,7 +90,7 @@ class AAPythonBindingsTests(unittest.TestCase):
line = l.rstrip('\n')
count += 1
if line == "START":
self.assertEquals(count, 1,
self.assertEqual(count, 1,
"Unexpected output format in %s" % (outfile))
continue
else:

View File

@@ -0,0 +1 @@
Aug 3 00:00:41 liuchao-virtual-machine kernel: [ 4362.615262] audit: type=1400 audit(1596384041.705:290): apparmor="DENIED" operation="symlink" profile="/home/test.sh" name="/home/b.c" pid=8016 comm="ln" requested_mask="c" denied_mask="c" fsuid=0 ouid=0

View File

@@ -0,0 +1,15 @@
START
File: symlink.in
Event type: AA_RECORD_DENIED
Audit ID: 1596384041.705:290
Operation: symlink
Mask: c
Denied Mask: c
fsuid: 0
ouid: 0
Profile: /home/test.sh
Name: /home/b.c
Command: ln
PID: 8016
Epoch: 1596384041
Audit subid: 290

View File

@@ -0,0 +1,4 @@
/home/test.sh {
owner /home/b.c w,
}

View File

@@ -94,6 +94,10 @@ AAREOBJECTS = $(AAREOBJECT)
AARE_LDFLAGS = -static-libgcc -static-libstdc++ -L. $(LDFLAGS)
AALIB = -Wl,-Bstatic -lapparmor -Wl,-Bdynamic -lpthread
ifdef WITH_LIBINTL
AALIB += -lintl
endif
ifdef USE_SYSTEM
# Using the system libapparmor so Makefile dependencies can't be used
LIBAPPARMOR_A =
@@ -281,14 +285,23 @@ parser_version.h: Makefile
# as well as the filtering that occurs for network protocols that
# apparmor should not mediate.
.PHONY: af_names.h
af_names.h:
echo "$(AF_NAMES)" | LC_ALL=C sed -n -e 's/[ \t]\?AF_MAX[ \t]\+[0-9]\+,//g' -e 's/[ \t]\+\?AF_\([A-Z0-9_]\+\)[ \t]\+\([0-9]\+\),/#ifndef AF_\1\n# define AF_\1 \2\n#endif\nAA_GEN_NET_ENT("\L\1", \UAF_\1)\n\n/pg' > $@
echo "$(AF_NAMES)" | LC_ALL=C sed -n -e 's/.*,[ \t]\+AF_MAX[ \t]\+\([0-9]\+\),\?.*/#define AA_AF_MAX \1\n/p' >> $@
af_names.h: ../common/list_af_names.sh
../common/list_af_names.sh | LC_ALL=C sed -n -e 's/[ \t]\?AF_MAX[ \t]\+[0-9]\+,//g' -e 's/[ \t]\+\?AF_\([A-Z0-9_]\+\)[ \t]\+\([0-9]\+\),/#ifndef AF_\1\n# define AF_\1 \2\n#endif\nAA_GEN_NET_ENT("\L\1", \UAF_\1)\n/pg' > $@
../common/list_af_names.sh | LC_ALL=C sed -n -e 's/AF_MAX[ \t]\+\([0-9]\+\),\?.*/\n#define AA_AF_MAX \1\n/p' >> $@
# cat $@
cap_names.h: /usr/include/linux/capability.h
echo "$(CAPABILITIES)" | LC_ALL=C sed -n -e "s/[ \\t]\\?CAP_\\([A-Z0-9_]\\+\\)/\{\"\\L\\1\", \\UCAP_\\1\},\\n/pg" > $@
generated_cap_names.h: /usr/include/linux/capability.h
../common/list_capabilities.sh | LC_ALL=C sed -n -e "s/[ \\t]\\?CAP_\\([A-Z0-9_]\\+\\)/\{\"\\L\\1\", \\UCAP_\\1\},\\n/pg" > $@
cap_names.h: generated_cap_names.h base_cap_names.h
@LC_ALL=C sed -e 's/\([^,]*,[^,]*,\) CAP_[A-Z0-9_]\+,/\1 NO_BACKMAP_CAP,/g' base_cap_names.h | diff -u - generated_cap_names.h | grep '^\+[^+]' ; \
if [ $$? -eq 1 ] ; then \
cp base_cap_names.h $@ ; \
else \
echo "Error: new capabilities detected please update base_cap_names.h with values from generated_cap_names.h" ; \
LC_ALL=C sed -e 's/\([^,]*,[^,]*,\) CAP_[A-Z0-9_]\+,/\1 NO_BACKMAP_CAP,/g' base_cap_names.h | diff -u - generated_cap_names.h ; \
exit 1; \
fi
tst_lib: lib.c parser.h $(filter-out lib.o, ${TEST_OBJECTS})
$(CXX) $(TEST_CFLAGS) -o $@ $< $(filter-out $(<:.c=.o), ${TEST_OBJECTS}) $(TEST_LDFLAGS) $(TEST_LDLIBS)
@@ -304,10 +317,7 @@ tests: apparmor_parser ${TESTS}
sh -e -c 'for test in ${TESTS} ; do echo "*** running $${test}" && ./$${test}; done'
$(Q)$(MAKE) -s -C tst tests
# always need to rebuild.
.SILENT: $(AAREOBJECT)
.PHONY: $(AAREOBJECT)
$(AAREOBJECT):
$(AAREOBJECT): FORCE
$(MAKE) -C $(AAREDIR) CFLAGS="$(EXTRA_CXXFLAGS)"
.PHONY: install-rhel4
@@ -363,7 +373,9 @@ INSTALLDEPS+=install-$(DISTRO)
endif
.PHONY: install
install: install-indep install-arch
install:
$(MAKE) install-indep
$(MAKE) install-arch
.PHONY: install-arch
install-arch: $(INSTALLDEPS)
@@ -402,9 +414,10 @@ clean: pod_clean
rm -f parser_version.h
rm -f $(NAME)*.tar.gz $(NAME)*.tgz
rm -f af_names.h
rm -f cap_names.h
rm -f cap_names.h generated_cap_names.h
rm -rf techdoc.aux techdoc.out techdoc.log techdoc.pdf techdoc.toc techdoc.txt techdoc/
$(MAKE) -s -C $(AAREDIR) clean
$(MAKE) -s -C po clean
$(MAKE) -s -C tst clean
FORCE:

View File

@@ -151,9 +151,11 @@ int unix_rule::expand_variables(void)
error = expand_entry_variables(&addr);
if (error)
return error;
filter_slashes(addr);
error = expand_entry_variables(&peer_addr);
if (error)
return error;
filter_slashes(peer_addr);
return 0;
}
@@ -202,14 +204,18 @@ void unix_rule::downgrade_rule(Profile &prof) {
yyerror(_("Memory allocation error."));
if (sock_type_n != -1)
mask = 1 << sock_type_n;
if (deny) {
prof.net.deny[AF_UNIX] |= mask;
if (!audit)
prof.net.quiet[AF_UNIX] |= mask;
} else {
if (!deny) {
prof.net.allow[AF_UNIX] |= mask;
if (audit)
prof.net.audit[AF_UNIX] |= mask;
} else {
/* deny rules have to be dropped because the downgrade makes
* the rule less specific meaning it will make the profile more
* restrictive and may end up denying accesses that might be
* allowed by the profile.
*/
if (warnflags & WARN_RULE_NOT_ENFORCED)
warn_once(prof.name, "deny unix socket rule not enforced, can't be downgraded to generic network rule\n");
}
}

View File

@@ -664,7 +664,7 @@ and other operations that are typically reserved for the root user.
AppArmor supports simple coarse grained network mediation. The network
rule restrict all socket(2) based operations. The mediation done is
a course grained check on whether a socket of a given type and family
a coarse-grained check on whether a socket of a given type and family
can be created, read, or written. There is no mediation based of port
number or protocol beyond tcp, udp, and raw. Network netlink(7) rules may
only specify type 'dgram' and 'raw'.
@@ -1279,6 +1279,7 @@ provided AppArmor policy:
@{apparmorfs}
@{sys}
@{tid}
@{run}
@{XDG_DESKTOP_DIR}
@{XDG_DOWNLOAD_DIR}
@{XDG_TEMPLATES_DIR}

View File

@@ -314,12 +314,15 @@ Eg.
-jx4 OR --jobs=x4 sets the jobs to # of cpus * 4
-jx1 is equivalent to -jauto
The default value is the number of cpus in the system.
The default value is the number of cpus in the system. Note that if jobs
is a positive integer number the --jobs-max parameter is automatically
set to the same value.
=item --max-jobs n
Set a hard cap on the value that can be specified by the --jobs flag.
It takes the same set of options available to the --jobs option, and
When --jobs is set to a scaling value (ie. auto or xN) the specify a
hard cap on the value that can be specified by the --jobs flag. It
takes the same set of options available to the --jobs option, and
defaults to 8*cpus
=item -O n, --optimize=n

82
parser/base_cap_names.h Normal file
View File

@@ -0,0 +1,82 @@
{"audit_control", CAP_AUDIT_CONTROL},
{"audit_read", CAP_AUDIT_READ},
{"audit_write", CAP_AUDIT_WRITE},
{"block_suspend", CAP_BLOCK_SUSPEND},
{"bpf", CAP_BPF},
{"checkpoint_restore", CAP_CHECKPOINT_RESTORE},
{"chown", CAP_CHOWN},
{"dac_override", CAP_DAC_OVERRIDE},
{"dac_read_search", CAP_DAC_READ_SEARCH},
{"fowner", CAP_FOWNER},
{"fsetid", CAP_FSETID},
{"ipc_lock", CAP_IPC_LOCK},
{"ipc_owner", CAP_IPC_OWNER},
{"kill", CAP_KILL},
{"lease", CAP_LEASE},
{"linux_immutable", CAP_LINUX_IMMUTABLE},
{"mac_admin", CAP_MAC_ADMIN},
{"mac_override", CAP_MAC_OVERRIDE},
{"mknod", CAP_MKNOD},
{"net_admin", CAP_NET_ADMIN},
{"net_bind_service", CAP_NET_BIND_SERVICE},
{"net_broadcast", CAP_NET_BROADCAST},
{"net_raw", CAP_NET_RAW},
{"perfmon", CAP_PERFMON},
{"setfcap", CAP_SETFCAP},
{"setgid", CAP_SETGID},
{"setpcap", CAP_SETPCAP},
{"setuid", CAP_SETUID},
{"syslog", CAP_SYSLOG},
{"sys_admin", CAP_SYS_ADMIN},
{"sys_boot", CAP_SYS_BOOT},
{"sys_chroot", CAP_SYS_CHROOT},
{"sys_module", CAP_SYS_MODULE},
{"sys_nice", CAP_SYS_NICE},
{"sys_pacct", CAP_SYS_PACCT},
{"sys_ptrace", CAP_SYS_PTRACE},
{"sys_rawio", CAP_SYS_RAWIO},
{"sys_resource", CAP_SYS_RESOURCE},
{"sys_time", CAP_SYS_TIME},
{"sys_tty_config", CAP_SYS_TTY_CONFIG},
{"wake_alarm", CAP_WAKE_ALARM},

View File

@@ -179,6 +179,7 @@ int dbus_rule::expand_variables(void)
error = expand_entry_variables(&path);
if (error)
return error;
filter_slashes(path);
error = expand_entry_variables(&interface);
if (error)
return error;

View File

@@ -486,18 +486,32 @@ ostream &mnt_rule::dump(ostream &os)
/* does not currently support expansion of vars in options */
int mnt_rule::expand_variables(void)
{
struct value_list *ent;
int error = 0;
error = expand_entry_variables(&mnt_point);
if (error)
return error;
filter_slashes(mnt_point);
error = expand_entry_variables(&device);
if (error)
return error;
filter_slashes(device);
error = expand_entry_variables(&trans);
if (error)
return error;
list_for_each(dev_type, ent) {
error = expand_entry_variables(&ent->value);
if (error)
return error;
}
list_for_each(opts, ent) {
error = expand_entry_variables(&ent->value);
if (error)
return error;
}
return 0;
}

View File

@@ -367,6 +367,7 @@ extern int post_process_entry(struct cod_entry *entry);
extern int process_policydb(Profile *prof);
extern int process_policy_ents(Profile *prof);
extern void filter_slashes(char *path);
/* parser_variable.c */
int expand_entry_variables(char **name);

View File

@@ -24,6 +24,7 @@
%option noyywrap
%option nounput
%option stack
%option nodefault
%{
#include <stdio.h>
@@ -179,6 +180,7 @@ void include_filename(char *filename, int search, bool if_exists)
yypush_buffer_state(yy_create_buffer( yyin, YY_BUF_SIZE ));
} else if (S_ISDIR(my_stat.st_mode)) {
struct cb_struct data = { fullpath, filename };
update_mru_tstamp(include_file, fullpath);
fclose(include_file);
include_file = NULL;
if (dirat_for_each(AT_FDCWD, fullpath, &data, include_dir_cb)) {
@@ -240,7 +242,16 @@ ADD_ASSIGN \+=
ARROW ->
LT_EQUAL <=
/* IF adding new state please update state_names table at eof */
/* IF adding new state please update state_names table and default rule (just
* above the state_names table) at the eof.
*
* The nodefault option is set so missing adding to the default rule isn't
* fatal but can't take advantage of additional debug the default rule might
* have.
*
* If a state is not added to the default rule it can result in the message
* "flex scanner jammed"
*/
%x SUB_ID
%x SUB_ID_WS
%x SUB_VALUE
@@ -274,7 +285,7 @@ LT_EQUAL <=
}
%}
<INITIAL,SUB_ID_WS,INCLUDE,INCLUDE_EXISTS,LIST_VAL_MODE,EXTCOND_MODE,LIST_COND_VAL,LIST_COND_PAREN_VAL,LIST_COND_MODE,EXTCONDLIST_MODE,ASSIGN_MODE,NETWORK_MODE,CHANGE_PROFILE_MODE,RLIMIT_MODE,MOUNT_MODE,DBUS_MODE,SIGNAL_MODE,PTRACE_MODE,UNIX_MODE>{
<INITIAL,SUB_ID_WS,INCLUDE,INCLUDE_EXISTS,LIST_VAL_MODE,EXTCOND_MODE,LIST_COND_VAL,LIST_COND_PAREN_VAL,LIST_COND_MODE,EXTCONDLIST_MODE,ASSIGN_MODE,NETWORK_MODE,CHANGE_PROFILE_MODE,RLIMIT_MODE,MOUNT_MODE,DBUS_MODE,SIGNAL_MODE,PTRACE_MODE,UNIX_MODE,ABI_MODE>{
{WS}+ { DUMP_PREPROCESS; /* Ignoring whitespace */ }
}
@@ -469,6 +480,7 @@ LT_EQUAL <=
\\\n { DUMP_PREPROCESS; current_lineno++ ; }
\r?\n {
/* don't use shared rule because we need POP() here */
DUMP_PREPROCESS;
current_lineno++;
POP();
@@ -695,18 +707,20 @@ include/{WS} {
POP_NODUMP();
RETURN_TOKEN(TOK_END_OF_RULE);
}
}
\r?\n {
<INITIAL,SUB_ID_WS,INCLUDE,INCLUDE_EXISTS,LIST_VAL_MODE,EXTCOND_MODE,LIST_COND_VAL,LIST_COND_PAREN_VAL,LIST_COND_MODE,EXTCONDLIST_MODE,NETWORK_MODE,CHANGE_PROFILE_MODE,RLIMIT_MODE,MOUNT_MODE,DBUS_MODE,SIGNAL_MODE,PTRACE_MODE,UNIX_MODE,ABI_MODE>{
\r?\n {
DUMP_PREPROCESS;
current_lineno++;
}
}
<INITIAL,SUB_ID,SUB_ID_WS,SUB_VALUE,LIST_VAL_MODE,EXTCOND_MODE,LIST_COND_VAL,LIST_COND_PAREN_VAL,LIST_COND_MODE,EXTCONDLIST_MODE,ASSIGN_MODE,NETWORK_MODE,CHANGE_PROFILE_MODE,MOUNT_MODE,DBUS_MODE,SIGNAL_MODE,PTRACE_MODE,UNIX_MODE>{
[^\n] {
<INITIAL,SUB_ID,SUB_ID_WS,SUB_VALUE,LIST_VAL_MODE,EXTCOND_MODE,LIST_COND_VAL,LIST_COND_PAREN_VAL,LIST_COND_MODE,EXTCONDLIST_MODE,ASSIGN_MODE,NETWORK_MODE,CHANGE_PROFILE_MODE,MOUNT_MODE,DBUS_MODE,SIGNAL_MODE,PTRACE_MODE,UNIX_MODE,RLIMIT_MODE,INCLUDE,INCLUDE_EXISTS,ABI_MODE>{
(.|\n) {
DUMP_PREPROCESS;
/* Something we didn't expect */
yyerror(_("Found unexpected character: '%s'"), yytext);
yyerror(_("Lexer found unexpected character: '%s' (0x%x) in state: %s"), yytext, yytext[0], state_names[YY_START].c_str());
}
}
%%

View File

@@ -638,6 +638,8 @@ static int process_arg(int c, char *optarg)
break;
case 'j':
jobs = process_jobs_arg("-j", optarg);
if (jobs != JOBS_AUTO && jobs < LONG_MAX)
jobs_max = jobs;
break;
case 136:
jobs_max = process_jobs_arg("max-jobs", optarg);
@@ -1183,6 +1185,8 @@ static void setup_parallel_compile(void)
if (maxn == -1)
/* unable to determine number of processors, default to 1 */
maxn = 1;
if (jobs < 0 || jobs == JOBS_AUTO)
jobs_scale = 1;
jobs = compute_jobs(n, jobs);
jobs_max = compute_jobs(maxn, jobs_max);
@@ -1190,7 +1194,7 @@ static void setup_parallel_compile(void)
pwarn("%s: Warning capping number of jobs to %ld * # of cpus == '%ld'",
progname, jobs_max, jobs);
jobs = jobs_max;
} else if (jobs < jobs_max)
} else if (jobs_scale && jobs < jobs_max)
/* the bigger the difference the more sample chances given */
jobs_scale = jobs_max + 1 - n;

View File

@@ -61,9 +61,14 @@ int is_blacklisted(const char *name, const char *path)
return !retval ? 0 : 1;
}
/*
* WARNING: if the format of the following table is changed then
* the Makefile targets, cap_names.h and generated_cap_names.h
* must be updated.
*/
struct keyword_table {
const char *keyword;
int token;
unsigned int token;
};
static struct keyword_table keyword_table[] = {
@@ -165,12 +170,59 @@ static int get_table_token(const char *name unused, struct keyword_table *table,
return -1;
}
#ifndef CAP_AUDIT_WRITE
#define CAP_AUDIT_WRITE 29
#endif
#ifndef CAP_AUDIT_CONTROL
#define CAP_AUDIT_CONTROL 30
#endif
#ifndef CAP_SETFCAP
#define CAP_SETFCAP 31
#endif
#ifndef CAP_MAC_OVERRIDE
#define CAP_MAC_OVERRIDE 32
#endif
#ifndef CAP_MAC_ADMIN
#define CAP_MAC_ADMIN 33
#endif
#ifndef CAP_SYSLOG
#define CAP_SYSLOG 34
#endif
#ifndef CAP_WAKE_ALARM
#define CAP_WAKE_ALARM 35
#endif
#ifndef CAP_BLOCK_SUSPEND
#define CAP_BLOCK_SUSPEND 36
#endif
#ifndef CAP_AUDIT_READ
#define CAP_AUDIT_READ 37
#endif
#ifndef CAP_PERFMON
#define CAP_PERFMON 38
#endif
#ifndef CAP_BPF
#define CAP_BPF 39
#endif
#ifndef CAP_CHECKPOINT_RESTORE
#define CAP_CHECKPOINT_RESTORE 40
#endif
static struct keyword_table capability_table[] = {
/* capabilities */
#include "cap_names.h"
#ifndef CAP_SYSLOG
{"syslog", 34},
#endif
/* terminate */
{NULL, 0}
};
@@ -832,52 +884,16 @@ void debug_cod_entries(struct cod_entry *list)
}
}
static const char *capnames[] = {
"chown",
"dac_override",
"dac_read_search",
"fowner",
"fsetid",
"kill",
"setgid",
"setuid",
"setpcap",
"linux_immutable",
"net_bind_service",
"net_broadcast",
"net_admin",
"net_raw",
"ipc_lock",
"ipc_owner",
"sys_module",
"sys_rawio",
"sys_chroot",
"sys_ptrace",
"sys_pacct",
"sys_admin",
"sys_boot",
"sys_nice",
"sys_resource",
"sys_time",
"sys_tty_config",
"mknod",
"lease",
"audit_write",
"audit_control",
"setfcap",
"mac_override",
"syslog",
};
const char *capability_to_name(unsigned int cap)
{
const char *capname;
int i;
capname = (cap < (sizeof(capnames) / sizeof(char *))
? capnames[cap] : "invalid-capability");
for (i = 0; capability_table[i].keyword; i++) {
if (capability_table[i].token == cap)
return capability_table[i].keyword;
}
return capname;
return "invalid-capability";
}
void __debug_capabilities(uint64_t capset, const char *name)
@@ -885,10 +901,10 @@ void __debug_capabilities(uint64_t capset, const char *name)
unsigned int i;
printf("%s:", name);
for (i = 0; i < (sizeof(capnames)/sizeof(char *)); i++) {
if (((1ull << i) & capset) != 0) {
printf (" %s", capability_to_name(i));
}
for (i = 0; capability_table[i].keyword; i++) {
if ((1ull << capability_table[i].token) & capset)
printf (" %s", capability_table[i].keyword);
}
printf("\n");
}

View File

@@ -204,9 +204,8 @@ static int profile_add_hat_rules(Profile *prof)
{
struct cod_entry *entry;
/* TODO: ??? fix logic for when to add to hat/base vs. local */
/* don't add hat rules for local_profiles or base profiles */
if (prof->local || prof->hat_table.empty())
/* don't add hat rules if not hat or profile doesn't have hats */
if (!prof->flags.hat || !prof->hat_table.empty())
return 0;
/* add entry to hat */

View File

@@ -47,7 +47,7 @@ enum error_type {
* that's a distinct namespace in linux) and trailing slashes.
* NOTE: modifies in place the contents of the path argument */
static void filter_slashes(char *path)
void filter_slashes(char *path)
{
char *sptr, *dptr;
BOOL seen_slash = 0;
@@ -564,6 +564,7 @@ static int process_dfa_entry(aare_rules *dfarules, struct cod_entry *entry)
int pos;
vec[0] = tbuf.c_str();
if (entry->link_name) {
filter_slashes(entry->link_name);
ptype = convert_aaregex_to_pcre(entry->link_name, 0, glob_default, lbuf, &pos);
if (ptype == ePatternInvalid)
return FALSE;

View File

@@ -1,5 +1,5 @@
# SOME DESCRIPTIVE TITLE.
# Copyright (C) YEAR NOVELL, Inc.
# Copyright (C) YEAR Canonical Ltd
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
@@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: apparmor@lists.ubuntu.com\n"
"POT-Creation-Date: 2014-09-13 00:11-0700\n"
"POT-Creation-Date: 2020-10-14 03:35-0700\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -17,95 +17,106 @@ msgstr ""
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
#: ../parser_include.c:113 ../parser_include.c:111
#: ../parser_include.c:113 ../parser_include.c:111 ../parser_include.c:114
msgid "Error: Out of memory.\n"
msgstr ""
#: ../parser_include.c:123 ../parser_include.c:121
#: ../parser_include.c:123 ../parser_include.c:121 ../parser_include.c:124
#, c-format
msgid "Error: basedir %s is not a directory, skipping.\n"
msgstr ""
#: ../parser_include.c:137
#: ../parser_include.c:137 ../parser_include.c:140
#, c-format
msgid "Error: Could not add directory %s to search path.\n"
msgstr ""
#: ../parser_include.c:147 ../parser_include.c:151
#: ../parser_include.c:147 ../parser_include.c:151 ../parser_include.c:154
msgid "Error: Could not allocate memory.\n"
msgstr ""
#: ../parser_interface.c:69 ../parser_interface.c:72 ../parser_interface.c:49
#: ../parser_interface.c:52
msgid "Bad write position\n"
msgstr ""
#: ../parser_interface.c:72 ../parser_interface.c:75 ../parser_interface.c:52
#: ../parser_interface.c:55
msgid "Permission denied\n"
msgstr ""
#: ../parser_interface.c:75 ../parser_interface.c:78 ../parser_interface.c:55
#: ../parser_interface.c:58
msgid "Out of memory\n"
msgstr ""
#: ../parser_interface.c:78 ../parser_interface.c:81 ../parser_interface.c:58
#: ../parser_interface.c:61
msgid "Couldn't copy profile: Bad memory address\n"
msgstr ""
#: ../parser_interface.c:81 ../parser_interface.c:84 ../parser_interface.c:61
#: ../parser_interface.c:64
msgid "Profile doesn't conform to protocol\n"
msgstr ""
#: ../parser_interface.c:84 ../parser_interface.c:87 ../parser_interface.c:64
#: ../parser_interface.c:67
msgid "Profile does not match signature\n"
msgstr ""
#: ../parser_interface.c:87 ../parser_interface.c:90 ../parser_interface.c:67
#: ../parser_interface.c:70
msgid "Profile version not supported by Apparmor module\n"
msgstr ""
#: ../parser_interface.c:90 ../parser_interface.c:93 ../parser_interface.c:70
#: ../parser_interface.c:73
msgid "Profile already exists\n"
msgstr ""
#: ../parser_interface.c:93 ../parser_interface.c:96 ../parser_interface.c:73
#: ../parser_interface.c:76
msgid "Profile doesn't exist\n"
msgstr ""
#: ../parser_interface.c:96 ../parser_interface.c:99 ../parser_interface.c:76
#: ../parser_interface.c:79
msgid "Permission denied; attempted to load a profile while confined?\n"
msgstr ""
#: ../parser_interface.c:99 ../parser_interface.c:102 ../parser_interface.c:79
#: ../parser_interface.c:82
#, c-format
msgid "Unknown error (%d): %s\n"
msgstr ""
#: ../parser_interface.c:116 ../parser_interface.c:119
#: ../parser_interface.c:96
#: ../parser_interface.c:116 ../parser_interface.c:119 ../parser_interface.c:96
#: ../parser_interface.c:100
#, c-format
msgid "%s: Unable to add \"%s\". "
msgstr ""
#: ../parser_interface.c:121 ../parser_interface.c:124
#: ../parser_interface.c:101
#: ../parser_interface.c:101 ../parser_interface.c:105
#, c-format
msgid "%s: Unable to replace \"%s\". "
msgstr ""
#: ../parser_interface.c:126 ../parser_interface.c:129
#: ../parser_interface.c:106
#: ../parser_interface.c:106 ../parser_interface.c:110
#, c-format
msgid "%s: Unable to remove \"%s\". "
msgstr ""
#: ../parser_interface.c:131 ../parser_interface.c:134
#: ../parser_interface.c:111
#: ../parser_interface.c:111 ../parser_interface.c:115
#, c-format
msgid "%s: Unable to write to stdout\n"
msgstr ""
#: ../parser_interface.c:135 ../parser_interface.c:138
#: ../parser_interface.c:115
#: ../parser_interface.c:115 ../parser_interface.c:119
#, c-format
msgid "%s: Unable to write to output file\n"
msgstr ""
@@ -113,24 +124,25 @@ msgstr ""
#: ../parser_interface.c:138 ../parser_interface.c:162
#: ../parser_interface.c:141 ../parser_interface.c:165
#: ../parser_interface.c:118 ../parser_interface.c:142
#: ../parser_interface.c:122 ../parser_interface.c:146
#, c-format
msgid "%s: ASSERT: Invalid option: %d\n"
msgstr ""
#: ../parser_interface.c:147 ../parser_interface.c:150
#: ../parser_interface.c:127
#: ../parser_interface.c:127 ../parser_interface.c:131
#, c-format
msgid "Addition succeeded for \"%s\".\n"
msgstr ""
#: ../parser_interface.c:151 ../parser_interface.c:154
#: ../parser_interface.c:131
#: ../parser_interface.c:131 ../parser_interface.c:135
#, c-format
msgid "Replacement succeeded for \"%s\".\n"
msgstr ""
#: ../parser_interface.c:155 ../parser_interface.c:158
#: ../parser_interface.c:135
#: ../parser_interface.c:135 ../parser_interface.c:139
#, c-format
msgid "Removal succeeded for \"%s\".\n"
msgstr ""
@@ -141,7 +153,7 @@ msgid "PANIC bad increment buffer %p pos %p ext %p size %d res %p\n"
msgstr ""
#: ../parser_interface.c:656 ../parser_interface.c:658
#: ../parser_interface.c:446
#: ../parser_interface.c:446 ../parser_interface.c:448
#, c-format
msgid "profile %s network rules not enforced\n"
msgstr ""
@@ -186,12 +198,12 @@ msgid "%s: Unable to write entire profile entry\n"
msgstr ""
#: ../parser_interface.c:839 ../parser_interface.c:831
#: ../parser_interface.c:593
#: ../parser_interface.c:593 ../parser_interface.c:551
#, c-format
msgid "%s: Unable to write entire profile entry to cache\n"
msgstr ""
#: parser_lex.l:100 parser_lex.l:163 parser_lex.l:169
#: parser_lex.l:100 parser_lex.l:163 parser_lex.l:169 parser_lex.l:168
#, c-format
msgid "Could not open '%s'"
msgstr ""
@@ -211,7 +223,7 @@ msgstr ""
msgid "stat failed for '%s'"
msgstr ""
#: parser_lex.l:155 parser_lex.l:133 parser_lex.l:139
#: parser_lex.l:155 parser_lex.l:133 parser_lex.l:139 parser_lex.l:138
#, c-format
msgid "Could not open '%s' in '%s'"
msgstr ""
@@ -222,7 +234,7 @@ msgstr ""
msgid "Found unexpected character: '%s'"
msgstr ""
#: parser_lex.l:386 parser_lex.l:418 parser_lex.l:428
#: parser_lex.l:386 parser_lex.l:418 parser_lex.l:428 parser_lex.l:477
msgid "Variable declarations do not accept trailing commas"
msgstr ""
@@ -232,6 +244,7 @@ msgid "(network_mode) Found unexpected character: '%s'"
msgstr ""
#: ../parser_main.c:333 ../parser_common.c:61 ../parser_common.c:106
#: ../parser_common.c:107
#, c-format
msgid "Warning from %s (%s%sline %d): %s"
msgstr ""
@@ -242,6 +255,7 @@ msgid "%s: Could not allocate memory for subdomainbase mount point\n"
msgstr ""
#: ../parser_main.c:577 ../parser_main.c:616 ../parser_main.c:479
#: ../parser_main.c:1302
#, c-format
msgid ""
"Warning: unable to find a suitable fs in %s, is it mounted?\n"
@@ -249,6 +263,7 @@ msgid ""
msgstr ""
#: ../parser_main.c:597 ../parser_main.c:635 ../parser_main.c:498
#: ../parser_main.c:730
#, c-format
msgid ""
"%s: Sorry. You need root privileges to run this program.\n"
@@ -256,6 +271,7 @@ msgid ""
msgstr ""
#: ../parser_main.c:604 ../parser_main.c:642 ../parser_main.c:505
#: ../parser_main.c:736
#, c-format
msgid ""
"%s: Warning! You've set this program setuid root.\n"
@@ -264,7 +280,7 @@ msgid ""
msgstr ""
#: ../parser_main.c:704 ../parser_main.c:813 ../parser_main.c:836
#: ../parser_main.c:946 ../parser_main.c:860
#: ../parser_main.c:946 ../parser_main.c:860 ../parser_main.c:925
#, c-format
msgid "Error: Could not read profile %s: %s.\n"
msgstr ""
@@ -286,26 +302,36 @@ msgstr ""
#: parser_yacc.y:1166 parser_yacc.y:1170 parser_yacc.y:1180 parser_yacc.y:1190
#: parser_yacc.y:1298 parser_yacc.y:1376 parser_yacc.y:1479 parser_yacc.y:1490
#: parser_yacc.y:1565 parser_yacc.y:1583 parser_yacc.y:1590 parser_yacc.y:1639
#: ../network.c:314 ../af_unix.cc:203
#: ../network.c:314 ../af_unix.cc:203 ../parser_misc.c:729 parser_yacc.y:315
#: parser_yacc.y:339 parser_yacc.y:493 parser_yacc.y:503 parser_yacc.y:614
#: parser_yacc.y:695 parser_yacc.y:702 parser_yacc.y:1116 parser_yacc.y:1164
#: parser_yacc.y:1200 parser_yacc.y:1204 parser_yacc.y:1214 parser_yacc.y:1224
#: parser_yacc.y:1318 parser_yacc.y:1396 parser_yacc.y:1529 parser_yacc.y:1534
#: parser_yacc.y:1608 parser_yacc.y:1626 parser_yacc.y:1633 parser_yacc.y:1682
#: ../network.c:315 ../af_unix.cc:204
msgid "Memory allocation error."
msgstr ""
#: ../parser_main.c:740 ../parser_main.c:872 ../parser_main.c:757
#: ../parser_main.c:866
#, c-format
msgid "Cached load succeeded for \"%s\".\n"
msgstr ""
#: ../parser_main.c:744 ../parser_main.c:876 ../parser_main.c:761
#: ../parser_main.c:870
#, c-format
msgid "Cached reload succeeded for \"%s\".\n"
msgstr ""
#: ../parser_main.c:910 ../parser_main.c:1058 ../parser_main.c:967
#: ../parser_main.c:1019
#, c-format
msgid "%s: Errors found in file. Aborting.\n"
msgstr ""
#: ../parser_misc.c:426 ../parser_misc.c:597 ../parser_misc.c:339
#: ../parser_misc.c:322
msgid ""
"Uppercase qualifiers \"RWLIMX\" are deprecated, please convert to lowercase\n"
"See the apparmor.d(5) manpage for details.\n"
@@ -313,14 +339,17 @@ msgstr ""
#: ../parser_misc.c:467 ../parser_misc.c:474 ../parser_misc.c:638
#: ../parser_misc.c:645 ../parser_misc.c:380 ../parser_misc.c:387
#: ../parser_misc.c:363 ../parser_misc.c:370
msgid "Conflict 'a' and 'w' perms are mutually exclusive."
msgstr ""
#: ../parser_misc.c:491 ../parser_misc.c:662 ../parser_misc.c:404
#: ../parser_misc.c:387
msgid "Exec qualifier 'i' invalid, conflicting qualifier already specified"
msgstr ""
#: ../parser_misc.c:502 ../parser_misc.c:673 ../parser_misc.c:415
#: ../parser_misc.c:398
#, c-format
msgid ""
"Unconfined exec qualifier (%c%c) allows some dangerous environment variables "
@@ -329,22 +358,26 @@ msgstr ""
#: ../parser_misc.c:510 ../parser_misc.c:551 ../parser_misc.c:681
#: ../parser_misc.c:722 ../parser_misc.c:423 ../parser_misc.c:464
#: ../parser_misc.c:406 ../parser_misc.c:447
#, c-format
msgid "Exec qualifier '%c' invalid, conflicting qualifier already specified"
msgstr ""
#: ../parser_misc.c:537 ../parser_misc.c:545 ../parser_misc.c:708
#: ../parser_misc.c:716 ../parser_misc.c:450 ../parser_misc.c:458
#: ../parser_misc.c:433 ../parser_misc.c:441
#, c-format
msgid "Exec qualifier '%c%c' invalid, conflicting qualifier already specified"
msgstr ""
#: ../parser_misc.c:593 ../parser_misc.c:764 ../parser_misc.c:506
#: ../parser_misc.c:489
#, c-format
msgid "Internal: unexpected mode character '%c' in input"
msgstr ""
#: ../parser_misc.c:615 ../parser_misc.c:786 ../parser_misc.c:528
#: ../parser_misc.c:511
#, c-format
msgid "Internal error generated invalid perm 0x%llx\n"
msgstr ""
@@ -356,10 +389,12 @@ msgid "AppArmor parser error: %s\n"
msgstr ""
#: ../parser_merge.c:92 ../parser_merge.c:91 ../parser_merge.c:83
#: ../parser_merge.c:71
msgid "Couldn't merge entries. Out of Memory\n"
msgstr ""
#: ../parser_merge.c:111 ../parser_merge.c:113 ../parser_merge.c:105
#: ../parser_merge.c:93
#, c-format
msgid "profile %s: has merged rule %s with conflicting x modifiers\n"
msgstr ""
@@ -368,119 +403,122 @@ msgstr ""
msgid "Profile attachment must begin with a '/'."
msgstr ""
#: parser_yacc.y:260 parser_yacc.y:302 parser_yacc.y:348
#: parser_yacc.y:260 parser_yacc.y:302 parser_yacc.y:348 parser_yacc.y:373
msgid ""
"Profile names must begin with a '/', namespace or keyword 'profile' or 'hat'."
msgstr ""
#: parser_yacc.y:296 parser_yacc.y:338 parser_yacc.y:384
#: parser_yacc.y:296 parser_yacc.y:338 parser_yacc.y:384 parser_yacc.y:409
#, c-format
msgid "Failed to create alias %s -> %s\n"
msgstr ""
#: parser_yacc.y:417 parser_yacc.y:460 parser_yacc.y:506
#: parser_yacc.y:417 parser_yacc.y:460 parser_yacc.y:506 parser_yacc.y:537
msgid "Profile flag chroot_relative conflicts with namespace_relative"
msgstr ""
#: parser_yacc.y:421 parser_yacc.y:464 parser_yacc.y:510
#: parser_yacc.y:421 parser_yacc.y:464 parser_yacc.y:510 parser_yacc.y:541
msgid "Profile flag mediate_deleted conflicts with delegate_deleted"
msgstr ""
#: parser_yacc.y:424 parser_yacc.y:467 parser_yacc.y:513
#: parser_yacc.y:424 parser_yacc.y:467 parser_yacc.y:513 parser_yacc.y:544
msgid "Profile flag attach_disconnected conflicts with no_attach_disconnected"
msgstr ""
#: parser_yacc.y:427 parser_yacc.y:470 parser_yacc.y:516
#: parser_yacc.y:427 parser_yacc.y:470 parser_yacc.y:516 parser_yacc.y:547
msgid "Profile flag chroot_attach conflicts with chroot_no_attach"
msgstr ""
#: parser_yacc.y:441 parser_yacc.y:484 parser_yacc.y:530
#: parser_yacc.y:441 parser_yacc.y:484 parser_yacc.y:530 parser_yacc.y:561
msgid "Profile flag 'debug' is no longer valid."
msgstr ""
#: parser_yacc.y:463 parser_yacc.y:506 parser_yacc.y:552
#: parser_yacc.y:463 parser_yacc.y:506 parser_yacc.y:552 parser_yacc.y:583
#, c-format
msgid "Invalid profile flag: %s."
msgstr ""
#: parser_yacc.y:498 parser_yacc.y:520 parser_yacc.y:548 parser_yacc.y:594
#: parser_yacc.y:627
msgid "Assert: `rule' returned NULL."
msgstr ""
#: parser_yacc.y:501 parser_yacc.y:546 parser_yacc.y:552 parser_yacc.y:584
#: parser_yacc.y:598 parser_yacc.y:630
#: parser_yacc.y:598 parser_yacc.y:630 parser_yacc.y:631 parser_yacc.y:663
msgid ""
"Invalid mode, in deny rules 'x' must not be preceded by exec qualifier 'i', "
"'p', or 'u'"
msgstr ""
#: parser_yacc.y:524 parser_yacc.y:556 parser_yacc.y:602
#: parser_yacc.y:524 parser_yacc.y:556 parser_yacc.y:602 parser_yacc.y:635
msgid ""
"Invalid mode, 'x' must be preceded by exec qualifier 'i', 'p', 'c', or 'u'"
msgstr ""
#: parser_yacc.y:549 parser_yacc.y:587 parser_yacc.y:633
#: parser_yacc.y:549 parser_yacc.y:587 parser_yacc.y:633 parser_yacc.y:666
msgid "Invalid mode, 'x' must be preceded by exec qualifier 'i', 'p', or 'u'"
msgstr ""
#: parser_yacc.y:574 parser_yacc.y:612 parser_yacc.y:614 parser_yacc.y:660
#: parser_yacc.y:693
msgid "Assert: `network_rule' return invalid protocol."
msgstr ""
#: parser_yacc.y:649 parser_yacc.y:696 parser_yacc.y:786
#: parser_yacc.y:649 parser_yacc.y:696 parser_yacc.y:786 parser_yacc.y:819
msgid "Assert: `change_profile' returned NULL."
msgstr ""
#: parser_yacc.y:680 parser_yacc.y:720 parser_yacc.y:810
#: parser_yacc.y:680 parser_yacc.y:720 parser_yacc.y:810 parser_yacc.y:857
msgid "Assert: 'hat rule' returned NULL."
msgstr ""
#: parser_yacc.y:689 parser_yacc.y:729 parser_yacc.y:819
#: parser_yacc.y:689 parser_yacc.y:729 parser_yacc.y:819 parser_yacc.y:866
msgid "Assert: 'local_profile rule' returned NULL."
msgstr ""
#: parser_yacc.y:824 parser_yacc.y:885 parser_yacc.y:992
#: parser_yacc.y:824 parser_yacc.y:885 parser_yacc.y:992 parser_yacc.y:1029
#, c-format
msgid "Unset boolean variable %s used in if-expression"
msgstr ""
#: parser_yacc.y:882 parser_yacc.y:986 parser_yacc.y:1092
#: parser_yacc.y:882 parser_yacc.y:986 parser_yacc.y:1092 parser_yacc.y:1126
msgid "unsafe rule missing exec permissions"
msgstr ""
#: parser_yacc.y:901 parser_yacc.y:954 parser_yacc.y:1060
#: parser_yacc.y:901 parser_yacc.y:954 parser_yacc.y:1060 parser_yacc.y:1093
msgid "subset can only be used with link rules."
msgstr ""
#: parser_yacc.y:903 parser_yacc.y:956 parser_yacc.y:1062
#: parser_yacc.y:903 parser_yacc.y:956 parser_yacc.y:1062 parser_yacc.y:1095
msgid "link and exec perms conflict on a file rule using ->"
msgstr ""
#: parser_yacc.y:905 parser_yacc.y:958 parser_yacc.y:1064
#: parser_yacc.y:905 parser_yacc.y:958 parser_yacc.y:1064 parser_yacc.y:1097
msgid "link perms are not allowed on a named profile transition.\n"
msgstr ""
#: parser_yacc.y:921 parser_yacc.y:1003 parser_yacc.y:1109
#: parser_yacc.y:921 parser_yacc.y:1003 parser_yacc.y:1109 parser_yacc.y:1143
#, c-format
msgid "missing an end of line character? (entry: %s)"
msgstr ""
#: parser_yacc.y:975 parser_yacc.y:985 parser_yacc.y:1057 parser_yacc.y:1067
#: parser_yacc.y:1145 parser_yacc.y:1155
#: parser_yacc.y:1145 parser_yacc.y:1155 parser_yacc.y:1179 parser_yacc.y:1189
msgid "Invalid network entry."
msgstr ""
#: parser_yacc.y:1039 parser_yacc.y:1048 parser_yacc.y:1254 parser_yacc.y:1510
#: parser_yacc.y:1554
#, c-format
msgid "Invalid capability %s."
msgstr ""
#: parser_yacc.y:1066 parser_yacc.y:1269 parser_yacc.y:1525
#: parser_yacc.y:1066 parser_yacc.y:1269 parser_yacc.y:1525 parser_yacc.y:1569
#, c-format
msgid "AppArmor parser error for %s%s%s at line %d: %s\n"
msgstr ""
#: parser_yacc.y:1072 parser_yacc.y:1275 parser_yacc.y:1531
#: parser_yacc.y:1072 parser_yacc.y:1275 parser_yacc.y:1531 parser_yacc.y:1575
#, c-format
msgid "AppArmor parser error,%s%s line %d: %s\n"
msgstr ""
@@ -491,17 +529,20 @@ msgid "%s: Illegal open {, nesting groupings not allowed\n"
msgstr ""
#: ../parser_regex.c:265 ../parser_regex.c:274 ../parser_regex.c:278
#: ../parser_regex.c:295
#, c-format
msgid "%s: Regex grouping error: Invalid number of items between {}\n"
msgstr ""
#: ../parser_regex.c:271 ../parser_regex.c:280 ../parser_regex.c:284
#: ../parser_regex.c:301
#, c-format
msgid ""
"%s: Regex grouping error: Invalid close }, no matching open { detected\n"
msgstr ""
#: ../parser_regex.c:337 ../parser_regex.c:343 ../parser_regex.c:361
#: ../parser_regex.c:392
#, c-format
msgid ""
"%s: Regex grouping error: Unclosed grouping or character class, expecting "
@@ -514,16 +555,19 @@ msgid "%s: Internal buffer overflow detected, %d characters exceeded\n"
msgstr ""
#: ../parser_regex.c:355 ../parser_regex.c:361 ../parser_regex.c:377
#: ../parser_regex.c:408
#, c-format
msgid "%s: Unable to parse input line '%s'\n"
msgstr ""
#: ../parser_regex.c:397 ../parser_regex.c:405 ../parser_regex.c:421
#: ../parser_regex.c:452
#, c-format
msgid "%s: Invalid profile name '%s' - bad regular expression\n"
msgstr ""
#: ../parser_policy.c:202 ../parser_policy.c:402 ../parser_policy.c:375
#: ../parser_policy.c:378
#, c-format
msgid "ERROR merging rules for profile %s, failed to load\n"
msgstr ""
@@ -537,16 +581,19 @@ msgid ""
msgstr ""
#: ../parser_policy.c:279 ../parser_policy.c:359 ../parser_policy.c:332
#: ../parser_policy.c:335
#, c-format
msgid "ERROR processing regexs for profile %s, failed to load\n"
msgstr ""
#: ../parser_policy.c:306 ../parser_policy.c:389 ../parser_policy.c:362
#: ../parser_policy.c:365
#, c-format
msgid "ERROR expanding variables for profile %s, failed to load\n"
msgstr ""
#: ../parser_policy.c:390 ../parser_policy.c:382 ../parser_policy.c:355
#: ../parser_policy.c:358
#, c-format
msgid "ERROR adding hat access rule for profile %s\n"
msgstr ""
@@ -586,7 +633,7 @@ msgid "Feature buffer full."
msgstr ""
#: ../parser_main.c:1115 ../parser_main.c:1132 ../parser_main.c:1024
#: ../parser_main.c:1041
#: ../parser_main.c:1041 ../parser_main.c:1218 ../parser_main.c:1240
msgid "Out of memory"
msgstr ""
@@ -615,11 +662,11 @@ msgstr ""
msgid "Internal error generated invalid DBus perm 0x%x\n"
msgstr ""
#: parser_yacc.y:575 parser_yacc.y:621
#: parser_yacc.y:575 parser_yacc.y:621 parser_yacc.y:654
msgid "deny prefix not allowed"
msgstr ""
#: parser_yacc.y:612 parser_yacc.y:658
#: parser_yacc.y:612 parser_yacc.y:658 parser_yacc.y:691
msgid "owner prefix not allowed"
msgstr ""
@@ -635,41 +682,41 @@ msgstr ""
msgid "owner prefix not allow on capability rules"
msgstr ""
#: parser_yacc.y:1357 parser_yacc.y:1613
#: parser_yacc.y:1357 parser_yacc.y:1613 parser_yacc.y:1656
#, c-format
msgid "invalid mount conditional %s%s"
msgstr ""
#: parser_yacc.y:1374 parser_yacc.y:1628
#: parser_yacc.y:1374 parser_yacc.y:1628 parser_yacc.y:1671
msgid "bad mount rule"
msgstr ""
#: parser_yacc.y:1381 parser_yacc.y:1635
#: parser_yacc.y:1381 parser_yacc.y:1635 parser_yacc.y:1678
msgid "mount point conditions not currently supported"
msgstr ""
#: parser_yacc.y:1398 parser_yacc.y:1650
#: parser_yacc.y:1398 parser_yacc.y:1650 parser_yacc.y:1693
#, c-format
msgid "invalid pivotroot conditional '%s'"
msgstr ""
#: ../parser_regex.c:241 ../parser_regex.c:236
#: ../parser_regex.c:241 ../parser_regex.c:236 ../parser_regex.c:253
#, c-format
msgid ""
"%s: Regex grouping error: Invalid close ], no matching open [ detected\n"
msgstr ""
#: ../parser_regex.c:257 ../parser_regex.c:256
#: ../parser_regex.c:257 ../parser_regex.c:256 ../parser_regex.c:273
#, c-format
msgid "%s: Regex grouping error: Exceeded maximum nesting of {}\n"
msgstr ""
#: ../parser_policy.c:366 ../parser_policy.c:339
#: ../parser_policy.c:366 ../parser_policy.c:339 ../parser_policy.c:342
#, c-format
msgid "ERROR processing policydb rules for profile %s, failed to load\n"
msgstr ""
#: ../parser_policy.c:396 ../parser_policy.c:369
#: ../parser_policy.c:396 ../parser_policy.c:369 ../parser_policy.c:372
#, c-format
msgid "ERROR replacing aliases for profile %s, failed to load\n"
msgstr ""
@@ -689,51 +736,170 @@ msgstr ""
msgid "Error: Could not read cache file '%s', skipping...\n"
msgstr ""
#: ../parser_misc.c:575
#: ../parser_misc.c:575 ../parser_misc.c:558
#, c-format
msgid "Internal: unexpected %s mode character '%c' in input"
msgstr ""
#: ../parser_misc.c:599
#: ../parser_misc.c:599 ../parser_misc.c:582
#, c-format
msgid "Internal error generated invalid %s perm 0x%x\n"
msgstr ""
#: parser_yacc.y:703
#: parser_yacc.y:703 parser_yacc.y:736
msgid "owner prefix not allowed on mount rules"
msgstr ""
#: parser_yacc.y:720
#: parser_yacc.y:720 parser_yacc.y:753
msgid "owner prefix not allowed on dbus rules"
msgstr ""
#: parser_yacc.y:736
#: parser_yacc.y:736 parser_yacc.y:769
msgid "owner prefix not allowed on signal rules"
msgstr ""
#: parser_yacc.y:752
#: parser_yacc.y:752 parser_yacc.y:785
msgid "owner prefix not allowed on ptrace rules"
msgstr ""
#: parser_yacc.y:768
#: parser_yacc.y:768 parser_yacc.y:801 parser_yacc.y:821
msgid "owner prefix not allowed on unix rules"
msgstr ""
#: parser_yacc.y:794
#: parser_yacc.y:794 parser_yacc.y:837
msgid "owner prefix not allowed on capability rules"
msgstr ""
#: parser_yacc.y:1293
#: parser_yacc.y:1293 parser_yacc.y:1313
#, c-format
msgid "dbus rule: invalid conditional group %s=()"
msgstr ""
#: parser_yacc.y:1371
#: parser_yacc.y:1371 parser_yacc.y:1391
#, c-format
msgid "unix rule: invalid conditional group %s=()"
msgstr ""
#: ../parser_regex.c:368
#: ../parser_regex.c:368 ../parser_regex.c:399
#, c-format
msgid "%s: Regex error: trailing '\\' escape character\n"
msgstr ""
#: ../parser_interface.c:496
#, c-format
msgid "Unable to open stdout - %s\n"
msgstr ""
#: ../parser_interface.c:505
#, c-format
msgid "Unable to open output file - %s\n"
msgstr ""
#: parser_lex.l:337
msgid "Failed to process filename\n"
msgstr ""
#: parser_lex.l:723
#, c-format
msgid "Lexer found unexpected character: '%s' (0x%x) in state: %s"
msgstr ""
#: ../parser_main.c:806
#, c-format
msgid "Unable to print the cache directory: %m\n"
msgstr ""
#: ../parser_main.c:842
#, c-format
msgid "Error: Could not load profile %s: %s\n"
msgstr ""
#: ../parser_main.c:852
#, c-format
msgid "Error: Could not replace profile %s: %s\n"
msgstr ""
#: ../parser_main.c:857
#, c-format
msgid "Error: Invalid load option specified: %d\n"
msgstr ""
#: ../parser_main.c:964
#, c-format
msgid "Could not get cachename for '%s'\n"
msgstr ""
#: ../parser_main.c:1323
#, c-format
msgid "Failed to clear cache files (%s): %s\n"
msgstr ""
#: ../parser_main.c:1332
msgid ""
"The --create-cache-dir option is deprecated. Please use --write-cache.\n"
msgstr ""
#: ../parser_main.c:1337
#, c-format
msgid "Failed setting up policy cache (%s): %s\n"
msgstr ""
#: ../parser_misc.c:694
#, c-format
msgid "Namespace not terminated: %s\n"
msgstr ""
#: ../parser_misc.c:696
#, c-format
msgid "Empty namespace: %s\n"
msgstr ""
#: ../parser_misc.c:698
#, c-format
msgid "Empty named transition profile name: %s\n"
msgstr ""
#: ../parser_misc.c:700
#, c-format
msgid "Unknown error while parsing label: %s\n"
msgstr ""
#: parser_yacc.y:322
msgid "Profile names must begin with a '/' or a namespace"
msgstr ""
#: parser_yacc.y:344
msgid "Profile attachment must begin with a '/' or variable."
msgstr ""
#: parser_yacc.y:906
msgid "RLIMIT 'cpu' no units specified using default units of seconds\n"
msgstr ""
#: parser_yacc.y:918
msgid ""
"RLIMIT 'rttime' no units specified using default units of microseconds\n"
msgstr ""
#: parser_yacc.y:1074
#, c-format
msgid "%s: Profile abi not supported, falling back to system abi.\n"
msgstr ""
#: parser_yacc.y:1519
msgid "Exec condition is required when unsafe or safe keywords are present"
msgstr ""
#: parser_yacc.y:1521
msgid "Exec condition must begin with '/'."
msgstr ""
#: ../parser_regex.c:98
#, c-format
msgid "%s: Invalid glob type %d\n"
msgstr ""
#: ../parser_regex.c:615
#, c-format
msgid "The current kernel does not support stacking of named transitions: %s\n"
msgstr ""

View File

@@ -140,7 +140,7 @@ force_complain() {
local profile=$1
# if profile not in complain mode
if ! egrep -q "^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+{" $profile ; then
if ! egrep -q '^/.*[ \t]+flags[ \t]*=[ \t]*\([ \t]*complain[ \t]*\)[ \t]+\{' $profile ; then
local link="${PROFILE_DIR}/force-complain/`basename ${profile}`"
if [ -e "$link" ] ; then
aa_log_warning_msg "found $link, forcing complain mode"

View File

@@ -137,7 +137,7 @@ class AAParserCachingCommon(testlib.AATestTemplate):
with open(features_path) as f:
features = f.read()
if expected:
self.assertEquals(expected_output, features,
self.assertEqual(expected_output, features,
"features contents differ, expected:\n%s\nresult:\n%s" % (expected_output, features))
else:
self.assertNotEquals(expected_output, features,
@@ -269,7 +269,7 @@ class AAParserCachingTests(AAParserCachingCommon):
if (int(major) < 3) or ((int(major) == 3) and (int(minor) <= 2)):
self.assertAlmostEquals(time1, time2, places=5)
else:
self.assertEquals(time1, time2)
self.assertEqual(time1, time2)
def _set_mtime(self, path, mtime):
atime = os.stat(path).st_atime
@@ -370,7 +370,7 @@ class AAParserCachingTests(AAParserCachingCommon):
# in cache_contents because of the difficulty coercing cache
# file bytes into strings in python3
self.assertNotEquals(orig_stat.st_size, stat.st_size, 'Expected cache file to be updated, size is not changed.')
self.assertEquals(os.stat(self.profile).st_mtime, stat.st_mtime)
self.assertEqual(os.stat(self.profile).st_mtime, stat.st_mtime)
def test_cache_writing_clears_all_files(self):
'''test cache writing clears all cache files'''
@@ -388,7 +388,7 @@ class AAParserCachingTests(AAParserCachingCommon):
self._set_mtime(self.abstraction, 0)
self._set_mtime(self.profile, expected)
self._generate_cache_file()
self.assertEquals(expected, os.stat(self.cache_file).st_mtime)
self.assertEqual(expected, os.stat(self.cache_file).st_mtime)
def test_abstraction_mtime_preserved(self):
'''test abstraction mtime is preserved when it is newest'''
@@ -396,7 +396,7 @@ class AAParserCachingTests(AAParserCachingCommon):
self._set_mtime(self.profile, 0)
self._set_mtime(self.abstraction, expected)
self._generate_cache_file()
self.assertEquals(expected, os.stat(self.cache_file).st_mtime)
self.assertEqual(expected, os.stat(self.cache_file).st_mtime)
def test_equal_mtimes_preserved(self):
'''test equal profile and abstraction mtimes are preserved'''
@@ -404,7 +404,7 @@ class AAParserCachingTests(AAParserCachingCommon):
self._set_mtime(self.profile, expected)
self._set_mtime(self.abstraction, expected)
self._generate_cache_file()
self.assertEquals(expected, os.stat(self.cache_file).st_mtime)
self.assertEqual(expected, os.stat(self.cache_file).st_mtime)
def test_profile_newer_skips_cache(self):
'''test cache is skipped if profile is newer'''
@@ -420,9 +420,9 @@ class AAParserCachingTests(AAParserCachingCommon):
self.run_cmd_check(cmd, expected_string='Replacement succeeded for')
stat = os.stat(self.cache_file)
self.assertEquals(orig_stat.st_size, stat.st_size)
self.assertEquals(orig_stat.st_ino, stat.st_ino)
self.assertEquals(orig_stat.st_mtime, stat.st_mtime)
self.assertEqual(orig_stat.st_size, stat.st_size)
self.assertEqual(orig_stat.st_ino, stat.st_ino)
self.assertEqual(orig_stat.st_mtime, stat.st_mtime)
def test_abstraction_newer_skips_cache(self):
'''test cache is skipped if abstraction is newer'''
@@ -438,9 +438,9 @@ class AAParserCachingTests(AAParserCachingCommon):
self.run_cmd_check(cmd, expected_string='Replacement succeeded for')
stat = os.stat(self.cache_file)
self.assertEquals(orig_stat.st_size, stat.st_size)
self.assertEquals(orig_stat.st_ino, stat.st_ino)
self.assertEquals(orig_stat.st_mtime, stat.st_mtime)
self.assertEqual(orig_stat.st_size, stat.st_size)
self.assertEqual(orig_stat.st_ino, stat.st_ino)
self.assertEqual(orig_stat.st_mtime, stat.st_mtime)
def test_profile_newer_rewrites_cache(self):
'''test cache is rewritten if profile is newer'''

View File

@@ -547,7 +547,21 @@ verify_binary_equality "set rlimit memlock <= 2GB" \
"/t { set rlimit memlock <= 2GB, }" \
"/t { set rlimit memlock <= $((2 * 1024)) MB, }" \
"/t { set rlimit memlock <= $((2 * 1024 * 1024)) KB, }" \
"/t { set rlimit memlock <= $((2 * 1024 * 1024 * 1024)) , }" \
"/t { set rlimit memlock <= $((2 * 1024 * 1024 * 1024)) , }"
# verify slash filtering for link rules
verify_binary_equality "link rules slash filtering" \
"/t { link /dev/foo -> /mnt/bar, }" \
"/t { link ///dev/foo -> /mnt/bar, }" \
"/t { link /dev/foo -> /mnt//bar, }" \
"/t { link /dev///foo -> ////mnt/bar, }" \
"@{BAR}=/mnt/
/t { link /dev///foo -> @{BAR}/bar, }" \
"@{FOO}=/dev/
/t { link @{FOO}//foo -> /mnt/bar, }" \
"@{FOO}=/dev/
@{BAR}=/mnt/
/t { link @{FOO}/foo -> @{BAR}/bar, }" \
if [ $fails -ne 0 -o $errors -ne 0 ]
then

View File

@@ -1,7 +1,6 @@
#
#=DESCRIPTION abi testing - abi relative path in quotes
#=EXRESULT FAIL
#=TODO
abi "abi/4.19,

View File

@@ -35,9 +35,49 @@ EXTRAS_SOURCE=./apparmor/profiles/extras/
SUBDIRS=$(shell find ${PROFILES_SOURCE} -type d -print)
TOPLEVEL_PROFILES=$(filter-out ${SUBDIRS}, $(wildcard ${PROFILES_SOURCE}/*))
ifdef USE_SYSTEM
PYTHONPATH=
PARSER?=apparmor_parser
LOGPROF?=aa-logprof
else
# PYTHON_DIST_BUILD_PATH based on libapparmor/swig/python/test/Makefile.am
PYTHON_DIST_BUILD_PATH = ../libraries/libapparmor/swig/python/build/$$($(PYTHON) ../libraries/libapparmor/swig/python/test/buildpath.py)
LIBAPPARMOR_PATH=../libraries/libapparmor/src/.libs/
LD_LIBRARY_PATH=$(LIBAPPARMOR_PATH):$(PYTHON_DIST_BUILD_PATH)
PYTHONPATH=../utils/:$(PYTHON_DIST_BUILD_PATH)
PARSER?=../parser/apparmor_parser
# use ../utils logprof
LOGPROF?=LD_LIBRARY_PATH=$(LD_LIBRARY_PATH) PYTHONPATH=$(PYTHONPATH) $(PYTHON) ../utils/aa-logprof
endif
# $(PWD) is wrong when using "make -C profiles" - explicitely set it here to get the right value
PWD=$(shell pwd)
.PHONY: test-dependencies
test-dependencies: __parser __libapparmor
.PHONY: __parser __libapparmor
__parser:
ifndef USE_SYSTEM
@if [ ! -f $(PARSER) ]; then \
echo "error: $(PARSER) is missing. Pick one of these possible solutions:" 1>&2; \
echo " 1) Test using the in-tree parser by building it first and then trying again. See the top-level README for help." 1>&2; \
echo " 2) Test using the system parser by adding USE_SYSTEM=1 to your make command." 1>&2; \
exit 1; \
fi
endif
__libapparmor:
ifndef USE_SYSTEM
@if [ ! -f $(LIBAPPARMOR_PATH)libapparmor.so ]; then \
echo "error: $(LIBAPPARMOR_PATH)libapparmor.so is missing. Pick one of these possible solutions:" 1>&2; \
echo " 1) Build against the in-tree libapparmor by building it first and then trying again. See the top-level README for help." 1>&2; \
echo " 2) Build against the system libapparmor by adding USE_SYSTEM=1 to your make command." 1>&2; \
exit 1; \
fi
endif
local:
for profile in ${TOPLEVEL_PROFILES}; do \
fn=$$(basename $$profile); \
@@ -69,16 +109,6 @@ else
Q=
endif
ifndef PARSER
# use system parser
PARSER=../parser/apparmor_parser
endif
ifndef LOGPROF
# use ../utils logprof
LOGPROF=PYTHONPATH=../utils $(PYTHON) ../utils/aa-logprof
endif
.PHONY: docs
# docs: should we have some here?
docs:
@@ -92,7 +122,7 @@ CHECK_ABSTRACTIONS=$(shell find ${ABSTRACTIONS_SOURCE} -type f -print)
check: check-parser check-logprof
.PHONY: check-parser
check-parser: local
check-parser: test-dependencies local
@echo "*** Checking profiles from ${PROFILES_SOURCE} and ${EXTRAS_SOURCE} against apparmor_parser"
$(Q)for profile in ${CHECK_PROFILES} ; do \
[ -n "${VERBOSE}" ] && echo "Testing $${profile}" ; \
@@ -108,6 +138,6 @@ check-parser: local
done
.PHONY: check-logprof
check-logprof: local
check-logprof: test-dependencies local
@echo "*** Checking profiles from ${PROFILES_SOURCE} against logprof"
$(Q)${LOGPROF} -d ${PROFILES_SOURCE} -f /dev/null || exit 1

View File

@@ -24,6 +24,7 @@
owner /{,var/}run/lightdm/*/xauthority r,
owner /{,var/}run/user/*/gdm/Xauthority r,
owner /{,var/}run/user/*/X11/Xauthority r,
owner /{,var/}run/user/*/xauth_* r,
# the unix socket to use to connect to the display
/tmp/.X11-unix/* rw,
@@ -48,6 +49,8 @@
# Xcompose
owner @{HOME}/.XCompose r,
/var/cache/libx11/compose/* r,
deny /var/cache/libx11/compose/* wlk,
# mouse themes
/etc/X11/cursors/ r,

View File

@@ -94,6 +94,7 @@
@{PROC}/cpuinfo r,
@{sys}/devices/system/cpu/ r,
@{sys}/devices/system/cpu/online r,
@{sys}/devices/system/cpu/possible r,
# glibc's *printf protections read the maps file
@{PROC}/@{pid}/{maps,auxv,status} r,

View File

@@ -0,0 +1,45 @@
# vim:syntax=apparmor
dbus send
bus=system
path=/org/freedesktop/NetworkManager
interface=org.freedesktop.DBus.Properties
member=GetAll
peer=(name=org.freedesktop.NetworkManager),
dbus send
bus=system
path=/org/freedesktop/NetworkManager
interface=org.freedesktop.NetworkManager
member=GetDevices
peer=(name=org.freedesktop.NetworkManager),
dbus send
bus=system
path=/org/freedesktop/NetworkManager/ActiveConnection/[0-9]*
interface=org.freedesktop.DBus.Properties
member=GetAll
peer=(name=org.freedesktop.NetworkManager),
dbus send
bus=system
path=/org/freedesktop/NetworkManager/Devices/[0-9]*
interface=org.freedesktop.DBus.Properties
member=GetAll
peer=(name=org.freedesktop.NetworkManager),
dbus send
bus=system
path=/org/freedesktop/NetworkManager/Settings
interface=org.freedesktop.NetworkManager.Settings
member={GetDevices,ListConnections}
peer=(name=org.freedesktop.NetworkManager),
dbus send
bus=system
path=/org/freedesktop/NetworkManager/Settings/[0-9]*
interface=org.freedesktop.NetworkManager.Settings.Connection
member=GetSettings
peer=(name=org.freedesktop.NetworkManager),
#include if exists <abstractions/dbus-network-manager-strict.d>

View File

@@ -14,6 +14,9 @@
/usr/share/enchant/ r,
/usr/share/enchant/enchant.ordering r,
/usr/share/enchant-2/ r,
/usr/share/enchant-2/enchant.ordering r,
# aspell
#include <abstractions/aspell>
/var/lib/dictionaries-common/aspell/ r,

View File

@@ -0,0 +1,74 @@
# vim:syntax=apparmor
# This abstraction is designed to be used in a child profile to limit what
# confined application can invoke via exo-open helper.
#
# NOTE: most likely you want to use xdg-open abstraction instead for better
# portability across desktop environments, unless you are sure that confined
# application only uses /usr/bin/exo-open directly.
#
# Usage example:
#
# ```
# profile foo /usr/bin/foo {
# ...
# /usr/bin/exo-open rPx -> foo//exo-open,
# ...
# } # end of main profile
#
# # out-of-line child profile
# profile foo//exo-open {
# #include <abstractions/exo-open>
#
# # needed for ubuntu-* abstractions
# #include <abstractions/ubuntu-helpers>
#
# # Only allow to handle http[s]: and mailto: links
# #include <abstractions/ubuntu-browsers>
# #include <abstractions/ubuntu-email>
#
# # Add if accesibility access is considered as required
# # (for message boxe in case exo-open fails)
# #include <abstractions/dbus-accessibility>
#
# # < add additional allowed applications here >
# }
#include <abstractions/X>
#include <abstractions/audio> # for alert messages
#include <abstractions/base>
#include <abstractions/dbus-session-strict>
#include <abstractions/gnome>
# Main executables
/usr/bin/exo-open rix,
/usr/lib{32,64,/@{multiarch}}/xfce4/exo-[0-9]/exo-helper-[0-9] ix,
# Other executables
/{,usr/}bin/which rix,
# Deny DBus
# for GTK error message dialog, not required exo-open to work.
deny dbus send
bus=session
path=/org/gtk/vfs/mounttracker,
# System files
/etc/xdg/{,xdg-*/}xfce4/helpers.rc r,
/etc/xfce4/defaults.list r, # TODO: move into xfce4 abstraction?
/usr/share/sounds/freedesktop/** r, # for message box alert sound
/usr/share/xfce4/helpers/*.desktop r,
/usr/share/{xfce{,4},xubuntu}/applications/{,*.list} r,
# User files
owner @{PROC}/@{pid}/fd/ r,
owner @{HOME}/.config/xfce4/helpers.rc r,
owner @{HOME}/.local/share/xfce4/helpers/*.desktop r,
# Include additions to the abstraction
#include if exists <abstractions/exo-open.d>

View File

@@ -14,8 +14,8 @@
/usr/lib/xorg/modules/fonts/**.so* mr,
/usr/share/fonts/ r,
/usr/share/fonts/** r,
/usr/share/fonts/{,**} r,
/usr/share/fonts-*/{,**} r,
/etc/fonts/** r,
# Debian, openSUSE paths are different

View File

@@ -0,0 +1,57 @@
# vim:syntax=apparmor
# This abstraction is designed to be used in a child profile to limit what
# confined application can invoke via gio helper.
#
# NOTE: most likely you want to use xdg-open abstraction instead for better
# portability across desktop environments, unless you are sure that confined
# application only uses /usr/bin/gio directly.
#
# Usage example:
#
# ```
# profile foo /usr/bin/foo {
# ...
# /usr/bin/gio rPx -> foo//gio-open,
# ...
# } # end of main profile
#
# # out-of-line child profile
# profile foo//gio-open {
# #include <abstractions/gio-open>
#
# # needed for ubuntu-* abstractions
# #include <abstractions/ubuntu-helpers>
#
# # Only allow to handle http[s]: and mailto: links
# #include <abstractions/ubuntu-browsers>
# #include <abstractions/ubuntu-email>
#
# # < add additional allowed applications here >
# }
#include <abstractions/base>
#include <abstractions/dbus-session-strict>
# Main executables
/usr/bin/gio rix,
/usr/bin/gio-launch-desktop ix, # for OpenSUSE
/usr/lib/@{multiarch}/glib-[0-9]*/gio-launch-desktop ix,
# System files
/etc/gnome/defaults.list r,
/usr/share/mime/* r,
/usr/share/{,*/}applications/{,**} r,
/var/cache/gio-[0-9]*.[0-9]*/gnome-mimeapps.list r,
/var/lib/snapd/desktop/applications/{,**} r,
# User files
owner @{HOME}/.config/mimeapps.list r,
owner @{HOME}/.local/share/applications/{,*.desktop} r,
owner @{PROC}/@{pid}/fd/ r,
# Include additions to the abstraction
#include if exists <abstractions/gio-open.d>

View File

@@ -26,6 +26,7 @@
/usr/lib/@{multiarch}/gtk-[0-9]*/** mr,
/usr/share/themes/ r,
/usr/share/themes/** r,
/usr/share/gtk-3.0/settings.ini r,
# for gnome 1 applications
/etc/orbitrc r,
@@ -87,6 +88,7 @@
/usr/share/gvfs/remote-volume-monitors/ r,
/usr/share/gvfs/remote-volume-monitors/* r,
@{PROC}/@{pid}/mounts r,
/run/mount/utab r,
# printing
/etc/papersize r,

View File

@@ -0,0 +1,45 @@
# vim:syntax=apparmor
# This abstraction is designed to be used in a child profile to limit what
# confined application can invoke via gvfs-open helper.
#
# NOTE: most likely you want to use xdg-open abstraction instead for better
# portability across desktop environments, unless you are sure that confined
# application only uses /usr/bin/gvfs-open directly.
#
# Usage example:
#
# ```
# profile foo /usr/bin/foo {
# ...
# /usr/bin/gvfs-open rPx -> foo//gvfs-open,
# ...
# } # end of main profile
#
# # out-of-line child profile
# profile foo//gvfs-open {
# #include <abstractions/gvfs-open>
#
# # needed for ubuntu-* abstractions
# #include <abstractions/ubuntu-helpers>
#
# # Only allow to handle http[s]: and mailto: links
# #include <abstractions/ubuntu-browsers>
# #include <abstractions/ubuntu-email>
#
# # < add additional allowed applications here >
# }
# ```
#include <abstractions/base>
# gvfs-open is deprecated, it launches gio open <uri>
#include <abstractions/gio-open>
# Main executables
/usr/bin/gvfs-open r,
/{,usr/}bin/dash mr,
# Include additions to the abstraction
#include if exists <abstractions/gvfs-open.d>

View File

@@ -0,0 +1,13 @@
# vim:syntax=apparmor
# ------------------------------------------------------------------
#
# Copyright (C) 2020 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License published by the Free Software Foundation.
#
# ------------------------------------------------------------------
/etc/hosts.deny r,
/etc/hosts.allow r,

View File

@@ -0,0 +1,104 @@
# vim:syntax=apparmor
# This abstraction is designed to be used in a child profile to limit what
# confined application can invoke via kde-open5 helper.
#
# NOTE: most likely you want to use xdg-open abstraction instead for better
# portability across desktop environments, unless you are sure that confined
# application only uses /usr/bin/kde-open5 directly.
#
# Usage example:
#
# ```
# profile foo /usr/bin/foo {
# ...
# /usr/bin/kde-open5 rPx -> foo//kde-open5,
# ...
# } # end of main profile
#
# # out-of-line child profile
# profile foo//kde-open5 {
# #include <abstractions/kde-open5>
#
# # needed for ubuntu-* abstractions
# #include <abstractions/ubuntu-helpers>
#
# # Only allow to handle http[s]: and mailto: links
# #include <abstractions/ubuntu-browsers>
# #include <abstractions/ubuntu-email>
#
# # Add if accesibility access is considered as required
# # (for message boxe in case exo-open fails)
# #include <abstractions/dbus-accessibility>
#
# # Add if audio support for message box is
# # considered as required.
# #include if exists <abstractions/gstreamer>
#
# # < add additional allowed applications here >
# }
# ```
#include <abstractions/audio> # for alert messages
#include <abstractions/base>
#include <abstractions/dbus-accessibility-strict>
#include <abstractions/dbus-network-manager-strict>
#include <abstractions/dbus-session-strict>
#include <abstractions/dbus-strict>
#include <abstractions/kde-icon-cache-write>
#include <abstractions/kde>
#include <abstractions/nameservice> # for IceProcessMessages () from libICE.so (called by libQtCore.so)
#include <abstractions/openssl>
#include <abstractions/qt5>
#include <abstractions/recent-documents-write>
#include <abstractions/X>
# Main executables
/usr/bin/kde-open5 rix,
/usr/lib/@{multiarch}/libexec/kf5/kioslave{,5} ix,
# DBus
dbus
bus=session
interface=org.kde.KLauncher
member=start_service_by_desktop_path
peer=(name=org.kde.klauncher5),
# Denied system files
deny /usr/lib/vlc/plugins/* w, # VLC backed tries to create plugins.dat.16109
# libpcre2 on openSUSE tries to mmap() shared memory on directory.
# see: https://lists.ubuntu.com/archives/apparmor/2019-January/011925.html
# AppArmor does not allow to distinguish "real" file vs shared memory one,
# so we deny this path to protect from loading exploits from /tmp.
deny /tmp/#[0-9]*[0-9] m,
# System files
/dev/tty r,
/etc/xdg/accept-languages.codes r,
/etc/xdg/menus/{,*/} r,
/usr/share/*fonts*/conf.avail/*.conf r, # for openSUSE, when showing error message box
/usr/share/ghostscript/fonts/ r, # for openSUSE, when showing error message box
/usr/share/hwdata/pnp.ids r, # for openSUSE, when showing error message box, for QXcbConnection::initializeScreens() from libQt5XcbQpa.so
/usr/share/icu/[0-9]*.[0-9]*/*.dat r, # for openSUSE
/usr/share/kservices5/{,**} r, # for KProtocolManager::defaultUserAgent() from libKF5KIOCore.so
/usr/share/mime/ r,
/usr/share/mime/generic-icons r,
/usr/share/plasma/look-and-feel/*/contents/defaults r, # TODO: move to kde abstraction?
/usr/share/sounds/ r,
@{PROC}/sys/kernel/core_pattern r,
@{PROC}/sys/kernel/random/boot_id r,
# User files
owner /tmp/xauth-[0-9]*-_[0-9] r, # for libQt5XcbQpa.so
owner /{,var/}run/user/[0-9]*/#[0-9]* rw, # for /run/user/1000/#13
owner /{,var/}run/user/[0-9]*/kioclient*slave-socket lrw -> /{,var/}/run/user/[0-9]/#[0-9]*, # for KIO::Slave::holdSlave(QString const&, QUrl const&) () from libKF5KIOCore.so (not 100% sure)
owner @{HOME}/.cache/kio_http/ rw,
# Include additions to the abstraction
#include if exists <abstractions/kde-open5.d>

View File

@@ -9,5 +9,6 @@
# ------------------------------------------------------------------
# mdnsd
/etc/mdns.allow r,
/etc/nss_mdns.conf r,
/{,var/}run/mdnsd w,

View File

@@ -4,6 +4,12 @@
# System files
/dev/dri/ r, # libGLX_mesa.so calls drmGetDevice2()
# Needed to check if the kernel supports the i915 perf interface
# (src/intel/perf/gen_perf.c, load_oa_metrics())
@{PROC}/sys/dev/i915/perf_stream_paranoid r,
@{sys}/devices/pci[0-9]*/**/{revision,config} r,
# User files
owner @{HOME}/.cache/ w, # if user clears all caches
owner @{HOME}/.cache/mesa_shader_cache/ w,

View File

@@ -29,6 +29,11 @@
/var/lib/extrausers/group r,
/var/lib/extrausers/passwd r,
# NSS records from systemd-userdbd.service
@{run}/systemd/userdb/ r,
@{run}/systemd/userdb/io.systemd.{NameServiceSwitch,Multiplexer,DynamicUser,Home} r,
@{PROC}/sys/kernel/random/boot_id r,
# When using sssd, the passwd and group files are stored in an alternate path
# and the nss plugin also needs to talk to a pipe
/var/lib/sss/mc/group r,

View File

@@ -9,6 +9,8 @@
# ------------------------------------------------------------------
/etc/ssl/openssl.cnf r,
/etc/ssl/{engdef,engines}.d/ r,
/etc/ssl/{engdef,engines}.d/*.cnf r,
/usr/share/ssl/openssl.cnf r,
@{PROC}/sys/crypto/fips_enabled r,

View File

@@ -11,26 +11,26 @@
# ------------------------------------------------------------------
# shared snippets for config files
/etc/php{,5,7}/**/ r,
/etc/php{,5,7}/**.ini r,
/etc/php{,5,7,8}/**/ r,
/etc/php{,5,7,8}/**.ini r,
# Xlibs
/usr/X11R6/lib{,32,64}/lib*.so* mr,
# php extensions
/usr/lib{64,}/php{,5,7}/*/*.so mr,
/usr/lib{64,}/php{,5,7,8}/*/*.so mr,
# ICU (unicode support) data tables
/usr/share/icu/*/*.dat r,
# php session mmap socket
/var/lib/php{,5,7}/session_mm_* rwlk,
/var/lib/php{,5,7,8}/session_mm_* rwlk,
# file based session handler
/var/lib/php{,5,7}/sess_* rwlk,
/var/lib/php{,5,7}/sessions/* rwlk,
/var/lib/php{,5,7,8}/sess_* rwlk,
/var/lib/php{,5,7,8}/sessions/* rwlk,
# php libraries
/usr/share/php{,5,7}/ r,
/usr/share/php{,5,7}/** mr,
/usr/share/php{,5,7,8}/ r,
/usr/share/php{,5,7,8}/** mr,
# MySQL extension
/usr/share/mysql/** r,

View File

@@ -1,7 +1,8 @@
# ------------------------------------------------------------------
#
# Copyright (C) 2002-2005 Novell/SUSE
# Copyright (C) 2015 Canonical, Ltd.
# Copyright (C) 2015-2018 Canonical, Ltd.
# Copyright (C) 2020 Christian Boltz
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -31,6 +32,7 @@
/usr/lib{,32,64}/sasl2/ r,
/usr/lib/@{multiarch}/sasl2/* mr,
/usr/lib/@{multiarch}/sasl2/ r,
/usr/share/icu/[0-9]*.[0-9]*/*.dat r,
/var/spool/postfix/etc/* r,
/var/spool/postfix/lib/lib*.so* mr,

View File

@@ -22,4 +22,4 @@
audit deny @{HOME}/.kde{,4}/{,share/,share/apps/} w,
audit deny @{HOME}/.kde{,4}/share/apps/kmail{,2}/{,**} mrwkl,
audit deny @{HOME}/.kde{,4}/share/apps/kwallet/{,**} mrwkl,
audit deny @{HOME}/.local/share/kwalletd/{,**} mrwkl,

View File

@@ -10,18 +10,19 @@
#
# ------------------------------------------------------------------
/usr/lib{,32,64}/python{2.[4-7],3.[0-9]}/**.{pyc,so} mr,
/usr/lib{,32,64}/python{2.[4-7],3.[0-9]}/**.{egg,py,pth} r,
/usr/lib{,32,64}/python{2.[4-7],3.[0-9]}/{site,dist}-packages/ r,
/usr/lib{,32,64}/python{2.[4-7],3.[0-9],3.1[0-9]}/**.{pyc,so} mr,
/usr/lib{,32,64}/python{2.[4-7],3.[0-9],3.1[0-9]}/**.{egg,py,pth} r,
/usr/lib{,32,64}/python{2.[4-7],3.[0-9],3.1[0-9]}/{site,dist}-packages/ r,
/usr/lib{,32,64}/python3.[0-9]/lib-dynload/*.so mr,
/usr/local/lib{,32,64}/python{2.[4-7],3,3.[0-9]}/**.{pyc,so} mr,
/usr/local/lib{,32,64}/python{2.[4-7],3,3.[0-9]}/**.{egg,py,pth} r,
/usr/local/lib{,32,64}/python{2.[4-7],3,3.[0-9]}/{site,dist}-packages/ r,
/usr/local/lib{,32,64}/python3.[0-9]/lib-dynload/*.so mr,
/usr/local/lib{,32,64}/python{2.[4-7],3,3.[0-9],3.1[0-9]}/**.{pyc,so} mr,
/usr/local/lib{,32,64}/python{2.[4-7],3,3.[0-9],3.1[0-9]}/**.{egg,py,pth} r,
/usr/local/lib{,32,64}/python{2.[4-7],3,3.[0-9],3.1[0-9]}/{site,dist}-packages/ r,
/usr/local/lib{,32,64}/python3.{1,}[0-9]/lib-dynload/*.so mr,
# Site-wide configuration
/etc/python{2.[4-7],3.[0-9]}/** r,
/etc/python{2.[4-7],3.[0-9],3.1[0-9]}/** r,
# shared python paths
/usr/share/{pyshared,pycentral,python-support}/** r,
@@ -34,4 +35,4 @@
/usr/lib/wx/python/*.pth r,
# python build configuration and headers
/usr/include/python{2.[4-7],3.[0-9]}*/pyconfig.h r,
/usr/include/python{2.[4-7],3.[0-9],3.1[0-9]}*/pyconfig.h r,

View File

@@ -0,0 +1,42 @@
profile snap_browsers {
include if exists <abstractions/snap_browsers.d>
include <abstractions/base>
include <abstractions/dbus-session-strict>
/etc/passwd r,
/etc/nsswitch.conf r,
/etc/fstab r,
# noisy
deny owner /run/user/[0-9]*/gdm/Xauthority r, # not needed on Ubuntu
/{,snap/core/[0-9]*/,snap/snapd/[0-9]*/}usr/bin/snap mrix, # re-exec
/{,snap/core/[0-9]*/,snap/snapd/[0-9]*/}usr/lib/snapd/info r,
/{,snap/core/[0-9]*/,snap/snapd/[0-9]*/}usr/lib/snapd/snapd r,
/{,snap/core/[0-9]*/,snap/snapd/[0-9]*/}usr/lib/snapd/snap-seccomp rPix,
/{,snap/core/[0-9]*/,snap/snapd/[0-9]*/}usr/lib/snapd/snap-confine Pix,
/var/lib/snapd/system-key r,
/run/snapd.socket rw,
@{PROC}/version r,
@{PROC}/cmdline r,
@{PROC}/sys/net/core/somaxconn r,
@{PROC}/sys/kernel/seccomp/actions_avail r,
@{PROC}/sys/kernel/random/uuid r,
owner @{PROC}/@{pid}/cgroup r,
owner @{PROC}/@{pid}/mountinfo r,
owner @{HOME}/.snap/auth.json r, # if exists, required
dbus send bus="session" path="/org/freedesktop/systemd1" interface="org.freedesktop.systemd1.Manager" member="StartTransientUnit" peer=(name="org.freedesktop.systemd1"),
dbus receive bus="session" path="/org/freedesktop/systemd1" interface="org.freedesktop.systemd1.Manager" member="JobRemoved",
/sys/kernel/security/apparmor/features/ r,
# allow launching official browser snaps.
/snap/chromium/[0-9]*/meta/{snap.yaml,hooks/} r,
/snap/firefox/[0-9]*/meta/{snap.yaml,hooks/} r,
/snap/opera/[0-9]*/meta/{snap.yaml,hooks/} r,
/var/lib/snapd/sequence/{chromium,firefox,opera}.json r,
# add other browsers here
}

View File

@@ -12,6 +12,7 @@
audit deny @{HOME}/.gnome2_private/{,**} mrwkl,
audit deny @{HOME}/.kde{,4}/{,share/,share/apps/} w,
audit deny @{HOME}/.kde{,4}/share/apps/kwallet/{,**} mrwkl,
audit deny @{HOME}/.local/share/kwalletd/{,**} mrwkl,
# Comment this out if using gpg plugin/addons
audit deny @{HOME}/.gnupg/{,**} mrwkl,

View File

@@ -70,6 +70,7 @@ profile sanitized_helper {
/opt/google/chrome{,-beta,-unstable}/chrome-sandbox PUxr,
/opt/google/chrome{,-beta,-unstable}/google-chrome Pixr,
/opt/google/chrome{,-beta,-unstable}/chrome Pixr,
/opt/google/chrome{,-beta,-unstable}/chrome_crashpad_handler Pixr,
/opt/google/chrome{,-beta,-unstable}/{,**/}lib*.so{,.*} m,
# Full access

View File

@@ -2,5 +2,5 @@
# video device access
# System devices
@{sys}/class/video4linux r,
@{sys}/class/video4linux/ r,
@{sys}/class/video4linux/** r,

View File

@@ -3,10 +3,15 @@
# System files
/dev/dri/ r, # libvulkan_radeon.so, libvulkan_intel.so (Mesa)
/etc/glvnd/egl_vendor.d/{*,.json} r,
/etc/vulkan/icd.d/{,*.json} r,
/etc/vulkan/{explicit,implicit}_layer.d/{,*.json} r,
# for drmGetMinorNameForFD() from libvulkan_intel.so (Mesa)
@{sys}/devices/pci[0-9]*/*/drm/ r,
@{sys}/devices/pci[0-9]*/*/drm/card[0-9]/gt_{max,min}_freq_mhz r, # anv_enumerate_physical_devices() from libvulkan_intel.so
@{sys}/devices/pci[0-9]*/*/drm/card[0-9]/metrics/ r, # anv_enumerate_physical_devices() from libvulkan_intel.so
@{sys}/devices/pci[0-9]*/*/drm/card[0-9]/metrics/????????-????-????-????-????????????/id r, # anv_enumerate_physical_devices() from libvulkan_intel.so
/usr/share/glvnd/egl_vendor.d/{,*.json} r,
/usr/share/vulkan/icd.d/{,*.json} r,
/usr/share/vulkan/{explicit,implicit}_layer.d/{,*.json} r,

View File

@@ -12,5 +12,6 @@
# some services update wtmp, utmp, and lastlog with per-user
# connection information
/var/log/lastlog rwk,
/var/log/wtmp wk,
/var/log/wtmp rwk,
/var/log/btmp rwk,
/{,var/}run/utmp rwk,

View File

@@ -0,0 +1,84 @@
# vim:syntax=apparmor
# This abstraction is designed to be used in a child profile to limit what
# confined application can invoke via xdg-open helper. xdg-open abstraction
# will allow to use gio-open, kde-open5 and other helpers of the different
# desktop environments.
#
# Usage example:
#
# ```
# profile foo /usr/bin/foo {
# ...
# /usr/bin/xdg-open rPx -> foo//xdg-open,
# ...
# } # end of main profile
#
# # out-of-line child profile
# profile foo//xdg-open {
# #include <abstractions/xdg-open>
#
# # Enable a11y support if considered required by
# # profile author for (rare) error message boxes.
# #include <abstractions/dbus-accessibility>
#
# # Enable gstreamer support if considered required by
# # profile author for (rare) error message boxes.
# #include if exists <abstractions/gstreamer>
#
# # needed for ubuntu-* abstractions
# #include <abstractions/ubuntu-helpers>
#
# # Only allow to handle http[s]: and mailto: links
# #include <abstractions/ubuntu-browsers>
# #include <abstractions/ubuntu-email>
#
# # < add additional allowed applications here >
# }
# ```
#include <abstractions/base>
# for openin with `exo-open`
#include <abstractions/exo-open>
# for opening with `gio open <uri>`
#include <abstractions/gio-open>
# for opening with gvfs-open (deprecated)
#include <abstractions/gvfs-open>
# for opening with kde-open5
#include <abstractions/kde-open5>
# Main executables
/{,usr/}bin/{b,d}ash mr,
/usr/bin/xdg-open r,
# Additional executables
/usr/bin/xdg-mime rix,
/{,usr/}bin/cut rix, # for xdg-mime
/{,usr/}bin/head rix, # for xdg-mime
/{,usr/}bin/sed rix, # for xdg-open
/{,usr/}bin/tr rix, # for xdg-mime
/{,usr/}bin/which rix, # for xdg-open
/{,usr/}bin/{grep,egrep} rix, # for xdg-open
# System files
/dev/pts/[0-9]* rw,
/dev/tty w,
/etc/gnome/defaults.list r, # for grep
/usr/share/applications/mimeinfo.cache r, # for grep
/usr/share/terminfo/s/screen r, # for bash on openSUSE
/usr/share/{,*/}applications/{,*.desktop} r, # for xdg-mime
/var/lib/menu-xdg/applications/ r, # for xdg-mime
# Usr files
owner @{HOME}/.local/share/applications/{,*.desktop} r,
# Include additions to the abstraction
#include if exists <abstractions/xdg-open.d>

View File

@@ -16,7 +16,7 @@ profile lsb_release {
/dev/tty rw,
/usr/bin/lsb_release r,
/usr/bin/python3.[0-9] mr,
/usr/bin/python3.{1,}[0-9] mr,
/etc/debian_version r,
/etc/default/apport r,

View File

@@ -22,11 +22,13 @@ profile nvidia_modprobe {
# System files
/dev/nvidia-modeset w,
/dev/nvidia-uvm w,
/dev/nvidia-uvm-tools w,
@{sys}/bus/pci/devices/ r,
@{sys}/devices/pci[0-9]*/**/config r,
@{PROC}/devices r,
@{PROC}/driver/nvidia/params r,
@{PROC}/modules r,
@{PROC}/sys/kernel/modprobe r,

View File

@@ -62,6 +62,7 @@ profile syslog-ng /{usr/,}{bin,sbin}/syslog-ng {
/{var,var/run,run}/log/journal/*/*.journal r,
/{var/,}run/syslog-ng.ctl a,
/{var/,}run/syslog-ng/additional-log-sockets.conf r,
/{var,var/run,run}/log/journal/*.journal r,
# Site-specific additions and overrides. See local/README for details.
#include <local/sbin.syslog-ng>

View File

@@ -19,3 +19,4 @@
#include <tunables/kernelvars>
#include <tunables/xdg-user-dirs>
#include <tunables/share>
#include <tunables/run>

View File

@@ -0,0 +1 @@
@{run}=/run/ /var/run/

View File

@@ -24,6 +24,7 @@
/etc/dovecot/dovecot-database.conf.ext r,
/etc/dovecot/dovecot-dict-sql.conf.ext r,
/etc/my.cnf r,
/usr/lib/dovecot/dict mr,
# Site-specific additions and overrides. See local/README for details.

View File

@@ -67,9 +67,9 @@
/root/.forward r,
/root/dead.letter w,
/usr/bin/procmail Px,
/usr/lib/postfix/master Px,
/usr/lib/postfix/showq Px,
/usr/lib/postfix/smtpd Px,
/usr/lib/postfix/{bin/,sbin/,}master Px,
/usr/lib/postfix/{bin/,sbin/,}showq Px,
/usr/lib/postfix/{bin/,sbin/,}smtpd Px,
/usr/{bin,sbin}/postalias Px,
/usr/{bin,sbin}/postdrop Px,
/usr/{bin,sbin}/postfix Px,

View File

@@ -33,7 +33,7 @@
/etc/dovecot/conf.d/** r,
owner /tmp/dovecot.imap.* rw,
@{PROC}/@{pid}/attr/current rw,
/usr/bin/doveconf rix,
/usr/lib/dovecot/imap mrix,
/usr/share/dovecot/** r,

View File

@@ -28,7 +28,7 @@
@{DOVECOT_MAILSTORE}/** rwkl,
@{HOME}/.dovecot.svbin r,
@{PROC}/@{pid}/attr/current rw,
/proc/*/mounts r,
/tmp/dovecot.lmtp.* rw,
/usr/lib/dovecot/lmtp mr,

View File

@@ -0,0 +1,33 @@
# ------------------------------------------------------------------
#
# Copyright (C) 2020 Michael Hirmke
# Copyright (C) 2020 Christian Boltz
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License published by the Free Software Foundation.
#
# ------------------------------------------------------------------
# vim: ft=apparmor
#include <tunables/global>
profile dovecot-script-login /usr/lib/dovecot/script-login {
#include <abstractions/base>
#include <abstractions/dovecot-common>
#include <abstractions/nameservice>
capability setuid,
/usr/lib/dovecot/script-login mrPx,
# NOTE: You'll need to allow execution of your actual login script.
# The recommended way is to add a rule for it in local/usr.lib.dovecot.script-login
# for example
# /home/vmail/bin/postlogin.sh Px,
# and then to create the profile for the script.
# Site-specific additions and overrides. See local/README for details.
#include <local/usr.lib.dovecot.script-login>
}

View File

@@ -18,6 +18,10 @@
capability setuid,
capability sys_chroot,
# for metrics end-point (Prometheus)
network inet stream,
network inet6 stream,
/usr/lib/dovecot/stats mr,
# Site-specific additions and overrides. See local/README for details.

View File

@@ -20,6 +20,9 @@ profile avahi-daemon /usr/{bin,sbin}/avahi-daemon {
/etc/avahi/services/ r,
/etc/avahi/services/*.service r,
@{PROC}/@{pid}/fd/ r,
@{PROC}/1/environ r,
@{PROC}/cmdline r,
@{PROC}/sys/kernel/osrelease r,
/usr/{bin,sbin}/avahi-daemon mr,
/usr/share/avahi/introspection/*.introspect r,
/usr/share/dbus-1/interfaces/org.freedesktop.Avahi.*.xml r,

View File

@@ -42,6 +42,8 @@ profile /usr/sbin/dnsmasq /usr/{bin,sbin}/dnsmasq flags=(attach_disconnected) {
owner /dev/tty rw,
@{PROC}/@{pid}/fd/ r,
/etc/dnsmasq.conf r,
/etc/dnsmasq.d/ r,
/etc/dnsmasq.d/* r,
@@ -57,8 +59,8 @@ profile /usr/sbin/dnsmasq /usr/{bin,sbin}/dnsmasq flags=(attach_disconnected) {
/var/log/dnsmasq*.log w,
/usr/share/dnsmasq/ r,
/usr/share/dnsmasq/* r,
/usr/share/dnsmasq{-base,}/ r,
/usr/share/dnsmasq{-base,}/* r,
/{,var/}run/*dnsmasq*.pid w,
/{,var/}run/dnsmasq-forwarders.conf r,
@@ -87,6 +89,7 @@ profile /usr/sbin/dnsmasq /usr/{bin,sbin}/dnsmasq flags=(attach_disconnected) {
# libvirt lease helper
/usr/lib{,64}/libvirt/libvirt_leaseshelper Cx -> libvirt_leaseshelper,
/usr/libexec/libvirt_leaseshelper Cx -> libvirt_leaseshelper,
# lxc-net pid and lease files
/{,var/}run/lxc/dnsmasq.pid rw,
@@ -113,7 +116,8 @@ profile /usr/sbin/dnsmasq /usr/{bin,sbin}/dnsmasq flags=(attach_disconnected) {
/etc/libnl-3/classid r,
/usr/lib{,64}/libvirt/libvirt_leaseshelper m,
/usr/lib{,64}/libvirt/libvirt_leaseshelper mr,
/usr/libexec/libvirt_leaseshelper mr,
owner @{PROC}/@{pid}/net/psched r,
owner @{PROC}/@{pid}/status r,

View File

@@ -31,7 +31,8 @@ profile dovecot /usr/{bin,sbin}/dovecot flags=(attach_disconnected) {
capability sys_chroot,
capability sys_resource,
signal send set=(int,quit,term) peer=/usr/lib/dovecot/*,
signal send peer=/usr/lib/dovecot/*,
signal send peer=dovecot-*,
unix (receive, send) type=stream peer=(label=/usr/lib/dovecot/anvil),
@@ -55,10 +56,12 @@ profile dovecot /usr/{bin,sbin}/dovecot flags=(attach_disconnected) {
/usr/lib/dovecot/managesieve-login Pxmr,
/usr/lib/dovecot/pop3 mrPx,
/usr/lib/dovecot/pop3-login Pxmr,
/usr/lib/dovecot/script-login Px,
/usr/lib/dovecot/ssl-build-param rix,
/usr/lib/dovecot/ssl-params mrPx,
/usr/lib/dovecot/stats Px,
/usr/{bin,sbin}/dovecot mrix,
/usr/share/dovecot/dh.pem r,
/usr/share/dovecot/protocols.d/ r,
/usr/share/dovecot/protocols.d/** r,
/var/lib/dovecot/ w,

View File

@@ -21,6 +21,7 @@ profile nscd /usr/{bin,sbin}/nscd {
capability setgid,
capability setuid,
/etc/machine-id r,
/etc/netgroup r,
/etc/nscd.conf r,
/usr/{bin,sbin}/nscd rmix,

View File

@@ -6,6 +6,7 @@ profile smbd /usr/{bin,sbin}/smbd {
#include <abstractions/consoles>
#include <abstractions/cups-client>
#include <abstractions/nameservice>
#include <abstractions/openssl>
#include <abstractions/samba>
#include <abstractions/user-tmp>
#include <abstractions/wutmp>

View File

@@ -25,7 +25,7 @@ profile winbindd /usr/{bin,sbin}/winbindd {
/usr/lib*/samba/nss_info/*.so mr,
/usr/lib*/samba/pdb/*.so mr,
/usr/{bin,sbin}/winbindd mr,
/var/cache/krb5rcache/* rw,
/var/cache/krb5rcache/* rwk,
/var/cache/samba/*.tdb rwk,
/var/log/samba/log.winbindd rw,
/{var/,}run/samba/winbindd.pid rwk,

View File

@@ -43,6 +43,11 @@ profile dhclient /{usr/,}sbin/dhclient {
@{PROC}/interrupts r,
@{PROC}/@{pid}/net/dev r,
@{PROC}/rtc r,
# dhcliet wants to update its threads with functional names
# see lp1918410
owner @{PROC}/@{pid}/task/[0-9]*/comm rw,
# following rule shouldn't work, self is a symlink
@{PROC}/self/status r,
/{usr/,}sbin/arp mrix,

View File

@@ -121,6 +121,10 @@
deny /usr/share/mozilla/extensions/**/ w,
deny /usr/share/mozilla/ w,
# needed by widevine
ptrace (trace) peer=@{profile_name},
@{HOME}/.mozilla/firefox/*/gmp-widevinecdm/*/lib*so m,
# Site-specific additions and overrides. See local/README for details.
# Local path is disabled, we only enable them for profiles we promote
# out of extras.

View File

@@ -1,6 +1,7 @@
# ------------------------------------------------------------------
#
# Copyright (C) 2002-2006 Novell/SUSE
# Copyright (C) 2018 Canonical, Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -10,7 +11,7 @@
#include <tunables/global>
/usr/lib/postfix/anvil {
profile postfix-anvil /usr/lib/postfix/{bin/,sbin/,}anvil {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/postfix-common>
@@ -18,10 +19,10 @@
capability setgid,
capability setuid,
/usr/lib/postfix/anvil rmix,
/usr/lib/postfix/{bin/,sbin/,}anvil mrix,
/etc/postfix/main.cf r,
/{var/spool/postfix/,}private/anvil rw,
/{var/spool/postfix/,}pid/unix.anvil rw,
/{var/spool/postfix/,}pid/unix.anvil rwk,
@{PROC}/net/if_inet6 r,
}

View File

@@ -1,6 +1,8 @@
# ------------------------------------------------------------------
#
# Copyright (C) 2002-2006 Novell/SUSE
# Copyright (C) 2018 Canonical, Ltd.
# Copyright (C) 2019 Christian Boltz
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -10,7 +12,7 @@
#include <tunables/global>
/usr/lib/postfix/bounce {
profile postfix-bounce /usr/lib/postfix/{bin/,sbin/,}bounce {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/postfix-common>
@@ -18,16 +20,19 @@
capability setgid,
capability setuid,
/usr/lib/postfix/bounce rmix,
/usr/lib/postfix/{bin/,sbin/,}bounce mrix,
/{var/spool/postfix/,}active/[0-9A-F]/[0-9A-F]/* rwl,
/{var/spool/postfix/,}active/[0-9A-F]/[0-9A-F]/* rwkl,
/{var/spool/postfix/,}active/[0-9A-F]/[0-9A-F]/ rwl,
/{var/spool/postfix/,}active/[0-9A-F]/* rwk,
/{var/spool/postfix/,}active/[0-9A-F]/ rwl,
/{var/spool/postfix/,}bounce/[0-9A-F]/[0-9A-F]/* rwl,
/{var/spool/postfix/,}bounce/[0-9A-F]/[0-9A-F]/ rwl,
/{var/spool/postfix/,}bounce/[0-9A-F]/* rwk,
/{var/spool/postfix/,}bounce/[0-9A-F]/ rwl,
/{var/spool/postfix/,}defer/[0-9A-F]/[0-9A-F]/* rwl,
/{var/spool/postfix/,}defer/[0-9A-F]/[0-9A-F]/* rwkl,
/{var/spool/postfix/,}defer/[0-9A-F]/[0-9A-F]/ rwl,
/{var/spool/postfix/,}defer/[0-9A-F]/* rwkl,
/{var/spool/postfix/,}defer/[0-9A-F]/ rwl,
/{var/spool/postfix/,}incoming/[0-9A-F]/[0-9A-F]/* rwl,
/{var/spool/postfix/,}incoming/[0-9A-F]/[0-9A-F]/ rwl,
@@ -35,10 +40,11 @@
/{var/spool/postfix/,}trace/[0-9A-F]/[0-9A-F]/* rwl,
/{var/spool/postfix/,}trace/[0-9A-F]/[0-9A-F]/ rwl,
/{var/spool/postfix/,}trace/[0-9A-F]/ rwl,
/{var/spool/postfix/,}trace/[0-9A-F]* rwk,
/{var/spool/postfix/,}public/cleanup w,
/{var/spool/postfix/,}pid/unix.bounce rw,
/{var/spool/postfix/,}pid/unix.defer rw,
/{var/spool/postfix/,}pid/unix.trace rw,
/{var/spool/postfix/,}pid/unix.bounce rwk,
/{var/spool/postfix/,}pid/unix.defer rwk,
/{var/spool/postfix/,}pid/unix.trace rwk,
/etc/postfix/main.cf r,
@{PROC}/net/if_inet6 r,

View File

@@ -1,6 +1,8 @@
# ------------------------------------------------------------------
#
# Copyright (C) 2002-2006 Novell/SUSE
# Copyright (C) 2018 Canonical, Ltd.
# Copyright (C) 2019 Christian Boltz
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -10,23 +12,28 @@
#include <tunables/global>
/usr/lib/postfix/cleanup {
profile postfix-cleanup /usr/lib/postfix/{bin/,sbin/,}cleanup {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/postfix-common>
capability net_bind_service,
capability dac_read_search,
/usr/lib/postfix/cleanup rmix,
/usr/lib/postfix/{bin/,sbin/,}cleanup mrix,
/{var/spool/postfix/,}incoming/[0-9]*.[0-9]* rwl,
/{var/spool/postfix/,}incoming/[0-9A-F]/[0-9A-F]/* rwl,
/{var/spool/postfix/,}incoming/[0-9A-F]/[0-9A-F]/ rwl,
/{var/spool/postfix/,}incoming/[0-9A-F]/ rwl,
/{var/spool/postfix/,}private/{rewrite,bounce} w,
/{var/spool/postfix/,}public/qmgr w,
/{var/spool/postfix/,}incoming/[0-9A-F]* rw,
/{var/spool/postfix/,}private/bounce w,
/{var/spool/postfix/,}private/rewrite rw,
/{var/spool/postfix/,}public/qmgr rw,
/{var/spool/postfix/,}hold/[0-9A-F]* w,
/{var/spool/postfix/,}pid/unix.cleanup rw,
/{var/spool/postfix/,}public/cleanup rw,
/{var/spool/postfix/,}pid/unix.cleanup rwk,
/etc/{m,fs}tab r,
/etc/postfix/* r,
}

View File

@@ -1,6 +1,7 @@
# ------------------------------------------------------------------
#
# Copyright (C) 2002-2005 Novell/SUSE
# Copyright (C) 2018 Canonical, Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -11,8 +12,8 @@
#include <tunables/global>
/usr/lib/postfix/discard {
profile postfix-discard /usr/lib/postfix/{bin/,sbin/,}discard {
#include <abstractions/base>
/usr/lib/postfix/discard rmix,
/usr/lib/postfix/{bin/,sbin/,}discard mrix,
}

View File

@@ -0,0 +1,20 @@
# ------------------------------------------------------------------
#
# Copyright (C) 2018 Canonical, Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
# License published by the Free Software Foundation.
#
# ------------------------------------------------------------------
# vim:syntax=apparmor
#include <tunables/global>
profile postfix-dnsblog /usr/lib/postfix/{bin/,sbin/,}dnsblog {
#include <abstractions/base>
/usr/lib/postfix/{bin/,sbin/,}dnsblog mrix,
/var/spool/postfix/private/dnsblog rw,
}

View File

@@ -2,6 +2,7 @@
#
# Copyright (C) 2002-2006 Novell/SUSE
# Copyright (C) 2017 Christian Boltz
# Copyright (C) 2018 Canonical, Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -11,13 +12,14 @@
#include <tunables/global>
/usr/lib/postfix/error {
profile postfix-error /usr/lib/postfix/{bin/,sbin/,}error {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/postfix-common>
/usr/lib/postfix/{bin/,sbin/,}error mrix,
@{PROC}/sys/kernel/ngroups_max r,
/usr/lib/postfix/error mrix,
owner /var/spool/postfix/active/* rwk,
/var/spool/postfix/pid/unix.error rwk,
/var/spool/postfix/pid/unix.retry rwk,

View File

@@ -1,6 +1,7 @@
# ------------------------------------------------------------------
#
# Copyright (C) 2002-2006 Novell/SUSE
# Copyright (C) 2018 Canonical, Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -10,7 +11,7 @@
#include <tunables/global>
/usr/lib/postfix/flush {
profile postfix-flush /usr/lib/postfix/{bin/,sbin/,}flush {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/postfix-common>
@@ -18,7 +19,7 @@
capability setgid,
capability setuid,
/usr/lib/postfix/flush rmix,
/usr/lib/postfix/{bin/,sbin/,}flush mrix,
/{var/spool/postfix/,}deferred/ r,
/{var/spool/postfix/,}deferred/[0-9A-F]/[0-9A-F]/* rwl,

View File

@@ -2,6 +2,7 @@
#
# Copyright (C) 2002-2006 Novell/SUSE
# Copyright (C) 2017 Christian Boltz
# Copyright (C) 2018 Canonical, Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -11,12 +12,13 @@
#include <tunables/global>
/usr/lib/postfix/lmtp {
profile postfix-lmtp /usr/lib/postfix/{bin/,sbin/,}lmtp {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/postfix-common>
/usr/lib/postfix/lmtp mrix,
/usr/lib/postfix/{bin/,sbin/,}lmtp mrix,
/var/spool/postfix/active/* rwk,
/var/spool/postfix/pid/unix.lmtp rwk,

View File

@@ -1,6 +1,7 @@
# ------------------------------------------------------------------
#
# Copyright (C) 2002-2006 Novell/SUSE
# Copyright (C) 2018 Canonical, Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -10,7 +11,7 @@
#include <tunables/global>
/usr/lib/postfix/local {
profile postfix-local /usr/lib/postfix/{bin/,sbin/,}local {
#include <abstractions/base>
#include <abstractions/bash>
#include <abstractions/nameservice>
@@ -23,20 +24,24 @@
/var/mailman/mail/wrapper Px,
/usr/bin/mlmmj-recieve Px,
/usr/lib/postfix/local rmix,
/usr/lib/postfix/{bin/,sbin/,}local mrix,
/{usr/,}bin/bash mixr,
/{usr/,}bin/date mixr,
/dev/tty rw,
/etc/{postfix/,}aliases.db r,
/etc/{postfix/,}aliases.db rk,
# mailman on SuSE is configed to have its own alias file
/var/lib/mailman/data/aliases.db r,
/var/lib/mailman/data/aliases.db rk,
/{var/spool/postfix/,}active/[0-9A-F]/[0-9A-F]/* rw,
/{var/spool/postfix/,}active/[0-9A-F]/[0-9A-F]/ rw,
/{var/spool/postfix/,}active/[0-9A-F]/ rw,
/{var/spool/postfix/,}pid/unix.local rw,
/{var/spool/postfix/,}private/{bounce,defer,flush,lmtp,rewrite} rw,
/{var/spool/postfix/,}active/[0-9A-F]* rwk,
/{var/spool/postfix/,}pid/unix.local rwk,
/{var/spool/postfix/,}private/{bounce,defer,flush,lmtp,local,rewrite} rw,
/{var/spool/postfix/,}public/{cleanup,flush} rw,
/etc/postfix/virtual.db r,
/etc/postfix/lists.db r,
# deliver mail
/var/mail/* wk,
}

View File

@@ -1,6 +1,8 @@
# ------------------------------------------------------------------
#
# Copyright (C) 2002-2006 Novell/SUSE
# Copyright (C) 2018 Canonical, Ltd.
# Copyright (C) 2019 Christian Boltz
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -10,7 +12,7 @@
#include <tunables/global>
/usr/lib/postfix/master {
profile postfix-master /usr/lib/postfix/{bin/,sbin/,}master {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/postfix-common>
@@ -18,29 +20,42 @@
capability net_bind_service,
capability kill,
capability dac_override,
capability dac_read_search,
signal send peer=/usr/lib/postfix/*,
signal send peer=postfix-*,
signal peer=@{profile_name},
unix (send receive) type=stream peer=(label=/usr/lib/postfix/*),
unix (send receive) type=stream peer=(label=postfix-*),
/etc/postfix/master.cf r,
/{var/spool/postfix/,}pid/master.pid rwk,
/{var/spool/postfix/,}pid/unix.lmtp wk,
/{var/spool/postfix/,}private/* wl,
/{var/spool/postfix/,}private/tlsmgr rwl,
/{var/spool/postfix/,}public/{cleanup,flush,pickup,qmgr,showq,tlsmgr} rwl,
/{var/spool/postfix/,}public/{cleanup,flush,pickup,postlog,qmgr,showq,tlsmgr} rwl,
/usr/lib/postfix/anvil Px,
/usr/lib/postfix/bounce Px,
/usr/lib/postfix/cleanup Px,
/usr/lib/postfix/flush Px,
/usr/lib/postfix/local Px,
/usr/lib/postfix/master rmix,
/usr/lib/postfix/nqmgr Px,
/usr/lib/postfix/proxymap Px,
/usr/lib/postfix/pickup Px,
/usr/lib/postfix/pipe Px,
/usr/lib/postfix/qmgr Px,
/usr/lib/postfix/scache Px,
/usr/lib/postfix/showq Px,
/usr/lib/postfix/smtp Px,
/usr/lib/postfix/smtpd Px,
/usr/lib/postfix/tlsmgr Px,
/usr/lib/postfix/trivial-rewrite Px,
/usr/lib/postfix/master rmix,
/usr/lib/postfix/{bin/,sbin/,}anvil Px,
/usr/lib/postfix/{bin/,sbin/,}bounce Px,
/usr/lib/postfix/{bin/,sbin/,}cleanup Px,
/usr/lib/postfix/{bin/,sbin/,}error Px,
/usr/lib/postfix/{bin/,sbin/,}flush Px,
/usr/lib/postfix/{bin/,sbin/,}local Px,
/usr/lib/postfix/{bin/,sbin/,}lmtp mrPx,
/usr/lib/postfix/{bin/,sbin/,}master mrix,
/usr/lib/postfix/{bin/,sbin/,}nqmgr Px,
/usr/lib/postfix/{bin/,sbin/,}proxymap Px,
/usr/lib/postfix/{bin/,sbin/,}pickup Px,
/usr/lib/postfix/{bin/,sbin/,}pipe Px,
/usr/lib/postfix/{bin/,sbin/,}qmgr Px,
/usr/lib/postfix/{bin/,sbin/,}scache Px,
/usr/lib/postfix/{bin/,sbin/,}showq Px,
/usr/lib/postfix/{bin/,sbin/,}smtp Px,
/usr/lib/postfix/{bin/,sbin/,}smtpd Px,
/usr/lib/postfix/{bin/,sbin/,}tlsmgr Px,
/usr/lib/postfix/{bin/,sbin/,}trivial-rewrite Px,
owner /var/lib/postfix/master.lock rwk,
}

View File

@@ -1,6 +1,7 @@
# ------------------------------------------------------------------
#
# Copyright (C) 2002-2006 Novell/SUSE
# Copyright (C) 2018 Canonical, Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -10,12 +11,12 @@
#include <tunables/global>
/usr/lib/postfix/nqmgr {
profile postfix-nqmgr /usr/lib/postfix/{bin/,sbin/,}nqmgr {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/postfix-common>
/usr/lib/postfix/nqmgr rmix,
/usr/lib/postfix/{bin/,sbin/,}nqmgr mrix,
/{var/spool/postfix/,}active/ r,
/{var/spool/postfix/,}active/[0-9A-F]/ r,

View File

@@ -1,6 +1,7 @@
# ------------------------------------------------------------------
#
# Copyright (C) 2002-2005 Novell/SUSE
# Copyright (C) 2018 Canonical, Ltd.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of version 2 of the GNU General Public
@@ -11,10 +12,10 @@
#include <tunables/global>
/usr/lib/postfix/oqmgr {
profile postfix-oqmgr /usr/lib/postfix/{bin/,sbin/,}oqmgr {
#include <abstractions/base>
#include <abstractions/nameservice>
#include <abstractions/postfix-common>
/usr/lib/postfix/oqmgr rmix,
/usr/lib/postfix/{bin/,sbin/,}oqmgr mrix,
}

Some files were not shown because too many files have changed in this diff Show More