roddhjav / apparmor.d

Full set of AppArmor profiles (~ 1500 profiles)
https://apparmor.pujol.io
GNU General Public License v2.0
470 stars 47 forks source link

Profile Tests #570

Open roddhjav opened 1 month ago

roddhjav commented 1 month ago

This issue aims to present and discuss the various tests applied to the profiles as well as their current stage of deployment.

Current Status

[!CAUTION] Do not run the integration tests (make bats) outside a system dedicated for this purpose. The tests can be destructive and wipe your data.

Plan

For more complex software suite, more integration tests need to be done. The plan is to run existing integration suite from these very software in an environment with apparmor.d profiles.

nobody43 commented 1 month ago

I have the following draft: https://gist.github.com/nobody43/7a21f518dbebdd48a3c2e7af7934a63b Is it needed? Tested on Ubuntu 24.04.

Q: Why python? A: libapparmor could be utilized

Q: Why reimplement? A: libapparmor is too tightly coupled with actually loading the profiles

Q: Is it on par with apparmor_parser? A: No, even libapparmor does not claim 1:1 compatibility

Q: What's implemented? A: grep reason profile_tests.py

Q: What's not implemented? A: Mutually exclusive abstractions, dangerous file access, missing owner, tunables expansion, file rules to abstraction comparison, etc

Q: Is it reliable? A: Not tested thoroughly yet

nobody43 commented 1 month ago

@roddhjav Should I work on my version further, or it's not the approach you want?

roddhjav commented 1 month ago

@nobody43 Please continue working on your linter. This is 100% the way to go.

make check is a fast and dirty check to catch basic issues (it is highly inspired from what apparmor has). Your linter is the proper solution.

My current priority is to work on profile testing (that goes along with the sub packages #464).

Therefore your work on the linter perfectly goes along with it. You are more than welcome to integrate it with this project.

nobody43 commented 1 month ago

Understood, I'll come up with something solid after 2 weeks.