mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
[GH-ISSUE #3659] AppArmor profile fails to load with AppArmor 3.0.0 installed #2302
Labels
No labels
LTS merge
LTS merge
bug
bug
converted-to-discussion
doc-todo
documentation
duplicate
enhancement
file-transfer
firecfg
firejail-in-firejail
firetools
graphics
help wanted
information_old
installation
invalid
modif
moved
needinfo
networking
notabug
notourbug
old-version
overlayfs
packaging
profile-request
pull-request
question
question_old
removal
runtime-permissions
sandbox-ipc
security
stale
wiki
wiki
wontfix
wordpress
workaround
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/firejail#2302
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @zethexx on GitHub (Oct 9, 2020).
Original GitHub issue: https://github.com/netblue30/firejail/issues/3659
Bug and expected behavior
Expected behaviour: The AppArmor profile loads without an error (i.e. the command
sudo apparmor_parser -r /etc/apparmor.d/firejail-defaultexits with exit code 0), allowing myself to use AppArmor integration in firejail.Actual behaviour: When loading the AppArmor profile using
sudo apparmor_parser -r /etc/apparmor.d/firejail-default, I getFound reference to variable run, but is never declaredand the process exits with exit code 1. As a result, Firejail cannot use AppArmor to confine applications. When running a program in Firejail using theapparmoroption enabled, I get:The program runs normally except there is no AppArmor confinement. Running
sudo aa-statusconfirms this, it only says the module is loaded.Probable cause: The
apparmorpackage in my distribution has been upgraded from 2.13.4 to 3.0.0. A change in the syntax or something may have broken the profile.Probable fix: Update AppArmor profile maybe? not sure how older apparmor versions will be managed then
Temporary fix for those affected: I simply downgraded the AppArmor package as described in the ArchWiki, this is only for Arch users of course. I had no side effects of downgrading, also I was able to immediately use AppArmor without need to reboot, but I would still recommend rebooting.
Reproduce
Install AppArmor 3.0.0 in your distribution and try to load the firejail-default AppArmor profile.
Environment
Distro: Arch Linux rolling, latest version as of 2020-10-09
Firejail version: git
5549f89325Should have the same issue if used with latest stable release.
Additional context
The error I get when trying to load the apparmor profile using
sudo apparmor_parser -r /etc/apparmor.d/firejail-default:Happens when AppArmor 3.0.0 is used with Firejail.
Loading the apparmor profile using
sudo aa-enforce firejail-default:Error code 1.
The loading profile using apparmor_parser is told from the archwiki, the loading profile using aa-enforce is told from firejail docs/program. I don't think it should matter
@SarchB commented on GitHub (Oct 9, 2020):
Yep, same problem on Arch indeed.
@FOSSONLY commented on GitHub (Oct 9, 2020):
The maintainer at Arch does not seem to be very considerate about simply updating packages at any cost, although the AppArmor project explicitly warns against it. Especially since AppArmor 3.0 is only a transition release, which is not intended for productive use in a regular linux distribution. It is therefore purely experimental and intended to ease the transition in the face of major changes until the first productive release (AppArmor 3.1) in months. And given the amount of changes, AppArmor 3.x should be put on hold until the most serious bugs and problems are fixed.
@kris7t commented on GitHub (Oct 10, 2020):
It seems we need to define the
@{run}variables as per452b5b8735Adding
to
/etc/apparmor.d/firejail-defaultseems to do the trick (if existshelps for Apparmor version that don't have this tunable). It seems backwards compatible to add this code to Firejail, at least with Apparmor versions that understandif exists.We might also need to add something like
to the profile to stop warnings, but I don't have any idea how to do that in a backwards-compatible way.
@ghost commented on GitHub (Oct 10, 2020):
@kris7t Do you happen to have a firejail-default file with the above changes so more people can test things?
Upstream committed a config option to disable ABI warnings (warn=no-abi) that might prove useful in this context, but the current Arch apparmor package 3.0.0-2 does not have that option.
@curiosityseeker commented on GitHub (Oct 10, 2020):
Well, I just added that change to the top of firejail-default, and it solves the problem, indeed:
Hm, I don't see these warnings on Arch ... As a matter of fact I have multiple self-made AppArmor profiles, and they work flawlessly under AA 3.0 so far.
@kris7t commented on GitHub (Oct 10, 2020):
@glitsj16 I created a pull request https://github.com/netblue30/firejail/pull/3660 with my simple fix, and also discussed some more robust (albeit more complicated) solutions.
@curiosityseeker Yeah, by default, the AppArmor parser doesn't run with
--warn all, so there are no warnings. However, if I invoke it with--warn all, it does complain about ABI compatibility, because<abstractions/dbus-strict>and<abstractions/dbus-session-strict>are declared to beabi <abi/3.0>. It sounds like a bad idea to invoke those abstractions from a not-3.0 profile, because AppArmor will use the ABI of the profile to interpret the abstractions, despite their own ABI declarations (or so says the warning). I guess we are fine for now, but we may encounter some odd behavior in the future (if the abstractions decide to actually rely on ABI-specific behavior).@cboltz commented on GitHub (Oct 17, 2020):
For the records: the
abi <abi/3.0>declaration means that the "new" rule typesnetwork,dbusandunixrules will get enforced - under the following conditions (simplified, see below):abi <abi/3.0>declaration in the profileIf these conditions aren't met, the "new" rule types will not be enforced. Instead, all network etc. acess will be allowed - basically you'll get the same behaviour as if your profile would have broad
network,dbus,andunix,rules.As I mentioned, the conditions above are simplified. Some additional details:
networkrules is available since kernel 4.17 (needs AppArmor 3.0 userspace + theabideclaration)abiabi@curiosityseeker commented on GitHub (Oct 21, 2020):
@cboltz : Christian, thanks for this info! One question, though: The release notes for AppArmor 3.0 say:
Does that mean that your remark above that ...
... is only valid for 3.0 but no longer for 3.1 and later?
@cboltz commented on GitHub (Oct 22, 2020):
I should have written "at least AppArmor 3.0" and "at least
abi <abi/3.0>" ;-)The "new" rule types will be enforced starting with 3.0, and also with later versions.