-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add option to enforce AppArmor profiles in tests
Introduce variable `USE_APPARMOR` to allow enforcing AppArmor profiles inside tests. Use the new variable inside nginx install variant of the test. Reference: https://progress.opensuse.org/issues/155413
- Loading branch information
Showing
3 changed files
with
19 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
use Mojo::Base 'openQAcoretest', -signatures; | ||
use testapi; | ||
use utils qw(install_packages); | ||
|
||
sub run { | ||
# Make sure AppArmor is installed and enabled | ||
install_packages('-t pattern apparmor'); | ||
assert_script_run('systemctl enable --now apparmor'); | ||
assert_script_run('aa-enabled'); | ||
# Reload AppArmor to enforce newly installed profiles | ||
assert_script_run('systemctl reload apparmor'); | ||
# Restart running services to apply loaded profiles | ||
assert_script_run('systemctl try-restart openqa-*'); | ||
assert_script_run('aa-status --filter.profiles="usr.share.openqa.*"'); | ||
} | ||
|
||
1; |