aboutsummaryrefslogtreecommitdiffstats
path: root/test/features
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2015-11-22 21:50:28 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2015-11-22 21:50:28 -0500
commit1cb3f220153b733e9fe86fc0b5ed6d7dbe27670b (patch)
treeec8782a9924ee48266b58e342d3c11dcc971d528 /test/features
parentfeature testing (diff)
downloadfirejail-1cb3f220153b733e9fe86fc0b5ed6d7dbe27670b.tar.gz
firejail-1cb3f220153b733e9fe86fc0b5ed6d7dbe27670b.tar.zst
firejail-1cb3f220153b733e9fe86fc0b5ed6d7dbe27670b.zip
feature testing
Diffstat (limited to 'test/features')
-rwxr-xr-xtest/features/2.1.exp99
-rwxr-xr-xtest/features/2.2.exp105
-rwxr-xr-xtest/features/2.3.exp309
-rwxr-xr-xtest/features/2.4.exp232
-rw-r--r--test/features/features.txt11
-rwxr-xr-xtest/features/test.sh12
6 files changed, 762 insertions, 6 deletions
diff --git a/test/features/2.1.exp b/test/features/2.1.exp
new file mode 100755
index 000000000..6b2b3f7f5
--- /dev/null
+++ b/test/features/2.1.exp
@@ -0,0 +1,99 @@
1#!/usr/bin/expect -f
2#
3# hostname
4#
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10#
11# N
12#
13send -- "firejail --noprofile --hostname=bingo\r"
14expect {
15 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized"
17}
18sleep 1
19
20send -- "hostname\r"
21expect {
22 timeout {puts "TESTING ERROR 1\n";exit}
23 "bingo"
24}
25after 100
26send -- "getent hosts bingo\r"
27expect {
28 timeout {puts "TESTING ERROR 1.1\n";exit}
29 "127.0.0.1"
30}
31expect {
32 timeout {puts "TESTING ERROR 1.2\n";exit}
33 "bingo"
34}
35after 100
36send -- "exit\r"
37sleep 1
38
39
40#
41# O
42#
43send -- "firejail --noprofile --hostname=bingo --overlay\r"
44expect {
45 timeout {puts "TESTING ERROR 2\n";exit}
46 "Child process initialized"
47}
48sleep 1
49
50send -- "hostname\r"
51expect {
52 timeout {puts "TESTING ERROR 3\n";exit}
53 "bingo"
54}
55after 100
56send -- "getent hosts bingo\r"
57expect {
58 timeout {puts "TESTING ERROR 3.1\n";exit}
59 "127.0.0.1"
60}
61expect {
62 timeout {puts "TESTING ERROR 3.2\n";exit}
63 "bingo"
64}
65after 100
66send -- "exit\r"
67sleep 1
68
69#
70# C
71#
72send -- "firejail --noprofile --hostname=bingo --chroot=/tmp/chroot\r"
73expect {
74 timeout {puts "TESTING ERROR 4\n";exit}
75 "Child process initialized"
76}
77sleep 1
78
79send -- "hostname\r"
80expect {
81 timeout {puts "TESTING ERROR 5\n";exit}
82 "bingo"
83}
84after 100
85send -- "getent hosts bingo\r"
86expect {
87 timeout {puts "TESTING ERROR 5.1\n";exit}
88 "127.0.0.1"
89}
90expect {
91 timeout {puts "TESTING ERROR 5.2\n";exit}
92 "bingo"
93}
94after 100
95send -- "exit\r"
96sleep 1
97
98
99puts "\nall done\n"
diff --git a/test/features/2.2.exp b/test/features/2.2.exp
new file mode 100755
index 000000000..7dc1e6a7d
--- /dev/null
+++ b/test/features/2.2.exp
@@ -0,0 +1,105 @@
1#!/usr/bin/expect -f
2#
3# DNS
4#
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10#
11# N
12#
13send -- "firejail --noprofile --dns=4.2.2.1\r"
14expect {
15 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized"
17}
18sleep 1
19
20send -- "dig google.com\r"
21expect {
22 timeout {puts "TESTING ERROR 1\n";exit}
23 "ANSWER SECTION"
24}
25expect {
26 timeout {puts "TESTING ERROR 1.1\n";exit}
27 "google.com"
28}
29expect {
30 timeout {puts "TESTING ERROR 1.2\n";exit}
31 "google.com"
32}
33expect {
34 timeout {puts "TESTING ERROR 1.3\n";exit}
35 "SERVER: 4.2.2.1"
36}
37after 100
38send -- "exit\r"
39sleep 1
40
41
42#
43# O
44#
45send -- "firejail --noprofile --dns=4.2.2.1 --overlay\r"
46expect {
47 timeout {puts "TESTING ERROR 2\n";exit}
48 "Child process initialized"
49}
50sleep 1
51
52send -- "dig google.com\r"
53expect {
54 timeout {puts "TESTING ERROR 3\n";exit}
55 "ANSWER SECTION"
56}
57expect {
58 timeout {puts "TESTING ERROR 3.1\n";exit}
59 "google.com"
60}
61expect {
62 timeout {puts "TESTING ERROR 3.2\n";exit}
63 "google.com"
64}
65expect {
66 timeout {puts "TESTING ERROR 3.3\n";exit}
67 "SERVER: 4.2.2.1"
68}
69after 100
70send -- "exit\r"
71sleep 1
72
73#
74# C
75#
76send -- "firejail --noprofile --dns=4.2.2.1 --chroot=/tmp/chroot\r"
77expect {
78 timeout {puts "TESTING ERROR 4\n";exit}
79 "Child process initialized"
80}
81sleep 1
82
83send -- "dig google.com\r"
84expect {
85 timeout {puts "TESTING ERROR 5\n";exit}
86 "ANSWER SECTION"
87}
88expect {
89 timeout {puts "TESTING ERROR 5.1\n";exit}
90 "google.com"
91}
92expect {
93 timeout {puts "TESTING ERROR 5.2\n";exit}
94 "google.com"
95}
96expect {
97 timeout {puts "TESTING ERROR 5.3\n";exit}
98 "SERVER: 4.2.2.1"
99}
100after 100
101send -- "exit\r"
102sleep 1
103
104
105puts "\nall done\n"
diff --git a/test/features/2.3.exp b/test/features/2.3.exp
new file mode 100755
index 000000000..a70005781
--- /dev/null
+++ b/test/features/2.3.exp
@@ -0,0 +1,309 @@
1#!/usr/bin/expect -f
2#
3# mac-vlan
4#
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10#
11# N
12#
13send -- "firejail --noprofile --net=eth0\r"
14expect {
15 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized"
17}
18sleep 1
19
20send -- "dig google.com\r"
21expect {
22 timeout {puts "TESTING ERROR 1\n";exit}
23 "ANSWER SECTION"
24}
25expect {
26 timeout {puts "TESTING ERROR 1.1\n";exit}
27 "google.com"
28}
29expect {
30 timeout {puts "TESTING ERROR 1.2\n";exit}
31 "google.com"
32}
33expect {
34 timeout {puts "TESTING ERROR 1.3\n";exit}
35 "SERVER:"
36}
37after 100
38
39send -- "/sbin/ifconfig\r"
40expect {
41 timeout {puts "TESTING ERROR 1.4\n";exit}
42 "eth0"
43}
44expect {
45 timeout {puts "TESTING ERROR 1.5n";exit}
46 "Link"
47}
48expect {
49 timeout {puts "TESTING ERROR 1.6\n";exit}
50 "192.168.1"
51}
52expect {
53 timeout {puts "TESTING ERROR 1.7\n";exit}
54 "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1"
55}
56after 100
57
58send -- "exit\r"
59sleep 1
60
61send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244\r"
62expect {
63 timeout {puts "TESTING ERROR 0\n";exit}
64 "Child process initialized"
65}
66sleep 1
67
68send -- "dig google.com\r"
69expect {
70 timeout {puts "TESTING ERROR 1\n";exit}
71 "ANSWER SECTION"
72}
73expect {
74 timeout {puts "TESTING ERROR 1.1\n";exit}
75 "google.com"
76}
77expect {
78 timeout {puts "TESTING ERROR 1.2\n";exit}
79 "google.com"
80}
81expect {
82 timeout {puts "TESTING ERROR 1.3\n";exit}
83 "SERVER:"
84}
85after 100
86
87send -- "/sbin/ifconfig\r"
88expect {
89 timeout {puts "TESTING ERROR 1.4\n";exit}
90 "eth0"
91}
92expect {
93 timeout {puts "TESTING ERROR 1.5n";exit}
94 "Link"
95}
96expect {
97 timeout {puts "TESTING ERROR 1.6\n";exit}
98 "192.168.1.244"
99}
100expect {
101 timeout {puts "TESTING ERROR 1.7\n";exit}
102 "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1"
103}
104after 100
105
106send -- "exit\r"
107sleep 1
108
109#
110# O
111#
112send -- "firejail --noprofile --net=eth0 --overlay\r"
113expect {
114 timeout {puts "TESTING ERROR 2\n";exit}
115 "Child process initialized"
116}
117sleep 1
118
119send -- "dig google.com\r"
120expect {
121 timeout {puts "TESTING ERROR 3\n";exit}
122 "ANSWER SECTION"
123}
124expect {
125 timeout {puts "TESTING ERROR 3.1\n";exit}
126 "google.com"
127}
128expect {
129 timeout {puts "TESTING ERROR 3.2\n";exit}
130 "google.com"
131}
132expect {
133 timeout {puts "TESTING ERROR 3.3\n";exit}
134 "SERVER"
135}
136after 100
137
138send -- "/sbin/ifconfig\r"
139expect {
140 timeout {puts "TESTING ERROR 3.4\n";exit}
141 "eth0"
142}
143expect {
144 timeout {puts "TESTING ERROR 3.5\n";exit}
145 "Link"
146}
147expect {
148 timeout {puts "TESTING ERROR 3.6\n";exit}
149 "192.168.1"
150}
151expect {
152 timeout {puts "TESTING ERROR 3.7\n";exit}
153 "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1"
154}
155after 100
156
157send -- "exit\r"
158sleep 1
159
160send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --overlay\r"
161expect {
162 timeout {puts "TESTING ERROR 2\n";exit}
163 "Child process initialized"
164}
165sleep 1
166
167send -- "dig google.com\r"
168expect {
169 timeout {puts "TESTING ERROR 3\n";exit}
170 "ANSWER SECTION"
171}
172expect {
173 timeout {puts "TESTING ERROR 3.1\n";exit}
174 "google.com"
175}
176expect {
177 timeout {puts "TESTING ERROR 3.2\n";exit}
178 "google.com"
179}
180expect {
181 timeout {puts "TESTING ERROR 3.3\n";exit}
182 "SERVER"
183}
184after 100
185
186send -- "/sbin/ifconfig\r"
187expect {
188 timeout {puts "TESTING ERROR 3.4\n";exit}
189 "eth0"
190}
191expect {
192 timeout {puts "TESTING ERROR 3.5\n";exit}
193 "Link"
194}
195expect {
196 timeout {puts "TESTING ERROR 3.6\n";exit}
197 "192.168.1.244"
198}
199expect {
200 timeout {puts "TESTING ERROR 3.7\n";exit}
201 "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1"
202}
203after 100
204
205send -- "exit\r"
206sleep 1
207
208
209#
210# C
211#
212send -- "firejail --noprofile --net=eth0 --chroot=/tmp/chroot\r"
213expect {
214 timeout {puts "TESTING ERROR 4\n";exit}
215 "Child process initialized"
216}
217sleep 1
218
219send -- "dig google.com\r"
220expect {
221 timeout {puts "TESTING ERROR 5\n";exit}
222 "ANSWER SECTION"
223}
224expect {
225 timeout {puts "TESTING ERROR 5.1\n";exit}
226 "google.com"
227}
228expect {
229 timeout {puts "TESTING ERROR 5.2\n";exit}
230 "google.com"
231}
232expect {
233 timeout {puts "TESTING ERROR 5.3\n";exit}
234 "SERVER:"
235}
236after 100
237
238send -- "/sbin/ifconfig\r"
239expect {
240 timeout {puts "TESTING ERROR 5.4\n";exit}
241 "eth0"
242}
243expect {
244 timeout {puts "TESTING ERROR 5.5\n";exit}
245 "Link"
246}
247expect {
248 timeout {puts "TESTING ERROR 5.6\n";exit}
249 "192.168.1"
250}
251expect {
252 timeout {puts "TESTING ERROR 5.7\n";exit}
253 "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1"
254}
255after 100
256
257send -- "exit\r"
258sleep 1
259
260send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --chroot=/tmp/chroot\r"
261expect {
262 timeout {puts "TESTING ERROR 4\n";exit}
263 "Child process initialized"
264}
265sleep 1
266
267send -- "dig google.com\r"
268expect {
269 timeout {puts "TESTING ERROR 5\n";exit}
270 "ANSWER SECTION"
271}
272expect {
273 timeout {puts "TESTING ERROR 5.1\n";exit}
274 "google.com"
275}
276expect {
277 timeout {puts "TESTING ERROR 5.2\n";exit}
278 "google.com"
279}
280expect {
281 timeout {puts "TESTING ERROR 5.3\n";exit}
282 "SERVER:"
283}
284after 100
285
286send -- "/sbin/ifconfig\r"
287expect {
288 timeout {puts "TESTING ERROR 5.4\n";exit}
289 "eth0"
290}
291expect {
292 timeout {puts "TESTING ERROR 5.5\n";exit}
293 "Link"
294}
295expect {
296 timeout {puts "TESTING ERROR 5.6\n";exit}
297 "192.168.1.244"
298}
299expect {
300 timeout {puts "TESTING ERROR 5.7\n";exit}
301 "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1"
302}
303after 100
304
305send -- "exit\r"
306sleep 1
307
308
309puts "\nall done\n"
diff --git a/test/features/2.4.exp b/test/features/2.4.exp
new file mode 100755
index 000000000..a995322b9
--- /dev/null
+++ b/test/features/2.4.exp
@@ -0,0 +1,232 @@
1#!/usr/bin/expect -f
2#
3# bridge
4# - todo: ping test or equivalent on chroot
5#
6
7set timeout 10
8spawn $env(SHELL)
9match_max 100000
10
11#
12# N
13#
14send -- "firejail --noprofile --net=br0\r"
15expect {
16 timeout {puts "TESTING ERROR 0\n";exit}
17 "Child process initialized"
18}
19sleep 1
20
21send -- "ping -c 3 10.10.20.1\r"
22expect {
23 timeout {puts "TESTING ERROR 1\n";exit}
24 " packets transmitted, 3 received, 0% packet loss"
25}
26sleep 1
27
28
29send -- "/sbin/ifconfig\r"
30expect {
31 timeout {puts "TESTING ERROR 1.4\n";exit}
32 "eth0"
33}
34expect {
35 timeout {puts "TESTING ERROR 1.5n";exit}
36 "Link"
37}
38expect {
39 timeout {puts "TESTING ERROR 1.6\n";exit}
40 "10.10.20"
41}
42expect {
43 timeout {puts "TESTING ERROR 1.7\n";exit}
44 "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1"
45}
46after 100
47
48send -- "exit\r"
49sleep 1
50
51send -- "firejail --noprofile --net=br0 --ip=10.10.20.4\r"
52expect {
53 timeout {puts "TESTING ERROR 0\n";exit}
54 "Child process initialized"
55}
56sleep 1
57
58send -- "ping -c 3 10.10.20.1\r"
59expect {
60 timeout {puts "TESTING ERROR 1\n";exit}
61 " packets transmitted, 3 received, 0% packet loss"
62}
63sleep 1
64
65
66send -- "/sbin/ifconfig\r"
67expect {
68 timeout {puts "TESTING ERROR 1.4\n";exit}
69 "eth0"
70}
71expect {
72 timeout {puts "TESTING ERROR 1.5n";exit}
73 "Link"
74}
75expect {
76 timeout {puts "TESTING ERROR 1.6\n";exit}
77 "10.10.20.4"
78}
79expect {
80 timeout {puts "TESTING ERROR 1.7\n";exit}
81 "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1"
82}
83after 100
84
85send -- "exit\r"
86sleep 1
87
88
89#
90# O
91#
92send -- "firejail --noprofile --net=br0 --overlay\r"
93expect {
94 timeout {puts "TESTING ERROR 2\n";exit}
95 "Child process initialized"
96}
97sleep 1
98
99send -- "ping -c 3 10.10.20.1\r"
100expect {
101 timeout {puts "TESTING ERROR 3\n";exit}
102 " packets transmitted, 3 received, 0% packet loss"
103}
104sleep 1
105
106
107send -- "/sbin/ifconfig\r"
108expect {
109 timeout {puts "TESTING ERROR 3.4\n";exit}
110 "eth0"
111}
112expect {
113 timeout {puts "TESTING ERROR 3.5\n";exit}
114 "Link"
115}
116expect {
117 timeout {puts "TESTING ERROR 3.6\n";exit}
118 "10.10.20"
119}
120expect {
121 timeout {puts "TESTING ERROR 3.7\n";exit}
122 "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1"
123}
124after 100
125
126send -- "exit\r"
127sleep 1
128
129send -- "firejail --noprofile --net=br0 --ip=10.10.20.4 --overlay\r"
130expect {
131 timeout {puts "TESTING ERROR 2\n";exit}
132 "Child process initialized"
133}
134sleep 1
135
136send -- "ping -c 3 10.10.20.1\r"
137expect {
138 timeout {puts "TESTING ERROR 3\n";exit}
139 " packets transmitted, 3 received, 0% packet loss"
140}
141sleep 1
142
143
144send -- "/sbin/ifconfig\r"
145expect {
146 timeout {puts "TESTING ERROR 3.4\n";exit}
147 "eth0"
148}
149expect {
150 timeout {puts "TESTING ERROR 3.5\n";exit}
151 "Link"
152}
153expect {
154 timeout {puts "TESTING ERROR 3.6\n";exit}
155 "10.10.20.4"
156}
157expect {
158 timeout {puts "TESTING ERROR 3.7\n";exit}
159 "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1"
160}
161after 100
162
163send -- "exit\r"
164sleep 1
165
166
167
168#
169# C
170#
171send -- "firejail --noprofile --net=br0 --chroot=/tmp/chroot\r"
172expect {
173 timeout {puts "TESTING ERROR 4\n";exit}
174 "Child process initialized"
175}
176sleep 1
177
178send -- "/sbin/ifconfig\r"
179expect {
180 timeout {puts "TESTING ERROR 5.4\n";exit}
181 "eth0"
182}
183expect {
184 timeout {puts "TESTING ERROR 5.5\n";exit}
185 "Link"
186}
187expect {
188 timeout {puts "TESTING ERROR 5.6\n";exit}
189 "10.10.20"
190}
191expect {
192 timeout {puts "TESTING ERROR 5.7\n";exit}
193 "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1"
194}
195after 100
196
197send -- "exit\r"
198sleep 1
199
200send -- "firejail --noprofile --net=br0 --ip=10.10.20.4 --chroot=/tmp/chroot\r"
201expect {
202 timeout {puts "TESTING ERROR 4\n";exit}
203 "Child process initialized"
204}
205sleep 1
206
207send -- "/sbin/ifconfig\r"
208expect {
209 timeout {puts "TESTING ERROR 5.4\n";exit}
210 "eth0"
211}
212expect {
213 timeout {puts "TESTING ERROR 5.5\n";exit}
214 "Link"
215}
216expect {
217 timeout {puts "TESTING ERROR 5.6\n";exit}
218 "10.10.20.4"
219}
220expect {
221 timeout {puts "TESTING ERROR 5.7\n";exit}
222 "UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1"
223}
224after 100
225
226send -- "exit\r"
227sleep 1
228
229
230
231
232puts "\nall done\n"
diff --git a/test/features/features.txt b/test/features/features.txt
index 3342a1635..62f4d8adc 100644
--- a/test/features/features.txt
+++ b/test/features/features.txt
@@ -43,7 +43,7 @@ C - chroot filesystem
43 43
442. Networking features 442. Networking features
45 45
462.1 Hostname (use --hostname=bingo, do a ping and cat /etc/hostname) 462.1 Hostname (use --hostname=newhostname, do a ping and cat /etc/hostname)
47 - N, O, C 47 - N, O, C
48 - ping disabled for C by default seccomp filter, use "getent hosts bingo" 48 - ping disabled for C by default seccomp filter, use "getent hosts bingo"
49 49
@@ -52,15 +52,14 @@ C - chroot filesystem
52 52
532.3 mac-vlan (use --net=eth0 and --noprofile; run ifconfig and dig google.com) 532.3 mac-vlan (use --net=eth0 and --noprofile; run ifconfig and dig google.com)
54 - N, O, C 54 - N, O, C
55 - test --ip: N, O, C
55 56
562.4 bridge (use --net=br0 and --noprofile; run ifconfig, netstat -rn, ping default gw) 572.4 bridge (use --net=br0 and --noprofile; run ifconfig, netstat -rn, ping default gw)
57 - N, O, C 58 - N, O, C
58 - ping disabled for C by default seccomp filter 59 - ping disabled for C by default seccomp filter - transfer test not implemented for C
60 - test --ip: N, O, C
59 61
602.5 IP address (--noprofile --net=eth0 --ip=192.168.1.226 --net=br0 --ip=10.10.20.3, run ifconfig and netstat -rn) 622.5 Default gw (--noprofile --net=eth0 --defaultgw=192.168.1.10, run netstat -rn)
61 - N, O, C
62
632.6 Default gw (--noprofile --net=eth0 --defaultgw=192.168.1.10, run netstat -rn)
64 - N, O, C 63 - N, O, C
65 64
66 65
diff --git a/test/features/test.sh b/test/features/test.sh
index 341126a09..42b59f383 100755
--- a/test/features/test.sh
+++ b/test/features/test.sh
@@ -28,3 +28,15 @@ echo "TESTING: 1.8 disable /etc/firejail and ~/.config/firejail"
28echo "TESTING: 1.10 disable /selinux" 28echo "TESTING: 1.10 disable /selinux"
29./1.10.exp 29./1.10.exp
30 30
31
32echo "TESTING: 2.1 hostname"
33./2.1.exp
34
35echo "TESTING: 2.2 DNS"
36./2.2.exp
37
38echo "TESTING: 2.3 mac-vlan"
39./2.3.exp
40
41echo "TESTING: 2.4 bridge"
42./2.4.exp