aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2015-09-22 08:18:56 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2015-09-22 08:18:56 -0400
commit56bf7c836e8cbc74b36ded08429b2112096f6d8e (patch)
tree8fbcfceb69e8b51556802dcb08a2e408b4942f59 /test
parentfixed macvlan problem (diff)
downloadfirejail-56bf7c836e8cbc74b36ded08429b2112096f6d8e.tar.gz
firejail-56bf7c836e8cbc74b36ded08429b2112096f6d8e.tar.zst
firejail-56bf7c836e8cbc74b36ded08429b2112096f6d8e.zip
added --interface option
Diffstat (limited to 'test')
-rwxr-xr-xtest/net_interface.exp88
-rwxr-xr-xtest/test-root.sh3
2 files changed, 91 insertions, 0 deletions
diff --git a/test/net_interface.exp b/test/net_interface.exp
new file mode 100755
index 000000000..4b55187ff
--- /dev/null
+++ b/test/net_interface.exp
@@ -0,0 +1,88 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "ip link add link eth0 name eth0.100 type vlan id 100\r"
8sleep 1
9send -- "ip link add link eth0 name eth0.101 type vlan id 101\r"
10sleep 1
11send -- "ip link add link eth0 name eth0.102 type vlan id 102\r"
12sleep 1
13send -- "ip link add link eth0 name eth0.103 type vlan id 103\r"
14sleep 1
15send -- "ip link add link eth0 name eth0.104 type vlan id 104\r"
16sleep 1
17puts "\n"
18
19send -- "/sbin/ifconfig eth0.100 10.200.0.1/24\r"
20sleep 1
21send -- "/sbin/ifconfig eth0.101 10.200.1.1/24\r"
22sleep 1
23send -- "/sbin/ifconfig eth0.102 10.200.2.1/24\r"
24sleep 1
25send -- "/sbin/ifconfig eth0.103 10.200.3.1/24\r"
26sleep 1
27send -- "/sbin/ifconfig eth0.104 10.200.4.1/24\r"
28sleep 1
29puts "\n"
30
31
32
33send -- "firejail --noprofile --interface=eth0.100 --interface=eth0.101 --interface=eth0.102 --interface=eth0.103 --interface=eth0.104\r"
34expect {
35 timeout {puts "TESTING ERROR 0\n";exit}
36 "maximum 4 interfaces are allowed"
37}
38sleep 1
39
40send -- "firejail --noprofile --interface=eth0.100 --interface=eth0.101 --interface=eth0.102 --interface=eth0.103\r"
41expect {
42 timeout {puts "TESTING ERROR 1\n";exit}
43 "eth0.100"
44}
45expect {
46 timeout {puts "TESTING ERROR 1.1\n";exit}
47 "UP"
48}
49expect {
50 timeout {puts "TESTING ERROR 2\n";exit}
51 "eth0.101"
52}
53expect {
54 timeout {puts "TESTING ERROR 2.2\n";exit}
55 "UP"
56}
57expect {
58 timeout {puts "TESTING ERROR 3\n";exit}
59 "eth0.102"
60}
61expect {
62 timeout {puts "TESTING ERROR 3.1\n";exit}
63 "UP"
64}
65expect {
66 timeout {puts "TESTING ERROR 4\n";exit}
67 "eth0.103"
68}
69expect {
70 timeout {puts "TESTING ERROR 4.1\n";exit}
71 "UP"
72}
73sleep 1
74send -- "exit\r"
75sleep 1
76
77send -- "firejail --noprofile --interface=eth0.104\r"
78expect {
79 timeout {puts "TESTING ERROR 5\n";exit}
80 "eth0.104"
81}
82expect {
83 timeout {puts "TESTING ERROR 5.1\n";exit}
84 "UP"
85}
86
87puts "all done\n"
88
diff --git a/test/test-root.sh b/test/test-root.sh
index cd607b75b..fcfe32a58 100755
--- a/test/test-root.sh
+++ b/test/test-root.sh
@@ -2,6 +2,9 @@
2 2
3./chk_config.exp 3./chk_config.exp
4 4
5echo "TESTING: network interfaces"
6./net_interface.exp
7
5echo "TESTING: servers rsyslogd, sshd, nginx" 8echo "TESTING: servers rsyslogd, sshd, nginx"
6./servers.exp 9./servers.exp
7 10