-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AppArmor profile fails to load with AppArmor 3.0.0 installed #3659
Comments
Yep, same problem on Arch indeed. |
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. |
It seems we need to define the Adding
to 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. |
@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. |
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. |
AppArmor introduces the @{run} variable, which is used in <abstractions/dbus-session> and <abstractions/dbus-session-strict> among other places. Thus, we must #include <tunables/run> to be able to call these abstractions. As an attempt at backwards compatibility, we #include if exists instead of #include, since there is no <tunables/run> in AppArmor 2.x. However, if exists is a relatively new feature, see e.g. https://phabricator.kde.org/D14526 (However, do note that if exists does not appear as a new feature in https://gitlab.com/apparmor/apparmor/-/wikis/Release_Notes_2.13). Therefore, this commit restricts our compatibility to relatively new (<10 months) old AppArmor releases only. As an alternative, we could detect the AppArmor version at configure time, and emit a firejail-default profile based on that.
@glitsj16 I created a pull request #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 |
AppArmor introduces the @{run} variable, which is used in <abstractions/dbus-strict> and <abstractions/dbus-session-strict> among other places. Thus, we must #include <tunables/run> to be able to call these abstractions. As an attempt at backwards compatibility, we #include if exists instead of #include, since there is no <tunables/run> in AppArmor 2.x. However, if exists is a relatively new feature, see e.g. https://phabricator.kde.org/D14526 (However, do note that if exists does not appear as a new feature in https://gitlab.com/apparmor/apparmor/-/wikis/Release_Notes_2.13). Therefore, this commit restricts our compatibility to relatively new (<10 months) old AppArmor releases only. As an alternative, we could detect the AppArmor version at configure time, and emit a firejail-default profile based on that.
Fix AppArmor 3.0 support (closes #3659)
For the records: the
If 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 As I mentioned, the conditions above are simplified. Some additional details:
|
@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? |
I should have written "at least AppArmor 3.0" and "at least The "new" rule types will be enforced starting with 3.0, and also with later versions. |
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-default
exits 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 declared
and the process exits with exit code 1. As a result, Firejail cannot use AppArmor to confine applications. When running a program in Firejail using theapparmor
option enabled, I get:The program runs normally except there is no AppArmor confinement. Running
sudo aa-status
confirms this, it only says the module is loaded.Probable cause: The
apparmor
package 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 5549f89
Should 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
The text was updated successfully, but these errors were encountered: