Commit graph

4800 commits

Author SHA1 Message Date
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