
===== Pre‑cleanup: remove leftover profile =====
pre‑cleanup done

===== Step1 compile C elf =====
compile done: /home/fnzhang/Project/examples/AppArmor/demo1/demo_app

===== Step2 validate profile syntax =====
profile.elf syntax OK
profile.script syntax OK

===== Step3 install profile =====
profile installed & enforce enabled

===== Step4 run elf demo_app =====
[probe2] open /etc/shadow: Permission denied
[probe3] open /tmp/demo_forbidden.log: Permission denied
[probe1] write /tmp/demo_elf.log: ALLOWED
-- verify /tmp/demo_elf.log exists (allowed write):
-rw-r--r-- 1 root root 13 Sep  3 09:48 /tmp/demo_elf.log

===== Step5 run shell script =====
[probe1] shell try write /tmp/demo_sh.log
[probe1] write /tmp/demo_sh.log: ALLOWED
[probe2] shell try read /etc/shadow
/home/fnzhang/Project/examples/AppArmor/demo1/demo_shell.sh: line 8: /usr/bin/cat: Permission denied
[probe3] shell try write /tmp/demo_forbidden.log
/home/fnzhang/Project/examples/AppArmor/demo1/demo_shell.sh: line 12: /tmp/demo_forbidden.log: Permission denied
-- verify /tmp/demo_sh.log exists (allowed write):
-rw-r--r-- 1 root root 15 Sep  3 09:48 /tmp/demo_sh.log

===== Step6 aa-status snapshot =====
  /home/fnzhang/Project/examples/AppArmor/demo1/demo_app: enforce
  /home/fnzhang/Project/examples/AppArmor/demo1/demo_shell.sh: enforce

===== Step7 AppArmor DENIED logs =====
[397463.022144] audit: type=1400 audit(1788400106.547:1352): apparmor="DENIED" operation="mknod" class="file" profile="/home/fnzhang/Project/examples/AppArmor/demo1/demo_app" name="/tmp/demo_forbidden.log" pid=382024 comm="demo_app" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
[397463.026257] audit: type=1400 audit(1788400106.552:1353): apparmor="DENIED" operation="exec" class="file" profile="/home/fnzhang/Project/examples/AppArmor/demo1/demo_shell.sh" name="/usr/bin/cat" pid=382031 comm="demo_shell.sh" requested_mask="x" denied_mask="x" fsuid=0 ouid=0
[397463.026325] audit: type=1400 audit(1788400106.552:1354): apparmor="DENIED" operation="open" class="file" profile="/home/fnzhang/Project/examples/AppArmor/demo1/demo_shell.sh" name="/etc/locale.alias" pid=382031 comm="demo_shell.sh" requested_mask="r" denied_mask="r" fsuid=0 ouid=0
[397463.026690] audit: type=1400 audit(1788400106.553:1355): apparmor="DENIED" operation="mknod" class="file" profile="/home/fnzhang/Project/examples/AppArmor/demo1/demo_shell.sh" name="/tmp/demo_forbidden.log" pid=382029 comm="demo_shell.sh" requested_mask="c" denied_mask="c" fsuid=0 ouid=0
[397463.026706] audit: type=1400 audit(1788400106.553:1356): apparmor="DENIED" operation="open" class="file" profile="/home/fnzhang/Project/examples/AppArmor/demo1/demo_shell.sh" name="/etc/locale.alias" pid=382029 comm="demo_shell.sh" requested_mask="r" denied_mask="r" fsuid=0 ouid=0

===== Step8 clean resources =====

========================================
Demo finished, report file: /home/fnzhang/Project/examples/AppArmor/demo1/report.txt
