aboutsummaryrefslogtreecommitdiffstats
path: root/test/noroot.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/noroot.exp')
-rwxr-xr-xtest/noroot.exp124
1 files changed, 124 insertions, 0 deletions
diff --git a/test/noroot.exp b/test/noroot.exp
new file mode 100755
index 000000000..78991d4a9
--- /dev/null
+++ b/test/noroot.exp
@@ -0,0 +1,124 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --debug --noroot --caps.drop=all --seccomp --cpu=0,1 --name=noroot-sandbox\r"
8expect {
9 timeout {puts "TESTING ERROR 0.1\n";exit}
10 "Child process initialized"
11}
12sleep 1
13
14send -- "cat /proc/self/status\r"
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "CapBnd:"
18}
19expect {
20 timeout {puts "TESTING ERROR 1.1\n";exit}
21 "0000000000000000"
22}
23
24send -- "cat /proc/self/status\r"
25expect {
26 timeout {puts "TESTING ERROR 2\n";exit}
27 "Cpus_allowed:"
28}
29expect {
30 timeout {puts "TESTING ERROR 2.1\n";exit}
31 "3"
32}
33expect {
34 timeout {puts "TESTING ERROR 2.2\n";exit}
35 "Cpus_allowed_list:"
36}
37puts "\n"
38
39send -- "cat /proc/self/status\r"
40expect {
41 timeout {puts "TESTING ERROR 2\n";exit}
42 "Seccomp:"
43}
44expect {
45 timeout {puts "TESTING ERROR 2.1\n";exit}
46 "2"
47}
48expect {
49 timeout {puts "TESTING ERROR 2.2\n";exit}
50 "Cpus_allowed:"
51}
52puts "\n"
53
54send -- "cat /etc/hostname\r"
55expect {
56 timeout {puts "TESTING ERROR 3\n";exit}
57 "noroot-sandbox"
58}
59puts "\n"
60
61send -- "ping 0\r"
62expect {
63 timeout {puts "TESTING ERROR 4\n";exit}
64 "Operation not permitted"
65}
66puts "\n"
67
68send -- "whoami\r"
69expect {
70 timeout {puts "TESTING ERROR 55\\n";exit}
71 "netblue"
72}
73puts "\n"
74send -- "exit\r"
75sleep 2
76
77
78send -- "firejail --noroot\r"
79expect {
80 timeout {puts "TESTING ERROR 6\n";exit}
81 "Child process initialized"
82}
83sleep 1
84send -- "whoami\r"
85expect {
86 timeout {puts "TESTING ERROR 7\n";exit}
87 "netblue"
88}
89send -- "sudo -s\r"
90expect {
91 timeout {puts "TESTING ERROR 8\n";exit}
92 "effective uid is not 0, is sudo installed setuid root?" { puts "OK\n";}
93 "sudo must be owned by uid 0 and have the setuid bit set" { puts "OK\n";}
94}
95puts "\n"
96send -- "exit\r"
97sleep 2
98
99send -- "firejail --name=test --noroot\r"
100expect {
101 timeout {puts "TESTING ERROR 9\n";exit}
102 "Child process initialized"
103}
104sleep 1
105
106spawn $env(SHELL)
107send -- "firejail --debug --join=test\r"
108expect {
109 timeout {puts "TESTING ERROR 9\n";exit}
110 "User namespace detected"
111}
112expect {
113 timeout {puts "TESTING ERROR 9\n";exit}
114 "Joining user namespace"
115}
116sleep 1
117
118send -- "sudo -s\r"
119expect {
120 timeout {puts "TESTING ERROR 8\n";exit}
121 "effective uid is not 0, is sudo installed setuid root?" { puts "OK\n";}
122 "sudo must be owned by uid 0 and have the setuid bit set" { puts "OK\n";}
123}
124puts "\n"