firejail/test/root/private.exp
2019-02-07 14:58:35 +01:00

111 lines
2.1 KiB
Text
Executable file

#!/usr/bin/expect -f
# This file is part of Firejail project
# Copyright (C) 2014-2019 Firejail Authors
# License GPL v2
set timeout 10
spawn $env(SHELL)
match_max 100000
send -- "firejail --private\r"
expect {
timeout {puts "TESTING ERROR 0\n";exit}
"Child process initialized"
}
sleep 2
send -- "ls -l /home\r"
expect {
timeout {puts "TESTING ERROR 1\n";exit}
"total 0"
}
after 100
send -- "ls -l /root\r"
expect {
timeout {puts "TESTING ERROR 2\n";exit}
"total 0"
}
after 100
send -- "exit\r"
sleep 1
send -- "touch /opt/firejail-test-file\r"
after 100
send -- "mkdir /opt/firejail-test-dir\r"
after 100
send -- "touch /opt/firejail-test-dir/firejail-test-file\r"
after 100
send -- "firejail --private-opt=firejail-test-file,firejail-test-dir --debug\r"
expect {
timeout {puts "TESTING ERROR 3\n";exit}
"Child process initialized"
}
sleep 1
send -- "find /opt | wc -l\r"
expect {
timeout {puts "TESTING ERROR 4\n";exit}
"4"
}
after 100
send -- "exit\r"
sleep 1
send -- "firejail --whitelist=/opt/firejail-test-file --whitelist=/opt/firejail-test-dir --debug\r"
expect {
timeout {puts "TESTING ERROR 3.1\n";exit}
"Child process initialized"
}
sleep 1
send -- "find /opt | wc -l\r"
expect {
timeout {puts "TESTING ERROR 4.1\n";exit}
"4"
}
after 100
send -- "exit\r"
sleep 1
send -- "touch /srv/firejail-test-file\r"
after 100
send -- "mkdir /srv/firejail-test-dir\r"
after 100
send -- "touch /srv/firejail-test-dir/firejail-test-file\r"
after 100
send -- "firejail --private-srv=firejail-test-file,firejail-test-dir --debug\r"
expect {
timeout {puts "TESTING ERROR 5\n";exit}
"Child process initialized"
}
sleep 1
send -- "find /srv | wc -l\r"
expect {
timeout {puts "TESTING ERROR 6\n";exit}
"4"
}
after 100
send -- "exit\r"
sleep 1
send -- "firejail --whitelist=/srv/firejail-test-file --whitelist=/srv/firejail-test-dir --debug\r"
expect {
timeout {puts "TESTING ERROR 5.1\n";exit}
"Child process initialized"
}
sleep 1
send -- "find /srv | wc -l\r"
expect {
timeout {puts "TESTING ERROR 6.1\n";exit}
"4"
}
after 100
send -- "exit\r"
sleep 1
puts "\nall done\n"