Commit graph

5108 commits

Author SHA1 Message Date
Christian Boltz
0b94cbe516 Merge branch 'cboltz-drop-deprecated' into 'master'
drop deprecated perl code

* drop repair_obsolete_profiles (updated profiles for abstraction renames pre-2006)
* drop ancient perl aa-* tools and their modules (rewritten to python in 2.9)
* drop rc.aaeventd.{redhat,suse} initscripts (aaeventd was dropped long ago, therefore we don't need to keep its initscripts)

See merge request apparmor/apparmor!423

Acked-by: John Johansen <john.johansen@canonical.com>
2019-09-25 20:32:20 +00:00
Christian Boltz
523f21fb20
drop rc.aaeventd.{redhat,suse} initscripts
aaeventd was dropped long ago, therefore we don't need to keep its
initscripts.
2019-09-23 21:46:16 +02:00
Christian Boltz
12488fcc9a
drop ancient perl aa-* tools and their modules
They were rewritten to python in 2.9.
2019-09-23 21:43:58 +02:00
Christian Boltz
506f51e6fd
drop repair_obsolete_profiles
(updated profiles for abstraction renames pre-2006)
2019-09-23 21:40:27 +02:00
Christian Boltz
98fde52998 Merge branch 'drop-perl' into 'master'
drop deprecated perl code
* aa-repo.pl
* convert-profile.pl

See merge request apparmor/apparmor!416

Acked-by: Christian Boltz <apparmor@cboltz.de>
2019-09-23 19:35:58 +00:00
Christian Boltz
b76567ce10 Merge branch 'cboltz-status-parenthesis' into 'master'
aa-status: handle profile names containing '('

Closes #51

See merge request apparmor/apparmor!415

Acked-by: John Johansen <john.johansen@canonical.com> for 2.10..master
2019-09-23 18:55:22 +00:00
John Johansen
094f9727fa Merge branch 'dont-allow-fontconfig-cache-write' into 'master'
abstractions/fonts: don't allow write of fontconfig cache files

See merge request apparmor/apparmor!420
2019-09-20 09:42:53 +00:00
John Johansen
c9fcc18b9a Fix setfcap Cap mispelling
PR: https://gitlab.com/apparmor/apparmor/merge_requests/421
Acked-by: John Johansen <john.johansen@canonical.com>
2019-09-17 10:01:03 +00:00
Paulo Gomes
2d19d4d159
Fix capability mispelling. 2019-09-17 10:38:09 +01:00
John Johansen
59e799a9ba abstractions/X: allow reading the Xauth file mutter passes to Xwayland.
Applications running under Xwayland in a GNOME+Wayland session need read access to this file since:

a8984a81c2

… that was first included in mutter 3.33.3.

This rule is presumably only needed for GNOME+Wayland sessions, so one could argue that it should live in abstractions/wayland instead, but Jamie argued that it should be in the X abstraction because Xwayland is a X server.

MR: https://gitlab.com/apparmor/apparmor/merge_requests/419
Bug-Debian: https://bugs.debian.org/935058
Acked-by: John Johansen <john.johansen@canonical.com>
2019-09-16 15:08:40 +00:00
Jamie Strandboge
c5968c70d0 abstractions/fonts: don't allow write of fontconfig cache files
879531b36ec3dfc7f9b72475c68c30e4f4b7b6af changed access for
@{HOME}/.{,cache/}fontconfig/** to include 'w'rite. Fontconfig has been
a source of CVEs. Confined applications should absolutely have read
access, but write access could lead to breaking out of the sandbox if a
confined application can write a malformed font cache file since
unconfined applications could then pick them up and be controlled via
the malformed cache. The breakout is dependent on the fontconfig
vulnerability, but this is the sort of thing AppArmor is meant to help
guard against.
2019-09-09 15:52:40 -05:00
intrigeri
c006f79141 abstractions/X: allow reading the Xauth file mutter passes to Xwayland.
Bug-Debian: https://bugs.debian.org/935058

Applications running under Xwayland in a GNOME+Wayland session need read access
to this file since:

  a8984a81c2

… that was first included in mutter 3.33.3.

This rule is presumably only needed for GNOME+Wayland sessions, so one could
argue that it should live in abstractions/wayland instead, but Jamie argued that
it should be in the X abstraction because Xwayland is a X server.
2019-09-08 07:41:36 +00:00
intrigeri
33c5f61c75 Merge branch 'utab' into 'master'
profiles/gnome: Allow access of /run/mount/utab

See merge request apparmor/apparmor!412
2019-09-08 06:58:44 +00:00
intrigeri
9acb17adf0 Merge branch 'cboltz-whitespace' into 'master'
fix whitespace and indentation in several files

See merge request apparmor/apparmor!413
2019-09-08 06:48:27 +00:00
Bryan Quigley
0401235949 Remove a selection of obsolete support.
Requires NPAPI which no major browsers support anymore:
Mozplugger
npviewer / nspluginwrapper

The following have been discontinued
Google Talk (and plugin)
f-spot
conkeror
galeon
Mozilla Prism
rekonq
Adobe Reader for Linux

Other
gnome-codec-install is not in Ubuntu anymore
gstreamer0.10 was replaced by 1.0
2019-08-24 09:50:34 -07:00
John Johansen
a00ac89be8 drop deprecated perl code
With the effort to remove perl, it makes no sense to keep the depracted
perl code around for new releases.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2019-08-21 18:31:34 -07:00
Christian Boltz
41d26b0197
aa-status: handle profile names containing '('
aa-status crashed if a profile name contains an opening parenthesis
because the regex enforces (simplified) '^[^(]* \(.*\)' when reading
/sys/kernel/security/apparmor/profiles

This obviously doesn't match if a profile name contains '(' which is
rare and strange, but still allowed, and the match result "None" then
crashes aa-status.

Adjust the regex to allow all chars instead of all except '(' to handle
these corner cases.

Note that '(enforce)' and '(complain)' still get read correctly because
the regex ends with '\((\w+)\)$' and therefore enforces matching
"something inside parenthesis at the end of the line".

This bug exists since aa-status was rewritten into python, and even
existed in the perl version before. However, in the perl version, the
regex matching was protected with an if so profile names with '(' were
skipped and hidden from the aa-status output.

Fixes: https://gitlab.com/apparmor/apparmor/issues/51
2019-08-16 22:10:36 +02:00
Christian Boltz
e246568819
fix whitespace and indentation in several files 2019-08-12 23:58:04 +02:00
Jörg Sommer
cd3532f792 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.
2019-08-09 10:11:37 +02:00
nl6720
54dc60ff5b Update usr.sbin.winbindd profile
Winbind requires access to /var/cache/samba/msg.lock/*.
Move msg.lock/ to abstractions/samba.
On Arch Linux Winbind's pid is set to /run/winbindd.pid.

Signed-off-by: nl6720 <nl6720@gmail.com>
2019-08-08 19:37:37 +03:00
Christian Boltz
2e304f82fc Merge branch 'cboltz-logparser-simplify-prefilter' into 'master'
Simplify log prefilter in logparser.py

See merge request apparmor/apparmor!400

Acked-by: John Johansen <john.johansen@canonical.com>
2019-08-05 20:01:59 +00:00
Christian Boltz
095d65f4ae
Simplify log prefilter in logparser.py
As discussed in https://gitlab.com/apparmor/apparmor/merge_requests/395
RE_LOG_ALL should be more broad so that it doesn't accidently
overlook/ignore valid log events.

Instead of adding more and more known log formats to logparser.py,
simplify the regex to do only a basic check.

If we really hand over a line to libapparmor that isn't an AppArmor log
event, worst thing that can happen is that we waste a few milliseconds
for handing over that line to libapparmor, and get AA_RECORD_INVALID as a
result.
2019-08-05 21:42:59 +02:00
Tyler Hicks
167e9207be Merge branch 'lp1838991' into 'master'
parser: Fix typoed example dbus rule in apparmor.d(5) man page

See merge request apparmor/apparmor!410

Bug: https://launchpad.net/bugs/1838991
Acked-by: Christian Boltz <apparmor@cboltz.de>
2019-08-05 16:56:50 +00:00
Tyler Hicks
7df48adae5 parser: Fix typoed example dbus rule in apparmor.d(5) man page
Remove extra closing parenthesis.

Bug: https://launchpad.net/bugs/1838991
Fixes: 46586a6334 ("parser: Add example dbus rule for unconfined peers")
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2019-08-05 15:14:35 +00:00
Vincas Dargis
6cfeb55e0e 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.
2019-08-05 16:23:58 +03:00
Christian Boltz
39ac1e8ca3 Merge branch 'cboltz-exec-without-target' into 'master'
logparser.py: don't error out on exec events without target

See merge request apparmor/apparmor!405

Acked-by: John Johansen <john.johansen@canonical.com>
2019-08-02 12:00:44 +00:00
Tyler Hicks
5bd75cd0b7 Merge branch 'test-policy-cache-old-libapparmor' into 'master'
tests: Allow aa_policy_cache.c to build against old libapparmors

See merge request apparmor/apparmor!407

Acked-by: John Johansen <john.johansen@canonical.com>
2019-08-01 22:46:58 +00:00
Tyler Hicks
2893a6af05 Merge branch 'nnp-test' into 'master'
tests: Add NO_NEW_PRIVS regression tests

See merge request apparmor/apparmor!408

Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
2019-08-01 22:41:15 +00:00
Tyler Hicks
7670336a82 libapparmor, tests: Be explicit about value-if-true in ternary operator
Improve readability by being explicit about the value to use when the
conditional evaluates to true.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Suggested-by: John Johansen <john.johansen@canonical.com>
2019-08-01 22:31:07 +00:00
Tyler Hicks
83d0b99729 Merge branch 'parser-cachedir-usage-typo' into 'master'
parser: Fix minor typo in usage

See merge request apparmor/apparmor!406

Acked-by: John Johansen <john.johansen@canonical.com>
2019-08-01 21:11:19 +00:00
Tyler Hicks
a77ba80838 tests: Allow aa_policy_cache.c to build against old libapparmors
Commit ad81ea0e67 ("tests: Add option to dump policy cache dir with
the libapparmor wrapper") modified aa_policy_cache.c to call
aa_policy_cache_dir_path_preview(). That added a hard dependency on
libapparmor >= 2.13, which is the first version to add
policy_cache_dir_path_preview() to libapparmor. The dependency makes it
impossible to build and run the upstream regression tests against an
installed libapparmor older than 2.13 due to aa_policy_cache.c failing
to build.

Add a compatible aa_policy_cache_dir_path_preview() when building
aa_policy_cache.c against a libapparmor older than 2.13 and newer than
or equal to 2.10.

Fixes: ad81ea0e67 ("tests: Add option to dump policy cache dir with the libapparmor wrapper")
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2019-08-01 16:40:14 +00:00
Tyler Hicks
50e34b45c2 parser: Fix minor typo in usage
Correct the long option used to print the cache directory.

Fixes: e9d9395f91 ("parser: Add option to print the cache directory")
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2019-08-01 15:04:49 +00:00
Tyler Hicks
9160204008 tests: Add NO_NEW_PRIVS regression tests
Test the profile transition limits imposed by NO_NEW_PRIVS to ensure
that behavior doesn't unexpectedly change.

Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
2019-08-01 14:58:32 +00:00
Christian Boltz
a0c1eb0abd
logparser.py: don't error out on exec events without target
commit 7297e2f6a8 assumed that exec events
always have a "target=...", but this is only true for events in complain
mode. In enforce mode, the log line doesn't include "target=...".

This commits sets an empty target instead of erroring out on every exec
event in enforce mode.

Also adjust ask_exec() in aa.py to only update
hashlog[aamode][target_profile]['final_name'] if target_profile is set
(hashlog[aamode][''] doesn't exist and trying to write to it would error
out)
2019-07-27 22:48:30 +02:00
Christian Boltz
dc3d11bf0a
add log testcases for exec with and without target=
- in complain mode, exec events include target=...
- in enforce mode, the log message doesn't include target=...

Note that the utils tests skip exec events (they'd be interactive),
therefore exec*.profile doesn't contain an exec rule.
2019-07-27 22:23:15 +02:00
intrigeri
c9b8cfa4a9 Avoid blhc "CPPFLAGS missing" false positive. 2019-07-17 20:51:48 +00:00
Christian Boltz
db1f391844 Merge branch 'cboltz-unbalanced-parenthesis' into 'master'
Fix crash on unbalanced parenthesis in filename

See merge request apparmor/apparmor!402

Seth Arnold <seth.arnold@canonical.com> for 2.10..master
2019-07-09 19:45:08 +00:00
Xiang Fei Ding
654d96a3f7
parser: allow overriding which ar(1) is invoked
When cross compiling apparmor-parser, Makefile will use ar for
creating the static library. However, ar produces libraries on
the build platform. The right ar could be prefixed with the target
platform triples.

Signed-off-by: Xiang Fei Ding <dingxiangfei2009@gmail.com>
Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
Ref: https://github.com/NixOS/nixpkgs/pull/63999
Bug: https://gitlab.com/apparmor/apparmor/issues/41
2019-07-08 12:28:30 -07:00
Christian Boltz
8f74ac02ca
Fix crash on unbalanced parenthesis in filename
convert_regexp() needs to escape '(' and ')' in filenames taken from a
logfile to get rid of their special meaning, and to avoid a crash on
unbalanced parenthesis (which makes the regex invalid if they are not
escaped).

Note: The added tests include an example log line, but the tests itsself
don't/didn't trigger the crash because they don't call convert_regexp().

Fixes: https://bugs.launchpad.net/bugs/1835311
2019-07-07 22:24:12 +02:00
John Johansen
0349cf2d0a libapparmor: logparse: fix RECORD_INVALID for valid log
v2:
- parse partial log line broken at \n
- add testcase_dbus_10.* for partial log line
- remove quotes from  testcasw_dbus_09.profile

The following log format has been seen in the wild, and currently results
in a RECORD_INVALID

    [4835959.046111] audit: type=1107 audit(1561053426.749:186): pid=640 uid=103 auid=4294967295 ses=4294967295 msg='apparmor="ALLOWED" operation="dbus_method_call"  bus="system" path="/org/freedesktop/systemd1" interface="org.freedesktop.systemd1.Manager" member="LookupDynamicUserByName" mask="send" name="org.freedesktop.systemd1" pid=20596 label="/usr/sbin/sshd" peer_pid=1 peer_label="unconfined"
                      exe="/usr/bin/dbus-daemon" sauid=103 hostname=? addr=? terminal=?'

Test parsing the above message with and without the \n embedded between
peer_label= and exec=

Acked-by: Seth Arnold <seth.arnold@canonical.com>
Signed-off-by: John Johansen <john.johansen@canonical.com>
2019-07-02 01:01:37 -07:00
Christian Boltz
8a8130d4dd Merge branch 'cboltz-whitespace-fix' into 'master'
Fix whitespace in ssl_* abstractions

See merge request apparmor/apparmor!399

Acked-by: John Johansen <john.johansen@canonical.com>
2019-06-30 07:16:06 +00:00
Christian Boltz
2d74c42c75
Fix whitespace in ssl_* abstractions
Drop superfluous whitespace introduced by
4d275bab69 and
3016ffb336
2019-06-29 23:23:07 +02:00
Christian Boltz
b0575b077b Merge branch 'master' into 'master'
Add for Certbot on openSUSE Leap

The default path is `/etc/certbot/archive/{some domain}/{file name}.pem`

See merge request apparmor/apparmor!397


Acked-by: Christian Boltz <apparmor@cboltz.de>
2019-06-29 21:05:39 +00:00
Richard Chen
4d275bab69 Update ssl_keys 2019-06-28 07:31:10 +00:00
Richard Chen
3016ffb336 Add for CertBot on openSUSE Leap 2019-06-28 07:30:10 +00:00
Christian Boltz
0d327abf3a Merge branch 'cboltz-postfix-profiles' into 'master'
postfix/master needs to execute postfix/error

See merge request apparmor/apparmor!392

Acked-by: Seth Arnold <seth.arnold@canonical.com>
2019-06-27 14:41:41 +00:00
Christian Boltz
5aa17c1fa4 Merge branch 'cboltz-sfs-mountpoint' into 'master'
Fix and simplify setting SFS_MOUNTPOINT

See merge request apparmor/apparmor!394

Acked-by: Seth Arnold <seth.arnold@canonical.com>
2019-06-27 14:33:57 +00:00
Steve Beattie
7c7a4bc531
regression tests/mult_mount: bump size of created disk image
The mult_mount test creates a small disk image, formats it, and mounts
it in multiple locations in preparation for the tests. However, the
created raw file (80KB) is too small to make a working file system if
4K blocks are used by mkfs. In Ubuntu 19.10, the default was recently
changed for mkfs to default to always using 4K blocks, causing the
script to fail.

We could force mkfs to use 1K blocks, but instead, in case some future
version of mkfs decides not to support 1K blocks at all, we bump up the
size of the disk image to 512KB; large enough to work with 4K blocks
yet small enough to be workable in small scale test environments.

Signed-off-by: Steve Beattie <steve.beattie@canonical.com>
Acked-by: John Johansen <john.johansen@canonical.com>
Acked-by: Seth Arnold <seth.arnold@canonical.com>
Bug: https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/1834192
MR: https://gitlab.com/apparmor/apparmor/merge_requests/396
2019-06-26 08:36:04 -07:00
Christian Boltz
61c27d8808
Fix and simplify setting SFS_MOUNTPOINT
Instead of setting SFS_MOUNTPOINT in is_apparmor_loaded() (which is
called in most cases) and in is_container_with_internal_policy() (which
covers/fixes the remaining cases), set it globally.

This also fixes a bug in is_container_with_internal_policy() (introduced
in f10e72a14f) where the variable
definition tried to use the no longer existing $MODULE variable and
therefore got a wrong path for $SFS_MOUNTPOINT.

Besides this bug, there's a minor behaviour change / improvement if
securityfs isn't mounted - "file not found" error messages will now
contain the full/correct path ;-)

This change/cleanup is a follow-up of
https://gitlab.com/apparmor/apparmor/merge_requests/363 and some IRC
discussions 2019-04-16.
2019-06-21 19:22:15 +02:00
Christian Boltz
f250e94240
postfix/master needs to execute postfix/error 2019-06-20 14:37:46 +02:00