mirror of
https://github.com/netblue30/firejail.git
synced 2026-05-15 14:16:14 -06:00
testing --tmpfs as root and regular user
This commit is contained in:
parent
b214d080e0
commit
6b7d77c41e
4 changed files with 89 additions and 0 deletions
|
|
@ -10,6 +10,12 @@ export LC_ALL=C
|
|||
# These directories are required by some tests:
|
||||
mkdir -p ~/Desktop ~/Documents ~/Downloads ~/Music ~/Pictures ~/Videos
|
||||
|
||||
echo "TESTING: tmpfs as regular user (test/fs/tmpfs.exp)"
|
||||
./tmpfs.exp
|
||||
|
||||
echo "TESTING: tmpfs as rooot (test/fs/tmpfs-root.exp)"
|
||||
sudo ./tmpfs-root.exp
|
||||
|
||||
echo "TESTING: tab completion (test/fs/tab.exp)"
|
||||
./tab.exp
|
||||
|
||||
|
|
|
|||
46
test/fs/tmpfs-root.exp
Executable file
46
test/fs/tmpfs-root.exp
Executable file
|
|
@ -0,0 +1,46 @@
|
|||
#!/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 --tmpfs=/var\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 1\n";exit}
|
||||
-re "you are not allowed to mount a tmpfs" {puts "TESTING ERROR 2\n";exit}
|
||||
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
|
||||
}
|
||||
after 500
|
||||
|
||||
send -- "ls /var/tmp\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 3\n";exit}
|
||||
-re "cannot access"
|
||||
}
|
||||
after 100
|
||||
|
||||
send -- "exit\r"
|
||||
after 500
|
||||
|
||||
send -- "firejail --profile=./tmpfs.profile\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 4\n";exit}
|
||||
-re "you are not allowed to mount a tmpfs" {puts "TESTING ERROR 5\n";exit}
|
||||
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
|
||||
}
|
||||
after 500
|
||||
|
||||
send -- "ls /var/tmp\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 3\n";exit}
|
||||
-re "cannot access"
|
||||
}
|
||||
after 100
|
||||
|
||||
send -- "exit\r"
|
||||
after 100
|
||||
|
||||
puts "\nall done\n"
|
||||
36
test/fs/tmpfs.exp
Executable file
36
test/fs/tmpfs.exp
Executable file
|
|
@ -0,0 +1,36 @@
|
|||
#!/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 --tmpfs=/var\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 1\n";exit}
|
||||
-re "you are not allowed to mount a tmpfs"
|
||||
}
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 2\n";exit}
|
||||
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
|
||||
}
|
||||
after 500
|
||||
send -- "exit\r"
|
||||
after 500
|
||||
|
||||
send -- "firejail --profile=./tmpfs.profile\r"
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 3\n";exit}
|
||||
-re "you are not allowed to mount a tmpfs"
|
||||
}
|
||||
expect {
|
||||
timeout {puts "TESTING ERROR 4\n";exit}
|
||||
-re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
|
||||
}
|
||||
after 500
|
||||
send -- "exit\r"
|
||||
after 100
|
||||
|
||||
puts "\nall done\n"
|
||||
1
test/fs/tmpfs.profile
Normal file
1
test/fs/tmpfs.profile
Normal file
|
|
@ -0,0 +1 @@
|
|||
tmpfs /var
|
||||
Loading…
Add table
Add a link
Reference in a new issue