apparmor-functional-demo automated
medium
- Image Types:
- basesdk-amd64 / fixedfunction-armhf / fixedfunction-arm64 / fixedfunction-amd64 / hmi-armhf / hmi-amd64 / sdk-amd64
- Image Deployment:
- APT
- Type:
- functional
Description
Show some main AppArmor functionalities, like transitions, net access or resource permissions, under the form of tests.
Pre Conditions
- Ensure Rootfs is remounted as read/write.
- Install dependencies
- Restart the system to restore the filesystem state to read-only before running the test.
- Clone the tests repository from another computer (Note that the branch being tested may change depending on the release, please make sure to clone the correct branch for the release in question):
- Copy the test directory apertis-tests to the target device:
- Log into the target device:
$ sudo mount -o remount,rw /
$ sudo apt install bash apparmor-demo busybox apertis-tests-apparmor-report
$ sudo reboot
$ git clone --branch apertis/v2023pre https://gitlab.apertis.org/pkg/apertis-tests.git
$ DUT_IP=<device-ip>
$ scp -r apertis-tests user@$DUT_IP:
$ ssh user@$DUT_IP
Execution Steps
- Enter test directory:
- Execute the following commands:
$ cd apertis-tests
$ common/run-test-in-systemd --name=apparmor-functional-demo --timeout=90 /usr/lib/apparmor-demo/lava_run_tests
$ sudo journalctl -b -t audit -o cat | /usr/bin/aa_log_extract_tokens.sh ALLOWED DENIED
Expected
The /usr/lib/apparmor-demo/lava_run_tests script should return 0. The return value indicates the number of tests which failed. A similar output will be shown:
/usr/lib/apparmor-demo/exec.sh: PASSED - /tmp/apparmor-demo/sdtest.6406-11853-I7WUoO
/usr/lib/apparmor-demo/exec_env.sh: FAILED - /tmp/apparmor-demo/sdtest.6704-7180-0VTgAJ
Notes
- Some of the tests included are taken from AppArmor upstream, some are locally developed.