2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-22 01:57:43 +00:00

8276 Commits

Author SHA1 Message Date
Georgia Garcia
9f4dfdd57e Merge profiles: remove dpkg and lsb_release usage in usr.bin.hwctl
The [hardware-api client project](https://github.com/canonical/hardware-api/tree/main/client) has been simplified, so now we don't use `dpkg` and `lsb_release` there
This PR removes the sub-profiles for these executables.

Also, some denials were detected while running the `hwctl` binary in lxc, so the profile has been updated to fix it as well. See https://github.com/canonical/hardware-api/issues/319 for more

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1701
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-05-26 08:58:44 -03:00
Zygmunt Krynicki
2dacf287f2 Merge ci: build test images explicitly when requested
The recent change to make CI pipeline build test images on a manual
trigger masks the outcome of the pipeline. Let's use the new inputs [1]
feature to allow manually triggering the pipeline with an explicitly
built image instead.

[1] https://docs.gitlab.com/ci/inputs/

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1700
Approved-by: Maxime Bélair <maxime.belair@canonical.com>
Merged-by: Zygmunt Krynicki <me@zygoon.pl>
2025-05-25 19:32:30 +02:00
Christian Kujau
34d889f6e9 Use @{int} instead of ranges
Thanks @cboltz for the hint!
2025-05-25 13:06:08 +00:00
Christian Kujau
1e74ae32ea Allow lsblk to access Xen PVH disk devices
For details, please see:
https://bugs.launchpad.net/ubuntu/+source/apparmor/+bug/2111604
2025-05-23 22:37:45 +00:00
Nadzeya H
cd7586776c
remove dpkg and lsb_release usage in usr.bin.hwctl 2025-05-23 17:16:55 +02:00
Georgia Garcia
2e7da63183 utils: add support for multiple fstypes in mount rules
Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-05-22 15:51:45 -03:00
Zygmunt Krynicki
5aed9e8a50 ci: build test images explicitly when requested
The recent change to make CI pipeline build test images on a manual
trigger masks the outcome of the pipeline. Let's use the new inputs [1]
feature to allow manually triggering the pipeline with an explicitly
built image instead.

[1] https://docs.gitlab.com/ci/inputs/

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2025-05-22 08:41:15 +02:00
Georgia Garcia
79f2ea72b0 utils: add support for multiple options in mount rules
The tools don't support having multiple options specified in mount
rules as it is allowed in the parser.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-05-21 17:55:54 -03:00
Maxime Bélair
97dc70606b Merge add apparmor profile for dig
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1525
Approved-by: Ryan Lee <rlee287@yahoo.com>
Approved-by: Maxime Bélair <maxime.belair@canonical.com>
Merged-by: Maxime Bélair <maxime.belair@canonical.com>
2025-05-21 14:48:05 +00:00
Shishir Subedi
be143350fd add apparmor profile for dig 2025-05-21 14:48:05 +00:00
Christian Boltz
9fabe25a9f Merge libapparmor/test: avoid writing __pycache__
Having a `__pycache__` on check can result in all kinds of weird issues.
Notaby, the test environment is currently clearing all environment variables,
including those responsible for keeping a reproducible build.
This is not immediately a problem for functionality,
but complicates downstream distribution in systems such as nix, where it is considered a bug [1].

It might also be possible to force determinism by exporting env vars instead:
```
  DETERMINISTIC_BUILD=1
  PYTHONHASHSEED=0
```
This forces a special mode on the pycache, where instead of a `moddate`,
it will then store a hash of the outputs [2].
This would be an alternative fix, but considering apparmor upstream does
not (yet) test for bit-reproducibility, it is likely too fragile here.

[1] https://github.com/NixOS/nixpkgs/issues/409032
[2] https://peps.python.org/pep-0552/

I understand AppArmor might or might not care about deterministic builds.
I was writing this patch for nixpkgs anyways, so I might as well try to
contribute it - whether it gets merged or not.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1697
Approved-by: Christian Boltz <apparmor@cboltz.de>
Merged-by: Christian Boltz <apparmor@cboltz.de>
2025-05-21 11:52:39 +00:00
Grimmauld
f584505ac3 libapparmor/test: avoid writing __pycache__
Having a __pycache__ on check can result in all kinds of weird issues.
Notaby, the test environment is currently clearing all environment variables,
including those responsible for keeping a reproducible build.
This is not immediately a problem for functionality,
but complicates downstream distribution in systems such as nix, where it is considered a bug [1].

It might also be possible to force determinism by exporting env vars instead:
```
  DETERMINISTIC_BUILD=1
  PYTHONHASHSEED=0
```
This forces a special mode on the pycache, where instead of a `moddate`,
it will then store a hash of the outputs [2].
This would be an alternative fix, but considering apparmor upstream does
not (yet) test for bit-reproducibility, it is likely too fragile here.

[1] https://github.com/NixOS/nixpkgs/issues/409032
[2] https://peps.python.org/pep-0552/
2025-05-21 11:33:23 +00:00
Julia Sarris
bef7b32d24 john update 2025-05-20 14:42:50 -04:00
Julia Sarris
bece53da7b Merge branch apparmor:master into master 2025-05-20 18:42:03 +00:00
Georgia Garcia
09330c63fa Merge ci: document the GitLab cache hack
We rely on a hack that avoids compressing and pushing the cache if it
has not really changed but it's worth adding links.

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1695
Approved-by: Ryan Lee <rlee287@yahoo.com>
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-05-16 10:20:02 -03:00
Georgia Garcia
4b756c908c Merge ci: allow building the spread image in master
The current logic will only build spread images, for master (which uses
protected cache), when the .image-garden.mk or .gitlab-ci.yml files
change as compared to master. This is great IF they change and WHEN the
cache is hot but right now it seems that this is not the case and master
just has no protected cache.

Add a manual knob to run the one-off cache job whenever we want to.

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1694
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-05-16 10:17:12 -03:00
Zygmunt Krynicki
f9ba11a91e ci: document the GitLab cache hack
We rely on a hack that avoids compressing and pushing the cache if it
has not really changed but it's worth adding links.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2025-05-16 12:02:59 +02:00
Zygmunt Krynicki
272ad36df8 ci: allow building the spread in master
The current logic will only build spread images, for master (which uses
protected cache), when the .image-garden.mk or .gitlab-ci.yml files
change as compared to master. This is great IF they change and WHEN the
cache is hot but right now it seems that this is not the case and master
just has no protected cache.

Add a manual knob to run the one-off cache job whenever we want to.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2025-05-16 11:42:13 +02:00
John Johansen
c0e27e0dcb Merge ci: optimise image-* job to skip cache upload if unchanged
This relies on a documented hack that makes GitLab cache machinery
skip the upload if all of the cached files are missing in the tree.

This saves about a minute per pull request CI/CD run times the number of
images required for testing.

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1691
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-05-16 09:33:21 +00:00
John Johansen
559754c6a4 Merge ci: git restore-mtime .image-garden.mk
This fixes the long standing issue affecting caching of the image
between the image-* jobs and the spread-* jobs.

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1690
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-05-16 09:31:09 +00:00
John Johansen
b15a74ed7a Merge ci: make all jobs interruptible
This way they can be automatically cancelled by GitLab when a new commit is pushed
to a merge request, this providing feedback to the tip of the branch or pull request
more rapidly.

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1689
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-05-16 09:29:22 +00:00
Georgia Garcia
170315d35f Merge ci: exclude generated content from spread copy
This allows having a locally-built apparmor tree while using spread to
test against other distributions.

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1692
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-05-16 05:57:17 -03:00
Zygmunt Krynicki
a5bae11cfd ci: exclude generated content from spread copy
This allows having a locally-built apparmor tree while using spread to
test against other distributions.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2025-05-16 00:26:05 +02:00
Zygmunt Krynicki
81c1b86373 ci: optimise image-* job to skip cache upload if unchanged
This relies on a documented hack that makes GitLab cache machinery
skip the upload if all of the cached files are missing in the tree.

This saves about a minute per pull request CI/CD run times the number of
images required for testing.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2025-05-15 23:20:27 +02:00
Zygmunt Krynicki
d2d0f36244 ci: git restore-mtime .image-garden.mk
This fixes the long standing issue affecting caching of the image
between the image-* jobs and the spread-* jobs.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2025-05-15 23:08:45 +02:00
Zygmunt Krynicki
50734c9689 ci: make all jobs interruptible
This way they can be automatically cancelled by GitLab when a new commit is pushed
to a merge request, this providing feedback to the tip of the branch or pull request
more rapidly.

Signed-off-by: Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
2025-05-15 20:02:04 +02:00
John Johansen
e55646c41c Merge profiles: only include tests extras/abstractions/ if it exists
profiles make check was showing an error because
profiles/extras/abstractions didn't exist, so only include tests for
it if it exists. This commit also deduplicates the abstractions test.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1687
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-05-14 12:15:57 +00:00
Georgia Garcia
52da04d951 profiles: only include tests extras/abstractions/ if it exists
profiles make check was showing an error because
profiles/extras/abstractions didn't exist, so only include tests for
it if it exists. This commit also deduplicates the abstractions test.

Signed-off-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-05-14 12:08:01 +02:00
Georgia Garcia
59a636b403 Merge profiles: give lsof network netlink dgram permissions
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1686
Approved-by: Georgia Garcia <georgia.garcia@canonical.com>
Merged-by: Georgia Garcia <georgia.garcia@canonical.com>
2025-05-14 05:21:35 -03:00
Ryan Lee
e36b57857f profiles: give lsof network netlink dgram permissions
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-05-14 09:45:53 +02:00
John Johansen
84c3e629e4 Merge unix-chkpwd: Add read capability to profile
Following the Security Technical Implementation Guide, it is better to
set the permissions to 0000 for the shadow file.
However, since PAM version 1.6.0, after this change [0], unix-chkpwd
will unconditionnaly read the shadow file. And with the previous
restriction, the binary has an access denied to the shadow which
blocks user authentications. Moreover the PAM changes is needed to fix
the CVE-2024-10041.
Giving the read caability to the unix-chkpwd profile allows it to
function properly. See bug report [1].

[0] - https://github.com/linux-pam/linux-pam/pull/686
[1] - https://bugzilla.suse.com/show_bug.cgi?id=1241678

Signed-off-by: vlefebvre <valentin.lefebvre@suse.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1685
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-05-13 16:00:21 +00:00
Maxime Bélair
c8dc701666 Merge Add netcat-openbsd profile
MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1327
Approved-by: Maxime Bélair <maxime.belair@canonical.com>
Merged-by: Maxime Bélair <maxime.belair@canonical.com>
2025-05-13 07:22:31 +00:00
John Johansen
527054e0ab Merge utils aa-notify: small tweaks to the merged rule interface
This is a set of small tweaks to the merged rule interface window

- don't specify, font or size when setting bold
- improve message around unknown profiles
- add a custom message for snap profile
- output tktheme missing message, to help users identify they can improve the interface when started manually

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1529
Approved-by: John Johansen <john@jjmx.net>
Merged-by: John Johansen <john@jjmx.net>
2025-05-13 04:11:06 +00:00
John Johansen
a0af1797de utils aa-notify: add missing translation to interface
Add gettext translation call to a couple buttons text that were
missing the it.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-05-12 16:13:42 -07:00
John Johansen
9b4d747f5e utils aa-notify: If tkthemes are missing output a message
Let the user know that tkthemes is missing.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-05-12 16:13:35 -07:00
John Johansen
62123c6feb utils aa-notify: Add a special case for snap policy
Snap policy is a special case of the unknown profile. Give the user
a slightly better message for these messages.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-05-12 16:09:15 -07:00
John Johansen
9cb72734eb utils aa-notify: Update message to improve merged rules message
The current notification can be confusing, in that it can present a
profile followed by a list of rules that can't be selected.

Explictly state that the Unknown profile can't be modified so the user
has some indication that not being able to select the shown rules is
expected.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-05-12 16:07:38 -07:00
John Johansen
e0f8bd4400 utils aa-notify: Use default bold font
Instead of specifying the font type and size, which will not work for
all display configuration, use the the default BOLD font that tkinter
supplies.

Signed-off-by: John Johansen <john.johansen@canonical.com>
2025-05-12 16:07:16 -07:00
vlefebvre
556396a172 unix-chkpwd: Add read capability to profile
Following the Security Technical Implementation Guide, it is better to
set the permissions to 0000 for the shadow file.
However, since PAM version 1.6.0, after this change [0], unix-chkpwd
will unconditionnaly read the shadow file. And with the previous
restriction, the binary has an access denied to the shadow which
blocks user authentications. Moreover the PAM changes is needed to fix
the CVE-2024-10041.
Giving the read caability to the unix-chkpwd profile allows it to
function properly. See bug report [1].

[0] - https://github.com/linux-pam/linux-pam/pull/686
[1] - https://bugzilla.suse.com/show_bug.cgi?id=1241678

Signed-off-by: vlefebvre <valentin.lefebvre@suse.com>
2025-05-12 15:53:33 +00:00
Maxime Bélair
2e875f22fe Merge profiles: small fix for gs profile
Allow gs to run from confined environment by explicitly allowing access
to /usr/bin/gs.

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1684
Approved-by: Ryan Lee <rlee287@yahoo.com>
Merged-by: Maxime Bélair <maxime.belair@canonical.com>
2025-05-12 14:43:13 +00:00
Maxime Bélair
672bfcb72b Merge ProFTPD Profile
Creates an AA profile for ProFTPD. The profile has been tested on Oracular with version `1.3.8.b+dfsg-2ubuntu1`, using the source integration/unit tests and via FTP commands. As an FTP package any directory can be used for manipulating files. I've included read/write permissions to several usual locations located at the end of the profile. However these are too loose, any suggestions for how they could be tightened is much appreciated. Thanks!

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1524
Approved-by: Maxime Bélair <maxime.belair@canonical.com>
Merged-by: Maxime Bélair <maxime.belair@canonical.com>
2025-05-12 14:27:28 +00:00
bruce-canonical
e892093c06 ProFTPD Profile 2025-05-12 14:27:27 +00:00
Maxime Bélair
acc0811c37 profiles: small fix for gs profile
Allow gs to run from confined environment by explicitly allowing access
to @{exec_path}.

Signed-off-by: Maxime Bélair <maxime.belair@canonical.com>
2025-05-12 16:23:04 +02:00
Maxime Bélair
16fd1dab67 Merge profiles: add a who profile
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1634
Approved-by: Maxime Bélair <maxime.belair@canonical.com>
Merged-by: Maxime Bélair <maxime.belair@canonical.com>
2025-05-12 14:19:51 +00:00
Maxime Bélair
2a7b84cd73 Merge Initial lsof profile (+ comments)
Initial profile for review + extra descriptions to summarize why each rule / chunk is there.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1486
Approved-by: John Johansen <john@jjmx.net>
Merged-by: Maxime Bélair <maxime.belair@canonical.com>
2025-05-12 14:19:20 +00:00
Maxime Bélair
c99a73f1a0 Merge Enforce Transmission Profile
The current Transmission related profiles are set to complain mode. I've tested on Oracular `transmission-daemon` and `transmission` with the profile enforced with no denials have occurred. This MR removes the complain flag on these profiles.

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1534
Approved-by: John Johansen <john@jjmx.net>
Merged-by: Maxime Bélair <maxime.belair@canonical.com>
2025-05-12 14:06:46 +00:00
Maxime Bélair
8652b61f67 Merge profiles: add a systemd-detect-virt profile
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1640
Approved-by: Maxime Bélair <maxime.belair@canonical.com>
Merged-by: Maxime Bélair <maxime.belair@canonical.com>
2025-05-12 13:47:22 +00:00
Maxime Bélair
2800aaedd0 Merge profiles: add a profile for notify-send
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1635
Approved-by: Maxime Bélair <maxime.belair@canonical.com>
Merged-by: Maxime Bélair <maxime.belair@canonical.com>
2025-05-12 13:46:55 +00:00
Ryan Lee
d0cf1bff72 Merge profiles: also confine Xorg.wrap in addition to Xorg
For now, also use a complain mode flag like with Xorg. However, it may be
possible for complain mode to be dropped from both in the future,
tightening confinement (especially since Xorg.wrap is setuid). A
complain-mode profile can still be useful for Xorg.wrap by giving it a
separate label.

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

MR: https://gitlab.com/apparmor/apparmor/-/merge_requests/1665
Approved-by: Maxime Bélair <maxime.belair@canonical.com>
Merged-by: Ryan Lee <rlee287@yahoo.com>
2025-05-12 06:43:27 -07:00
Ryan Lee
4094bc1a05 profiles: add a smoke test for the who profile
Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
2025-05-12 15:42:24 +02:00