aboutsummaryrefslogtreecommitdiffstats
path: root/test/network/net_none.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/network/net_none.exp')
-rwxr-xr-xtest/network/net_none.exp72
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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10# options
11send -- "firejail --net=none\r"
12expect {
13 timeout {puts "TESTING ERROR 0\n";exit}
14 "eth0" {puts "TESTING ERROR 0.1\n";exit}
15 "Child process initialized"
16}
17sleep 1
18
19# test default gw
20send -- "bash\r"
21sleep 1
22send -- "netstat -rn; echo done\r"
23expect {
24 timeout {puts "TESTING ERROR 1\n";exit}
25 "0.0.0.0" {puts "TESTING ERROR 1.1\n";exit}
26 "done"
27}
28sleep 1
29
30# check again devices
31send -- "cat /proc/1/net/dev;echo done\r"
32expect {
33 timeout {puts "TESTING ERROR 2\n";exit}
34 "eth0" {puts "TESTING ERROR 2.1\n";exit}
35 "done"
36}
37send -- "exit\r"
38sleep 1
39send -- "exit\r"
40sleep 1
41
42# profile
43send -- "firejail --profile=net_none.profile\r"
44expect {
45 timeout {puts "TESTING ERROR 3\n";exit}
46 "eth0" {puts "TESTING ERROR 3.1\n";exit}
47 "Child process initialized"
48}
49sleep 1
50
51# test default gw
52send -- "bash\r"
53sleep 1
54send -- "netstat -rn; echo done\r"
55expect {
56 timeout {puts "TESTING ERROR 4\n";exit}
57 "0.0.0.0" {puts "TESTING ERROR 4.1\n";exit}
58 "done"
59}
60sleep 1
61
62# check again devices
63send -- "cat /proc/1/net/dev;echo done\r"
64expect {
65 timeout {puts "TESTING ERROR 5\n";exit}
66 "eth0" {puts "TESTING ERROR 5.1\n";exit}
67 "done"
68}
69send -- "exit\r"
70after 100
71
72puts "\nall done\n"