Commit graph

7716 commits

Author SHA1 Message Date
John Johansen
a5b57609db libapparmor: Sync version with 4.1~beta4 release
Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-02-11 15:44:26 -08:00
John Johansen
ef4ee955f4 Merge profiles: add frr related profiles
Add several profiles for daemons included in the frr package. It have been tested following upstream testing guide https://docs.frrouting.org/projects/dev-guide/en/latest/testing.html

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1380
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-08 05:50:13 +00:00
John Johansen
b4caf8782c Merge Fix leading slash var typo in apparmor.d var example
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1527
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 18:59:16 +00:00
John Johansen
0e46a51738 Merge Initial profile for iotop-c
AppArmor profile for `iotop-c`, developed and tested in Ubuntu 24.04 LTS.

Signed-off-by: Allen Huang <allen.huang@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1520
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 18:53:51 +00:00
John Johansen
61c332d25a Merge profiles: add wpa_supplicant
profile for wpa_supplicant in oracular

tested: creating, connecting, disconnecting, removing wireless networks, hotspot and p2 networks

Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1385
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 18:52:12 +00:00
Ryan Lee
41be573b75 Fix leading slash var typo in apparmor.d var example
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-02-07 10:38:02 -08:00
Allen Huang
0c4f70d81b
profiles/iotop-c: remove owner, redundant rules
- Remove `owner` in /proc/ rules to enable non-root users
- add "include if exists" line to pass the pipeline
- change <abstractions/nameservice> to smaller <abstractions/nameservice-strict>

Signed-off-by: Allen Huang <allen.huang@canonical.com>
2025-02-07 13:40:14 +00:00
Sudhakar Verma
0da42927e4 profiles: add wpa_supplicant
Signed-off-by: Sudhakar Verma <sudhakar.verma@canonical.com>
2025-02-07 18:46:55 +05:30
Christian Boltz
8cef7278aa Merge tests/profiles/tinyproxy: add test for path based attachment
The existing test checks that the tinyproxy systemd service is confined. However
it is possible that this confinement is based on systemd launching tinyproxy
with the expected profile, rather than tinyproxy running under the profile due
to path-based attachment. So add an explicit check for this as well as requested
by @zyga-aka-zygoon in
https://gitlab.com/apparmor/apparmor/-/merge_requests/1477#note_2334724042

Signed-off-by: Alex Murray <alex.murray@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1523
Approved-by: Zygmunt Krynicki <me@zygoon.pl>
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2025-02-07 12:18:00 +00:00
John Johansen
13caf52705 Merge profiles/apparmor.d: add wireguard profile
Add AA profiles for wireguard tools: `wg` and `wg-quick`. This profile has been tested on the latest oracular wireguard version `1.0.20210914-1.1ubuntu1` and the latest upstream version. In particular, this has been tested using the upstream tests in:
- https://git.zx2c4.com/wireguard-linux-compat/tree/src/tests/netns.sh
- https://git.zx2c4.com/wireguard-tools/tree/contrib/ncat-client-server
- https://git.zx2c4.com/wireguard-tools/tree/contrib/json
- https://git.zx2c4.com/wireguard-tools/tree/contrib/reresolve-dns

Similarly to the MR !1319 for `socat`, Few CI tests are failing due to the inclusion of apparmor.d/abstractions/strict-nameservice.

Signed-off-by: Evan Caville <evan.caville@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1323
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:34:53 +00:00
Evan Caville
4c79c382cf profiles/apparmor.d: add wireguard profile 2025-02-07 07:34:53 +00:00
John Johansen
da7288c710 Merge add tshark profile
- add profile for tshark
- sub profile for dumpcap
- tested with tests from upstream wireshark project,not all test cases 
  passed but failures unrelated to apparmor restriction

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1384
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:32:33 +00:00
Shishir Subedi
594f391502 add tshark profile 2025-02-07 07:32:32 +00:00
John Johansen
d8a96615d8 Merge Add a profile for ZNC
Some weirdnesses:
- The Perl abstraction specifies an ix execution mode for Perl, while my impression from the Python abstraction is that we shouldn't be specifying execution modes for the script interpreter in the abstractions. It's probably too late to change that though.
- Tcl apparently doesn't have an abstraction available. Given the way it's embedded into applications like ZNC, I'm assuming that Tcl doesn't have support files the way Python does.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1376
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:31:50 +00:00
John Johansen
c7be379d1b Merge profiles/apparmor.d: add tnftp profile
Add AA profile for tnftp. This profile has been tested on the latest oracular tnftp version 20230507-2build3 which is also the latest upstream version. This profile limits the file downloads to common download directories and /tmp. It also cripples the "!" command denying access to network and allowing the execution of binaries located directories for which we deny write access. Any feedback is welcome.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1363
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:31:25 +00:00
John Johansen
91849b31e0 Merge Add remmina profile
Signed-off-by: Paulo Flabiano Smorigo <pfsmorigo@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1348
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:30:14 +00:00
John Johansen
54fc2c2ba1 Merge socat: add profile
Add AA profile for `socat`. This profile has been tested on the latest oracular socat version `1.8.0.0-4build3` and the latest upstream version `1.8.0.1`. I raised the PR and this profile has already been merged on the `roddhjav/apparmor.d` repo, [here](https://github.com/roddhjav/apparmor.d/pull/454). For now, I have added this profile in "extra", but let me know if you think otherwise, any feedback is welcome.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1319
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:22:48 +00:00
John Johansen
d01373a748 Merge profiles/apparmor.d: add rygel profile
Signed-off-by: Alex Murray <alex.murray@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1311
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:22:06 +00:00
John Johansen
10f9574a71 Merge aa-notify: Allow to select rules individually
It is now possible to select individual rules to allow through an
improved GUI (ShowMoreGUIAggregated).

This commit also simplifies codebase thanks to new classes ProfileRules
and SelectableRules.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1444
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:21:10 +00:00
Maxime Bélair
6346163f56 aa-notify: Allow to select rules individually 2025-02-07 07:21:10 +00:00
John Johansen
0ab4fc0580 Merge parser: fix priority so it is handled on a per permission basis
The current behavior of priority rules can be non-intuitive with
higher priority rules completely overriding lower priority rules even in
permissions not held in common. This behavior does have use cases but
its can be very confusing, and does not normal policy behavior

    Eg.
      priority=0 allow r /**,
      priority=1 deny  w /**,
    
will result in no allowed permissions even though the deny rule is
only removing the w permission, beause the higher priority rule
completely over ride lower priority permissions sets (including
none shared permissions).

Instead move to tracking the priority at a per permission level. This
allows the w permission to still override at priority 1, while the
read permission is allowed at priority 0.

The final constructed state will still drop priority for the final
permission set on the state.

Note: this patch updates the equality tests for the cases where
      the complete override behavior was being tested for.

      The complete override behavior will be reintroduced in a future
      patch with a keyword extension, enabling that behavior to be used
      for ordered blocks etc.

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1522
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-07 07:18:30 +00:00
Alex Murray
1f2175d854
tests/profiles/tinyproxy: add test for path based attachment
The existing test checks that the tinyproxy systemd service is confined. However
it is possible that this confinement is based on systemd launching tinyproxy
with the expected profile, rather than tinyproxy running under the profile due
to path-based attachment. So add an explicit check for this as well as requested
by @zyga-aka-zygoon in
https://gitlab.com/apparmor/apparmor/-/merge_requests/1477#note_2334724042

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-07 12:30:06 +10:30
John Johansen
b378da1f9c Merge Add an Alsamixer profile
This profile deliberately does not use `abstractions/audio`, instead listing only the subset of the interfaces required to enumerate audio devices and control their volume, without the parts needed to actually send or receive audio from them. This could also be a useful basis for splitting `abstractions/audio` into finer-grained subcomponents.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1517
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-06 20:26:59 +00:00
John Johansen
12787648a7 Merge tests: run regression tests with spread (self-hosted)
This requires a runner with the tags: linux, x86_64, kvm. One needs to
be provisioned for the AppArmor project for the pipeline to function.

It is possible to run the same tests on SAAS runners offered by GitLab
but due to issue gitlab-org/gitlab-runner#6208 there is no way to expose
/dev/kvm on the host to the guest. Without this feature emulation works
but is rather slow as to be impractical.

Note that there's some overlap between the build-all job and spread that
might be avoided in the future. At present this is made more difficult
by the fact that the path where build-all job builds libapparmor is
stored internally by autotools. This prevents us from using GitLab
artifacts from moving the built files across to the spread testing jobs
without extra work.

In addition to adding the spread job, remove test-build-regression job.
This job is now redundant since the same operation is done when spread
builds and runs regression tests.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1512
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-06 19:48:11 +00:00
Ryan Lee
b5b1944f58 Merge profiles: fix unshare for deleted files
Unfortunately similar to bwrap unshare will need the mediate_deleted
flag in some cases.

see
  commit 6488e1fb7 "profiles: add mediate_deleted to bwrap"

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1521
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: Ryan Lee <rlee287@yahoo.com>
2025-02-06 19:44:21 +00:00
John Johansen
5bc1cd763c Merge Some updates to modernize the mount regression test
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1449
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-02-06 19:29:39 +00:00
John Johansen
5585a4fc9e Merge profiles/apparmor.d: add profile for tinyproxy
This was tested using the test-tinyproxy.py script from qa-regression-testing as
well as by running the upstream test suite with a brief hack to ensure it
invokes tinyproxy with aa-exec -p tinyproxy first.

Signed-off-by: Alex Murray <alex.murray@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1477
Approved-by: Ryan Lee <rlee287@yahoo.com>
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: John Johansen <john@jjmx.net>
2025-02-06 19:28:41 +00:00
John Johansen
c157eb0cb6 profiles: fix unshare for deleted files
Unfortunately similar to bwrap unshare will need the mediate_deleted
flag in some cases.

see
  commit 6488e1fb7 "profiles: add mediate_deleted to bwrap"

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-02-06 11:25:35 -08:00
John Johansen
e86fe8c96c Merge Add lsblk profile
AppArmor profile for the lsblk binary, developed and tested on Ubuntu 24.04.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1437
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: John Johansen <john@jjmx.net>
2025-02-06 19:21:14 +00:00
Ryan Lee
49babf1d17 Add an Alsamixer profile
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-02-06 11:08:46 -08:00
John Johansen
1ebd991155 parser: change priority so that it accumulates based on permissions
The current behavior of priority rules can be non-intuitive with
higher priority rules completely overriding lower priority rules even in
permissions not held in common. This behavior does have use cases but
its can be very confusing, and does not normal policy behavior

Eg.
  priority=0 allow r /**,
  priority=1 deny  w /**,

will result in no allowed permissions even though the deny rule is
only removing the w permission, beause the higher priority rule
completely over ride lower priority permissions sets (including
none shared permissions).

Instead move to tracking the priority at a per permission level. This
allows the w permission to still override at priority 1, while the
read permission is allowed at priority 0.

The final constructed state will still drop priority for the final
permission set on the state.

Note: this patch updates the equality tests for the cases where
the complete override behavior was being tested for.

The complete override behavior will be reintroduced in a future
patch with a keyword extension, enabling that behavior to be used
for ordered blocks etc.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-02-06 11:02:20 -08:00
John Johansen
e56dbc2084 parser: fix prefix dump to include priority
The original patch adding priority to the set of prefixes failed to
update the prefix dump to include the priority priority field.

Fixes: e3fca60d1 ("parser: add the ability to specify a priority prefix to rules")

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-02-06 10:54:42 -08:00
John Johansen
cc31a0da22 parser: drop priority from state permissions
The priority field is only used during state construction, and can
even prevent later optimizations like minimization. The parser already
explcitily clears the states priority field as part of the last thing
done during construction so it doesn't prevent minimization
optimizations.

This means the state priority not only wastes storage because it is
unused post construction but if used it could introduce regressions,
or other issues.

The change to the minimization tests just removes looking for the
priority field that is no longer reported.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-02-06 10:53:19 -08:00
John Johansen
9221d291ec parser: stop using dynamic_cast for prompt permission calculations
Like was done for the other MatchFlags switch to using a node type
instead of dynamic_cast as this will result in a performance
improvement.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-02-06 08:34:02 -08:00
Allen Huang
e53cda33a3
profiles/iotop-c: use @{HOME}
Signed-off-by: Allen Huang <allen.huang@canonical.com>
2025-02-06 14:55:16 +00:00
Allen Huang
7bd505aa65
profiles/iotop-c: add profile name and rename the file
Signed-off-by: Allen Huang <allen.huang@canonical.com>
2025-02-06 14:54:39 +00:00
Allen Huang
5b874f45f3
Add iotop-c profile
Signed-off-by: Allen Huang <allen.huang@canonical.com>
2025-02-06 11:32:58 +00:00
Alex Murray
0217af9d82
tests/profiles/tinyproxy/task.yaml: fix tinyproxy smoke test
Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-06 21:32:36 +10:30
Alex Murray
94d494d8fe
profiles/apparmor.d/tinyproxy: allow capability set[ug]id
Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-06 18:52:32 +10:30
Alex Murray
965a678cb7
profiles/apparmor.d/tinyproxy: allow capability setgid
tinyproxy drops privileges in some configurations so ensure we allow it.

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-06 18:15:18 +10:30
Alex Murray
f2a6860767
profiles/apparmor.d/tinyproxy: allow dgram and netlink network access
This is required for DNS resolution

Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-06 18:15:00 +10:30
Christian Boltz
002bf1339c Merge spread: Add support for EXPECT_DENIALS in profile tests
This commit adds support for EXPECT_DENIALS in profile tests. Any test
that sets the EXPECT_DENIALS environment variable is expected to trigger
AppArmor denials and will fail if none was generated.

This allows to test that problematic behaviors are correctly blocked.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1515
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2025-02-05 16:44:42 +00:00
Jorge Sancho Larraz
42297559e8 profiles/bgpd: remove redundant /etc/services 2025-02-05 17:00:22 +01:00
Jorge Sancho Larraz
a6c2efcb4a profiles/a/frr: allow any file in log directory 2025-02-05 16:32:54 +01:00
Jorge Sancho Larraz
4fa3a02127 profiles/a/frr: add additional configuration file location 2025-02-05 16:31:45 +01:00
Jorge Sancho Larraz
c67061c64f profiles/a/frr: clean up rules only needed by topotests 2025-02-05 16:31:03 +01:00
Jorge Sancho Larraz
7a98040b1b profiles/a/frr: remove owner keyword causing failures 2025-02-05 16:29:29 +01:00
Jorge Sancho Larraz
fa28d65f44 profiles/a/frr-snmp: use abstractions/openssl 2025-02-05 16:27:57 +01:00
Maxime Bélair
fc3f27e255 spread: Add support for EXPECT_DENIALS in profile tests
Introduce the EXPECT_DENIALS environment variable for profile tests.
Each line of EXPECT_DENIALS is a regex that must match an AppArmor
denial for the corresponding test, and conversely.

This ensures that problematic behaviors are correctly blocked and logged.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-02-05 10:02:21 +01:00
Alex Murray
8729c65bfe
tests/profiles/tinyproxy: add spread smoke test for tinyproxy
Signed-off-by: Alex Murray <alex.murray@canonical.com>
2025-02-04 16:44:37 +10:30