firejail/test/filters/seccomp-empty.exp
2026-01-19 20:34:27 -05:00

164 lines
3.2 KiB
Text
Executable file

#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2026 Firejail Authors
# License GPL v2
set timeout 10
spawn $env(SHELL)
match_max 100000
send -- "firejail --debug --seccomp=chmod,fchmod,fchmodat --private\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
"seccomp entries in /run/firejail/mnt/seccomp"
}
expect {
timeout {puts "TESTING ERROR 0.0\n";exit}
"ld data.architecture"
}
expect {
timeout {puts "TESTING ERROR 0.1\n";exit}
"mount"
}
expect {
timeout {puts "TESTING ERROR 0.2\n";exit}
"ptrace"
}
expect {
timeout {puts "TESTING ERROR 0.3\n";exit}
"chmod"
}
expect {
timeout {puts "TESTING ERROR 0.4\n";exit}
"fchmod"
}
expect {
timeout {puts "TESTING ERROR 0.5\n";exit}
"fchmodat"
}
expect {
timeout {puts "TESTING ERROR 0.6\n";exit}
"ret ALLOW"
}
expect {
timeout {puts "TESTING ERROR 0.7\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
sleep 2
send -- "exit\r"
sleep 3
puts "\n"
send -- "firejail --debug --seccomp.drop=chmod,fchmod,fchmodat --private\r"
expect {
timeout {puts "TESTING ERROR 1\n";exit}
"seccomp entries in /run/firejail/mnt/seccomp"
}
expect {
timeout {puts "TESTING ERROR 1.0\n";exit}
"ld data.architecture"
}
expect {
timeout {puts "TESTING ERROR 1.1\n";exit}
"mount" {puts "TESTING ERROR 1.2\n";exit}
"ptrace" {puts "TESTING ERROR 1.3\n";exit}
"chmod"
}
expect {
timeout {puts "TESTING ERROR 1.4\n";exit}
"fchmod"
}
expect {
timeout {puts "TESTING ERROR 1.5\n";exit}
"fchmodat"
}
expect {
timeout {puts "TESTING ERROR 1.6\n";exit}
"ret ALLOW"
}
expect {
timeout {puts "TESTING ERROR 1.7\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
sleep 2
send -- "exit\r"
puts "\n"
sleep 2
send -- "firejail --debug --profile=./seccomp.profile --private\r"
expect {
timeout {puts "TESTING ERROR 2\n";exit}
"seccomp entries in /run/firejail/mnt/seccomp"
}
expect {
timeout {puts "TESTING ERROR 2.0\n";exit}
"ld data.architecture"
}
expect {
timeout {puts "TESTING ERROR 2.1\n";exit}
"mount"
}
expect {
timeout {puts "TESTING ERROR 2.2\n";exit}
"ptrace"
}
expect {
timeout {puts "TESTING ERROR 2.3\n";exit}
"chmod"
}
expect {
timeout {puts "TESTING ERROR 2.4\n";exit}
"fchmod"
}
expect {
timeout {puts "TESTING ERROR 2.5\n";exit}
"fchmodat"
}
expect {
timeout {puts "TESTING ERROR 2.6\n";exit}
"ret ALLOW"
}
expect {
timeout {puts "TESTING ERROR 2.7\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
sleep 2
send -- "exit\r"
sleep 3
puts "\n"
send -- "firejail --debug --profile=./seccomp-empty.profile --private\r"
expect {
timeout {puts "TESTING ERROR 3\n";exit}
"seccomp entries in /run/firejail/mnt/seccomp"
}
expect {
timeout {puts "TESTING ERROR 3.0\n";exit}
"ld data.architecture"
}
expect {
timeout {puts "TESTING ERROR 3.1\n";exit}
"mount" {puts "TESTING ERROR 3.2\n";exit}
"ptrace" {puts "TESTING ERROR 3.3\n";exit}
"chmod"
}
expect {
timeout {puts "TESTING ERROR 3.4\n";exit}
"fchmod"
}
expect {
timeout {puts "TESTING ERROR 3.5\n";exit}
"fchmodat"
}
expect {
timeout {puts "TESTING ERROR 3.6\n";exit}
"ret ALLOW"
}
expect {
timeout {puts "TESTING ERROR 3.7\n";exit}
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
}
sleep 2
send -- "exit\r"
after 100
puts "all done\n"