diff options
Diffstat (limited to 'test/network/net_none.exp')
-rwxr-xr-x | test/network/net_none.exp | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/test/network/net_none.exp b/test/network/net_none.exp new file mode 100755 index 000000000..1761eb423 --- /dev/null +++ b/test/network/net_none.exp | |||
@@ -0,0 +1,72 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2016 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | # options | ||
11 | send -- "firejail --net=none\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 0\n";exit} | ||
14 | "eth0" {puts "TESTING ERROR 0.1\n";exit} | ||
15 | "Child process initialized" | ||
16 | } | ||
17 | sleep 1 | ||
18 | |||
19 | # test default gw | ||
20 | send -- "bash\r" | ||
21 | sleep 1 | ||
22 | send -- "netstat -rn; echo done\r" | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 1\n";exit} | ||
25 | "0.0.0.0" {puts "TESTING ERROR 1.1\n";exit} | ||
26 | "done" | ||
27 | } | ||
28 | sleep 1 | ||
29 | |||
30 | # check again devices | ||
31 | send -- "cat /proc/1/net/dev;echo done\r" | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 2\n";exit} | ||
34 | "eth0" {puts "TESTING ERROR 2.1\n";exit} | ||
35 | "done" | ||
36 | } | ||
37 | send -- "exit\r" | ||
38 | sleep 1 | ||
39 | send -- "exit\r" | ||
40 | sleep 1 | ||
41 | |||
42 | # profile | ||
43 | send -- "firejail --profile=net_none.profile\r" | ||
44 | expect { | ||
45 | timeout {puts "TESTING ERROR 3\n";exit} | ||
46 | "eth0" {puts "TESTING ERROR 3.1\n";exit} | ||
47 | "Child process initialized" | ||
48 | } | ||
49 | sleep 1 | ||
50 | |||
51 | # test default gw | ||
52 | send -- "bash\r" | ||
53 | sleep 1 | ||
54 | send -- "netstat -rn; echo done\r" | ||
55 | expect { | ||
56 | timeout {puts "TESTING ERROR 4\n";exit} | ||
57 | "0.0.0.0" {puts "TESTING ERROR 4.1\n";exit} | ||
58 | "done" | ||
59 | } | ||
60 | sleep 1 | ||
61 | |||
62 | # check again devices | ||
63 | send -- "cat /proc/1/net/dev;echo done\r" | ||
64 | expect { | ||
65 | timeout {puts "TESTING ERROR 5\n";exit} | ||
66 | "eth0" {puts "TESTING ERROR 5.1\n";exit} | ||
67 | "done" | ||
68 | } | ||
69 | send -- "exit\r" | ||
70 | after 100 | ||
71 | |||
72 | puts "\nall done\n" | ||