diff options
Diffstat (limited to 'test/apparmor/apparmor.sh')
-rwxr-xr-x | test/apparmor/apparmor.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/test/apparmor/apparmor.sh b/test/apparmor/apparmor.sh new file mode 100755 index 000000000..84076fc96 --- /dev/null +++ b/test/apparmor/apparmor.sh | |||
@@ -0,0 +1,36 @@ | |||
1 | #!/bin/bash | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2023 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | export MALLOC_CHECK_=3 | ||
7 | export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) | ||
8 | export LC_ALL=C | ||
9 | |||
10 | |||
11 | # sudo /usr/sbin/apparmor_parser -r /etc/apparmor.d/firejail-default | ||
12 | |||
13 | |||
14 | if [[ -f /sys/kernel/security/apparmor/profiles ]]; then | ||
15 | # setup | ||
16 | cp test-profile /tmp/. | ||
17 | sudo /usr/sbin/apparmor_parser -r /tmp/test-profile | ||
18 | cp /usr/bin/pwd a.out | ||
19 | |||
20 | echo "TESTING: apparmor firemon (test/filters/apparmor.exp)" | ||
21 | ./apparmor.exp | ||
22 | |||
23 | echo "TESTING: apparmor norun test (test/filters/apparmor-norun.exp)" | ||
24 | ./apparmor-norun.exp | ||
25 | |||
26 | echo "TESTING: apparmor run test (test/filters/apparmor-run.exp)" | ||
27 | ./apparmor-run.exp | ||
28 | |||
29 | # cleanup | ||
30 | rm -f a.out | ||
31 | sudo /usr/sbin/apparmor_parser -R /tmp/test-profile | ||
32 | |||
33 | else | ||
34 | echo "TESTING SKIP: no apparmor support in Linux kernel (test/filters/apparmor.exp)" | ||
35 | fi | ||
36 | |||