aboutsummaryrefslogtreecommitdiffstats
path: root/test/apparmor/apparmor.sh
blob: 84076fc9659d22372029c273d4f15216560fd107 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
# This file is part of Firejail project
# Copyright (C) 2014-2023 Firejail Authors
# License GPL v2

export MALLOC_CHECK_=3
export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
export LC_ALL=C


#	sudo /usr/sbin/apparmor_parser -r /etc/apparmor.d/firejail-default


if [[ -f /sys/kernel/security/apparmor/profiles ]]; then
	# setup
	cp test-profile /tmp/.
	sudo /usr/sbin/apparmor_parser -r /tmp/test-profile
	cp /usr/bin/pwd a.out

	echo "TESTING: apparmor firemon (test/filters/apparmor.exp)"
	./apparmor.exp

	echo "TESTING: apparmor norun test (test/filters/apparmor-norun.exp)"
	./apparmor-norun.exp

	echo "TESTING: apparmor run test (test/filters/apparmor-run.exp)"
	./apparmor-run.exp

	# cleanup
	rm -f a.out
	sudo /usr/sbin/apparmor_parser -R /tmp/test-profile

else
	echo "TESTING SKIP: no apparmor support in Linux kernel (test/filters/apparmor.exp)"
fi