aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-11-09 19:17:06 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-11-09 19:17:06 -0500
commit35004af7d8f6ff19908fb89e25e532113afa26f4 (patch)
tree991c7c279e0629e3de36a1d9453ab2513a38be1d /test
parentbugfix: crashing vlc when pressing Ctrl-O (diff)
downloadfirejail-35004af7d8f6ff19908fb89e25e532113afa26f4.tar.gz
firejail-35004af7d8f6ff19908fb89e25e532113afa26f4.tar.zst
firejail-35004af7d8f6ff19908fb89e25e532113afa26f4.zip
testing
Diffstat (limited to 'test')
-rwxr-xr-xtest/network/4bridges_arp.exp16
-rwxr-xr-xtest/network/4bridges_ip.exp16
-rw-r--r--test/network/README1
-rwxr-xr-xtest/network/bandwidth.exp2
-rwxr-xr-xtest/network/firemon-arp.exp (renamed from test/firemon-arp.exp)26
-rwxr-xr-xtest/network/firemon-route.exp (renamed from test/firemon-route.exp)30
-rwxr-xr-xtest/network/interface.exp2
-rwxr-xr-xtest/network/net_ip.exp4
-rwxr-xr-xtest/network/net_local.exp4
-rwxr-xr-xtest/network/net_netfilter.exp6
-rwxr-xr-xtest/network/net_profile.exp2
-rwxr-xr-xtest/network/net_veth.exp130
-rwxr-xr-xtest/network/network.sh11
13 files changed, 211 insertions, 39 deletions
diff --git a/test/network/4bridges_arp.exp b/test/network/4bridges_arp.exp
index 4ffa715cc..6383aad5e 100755
--- a/test/network/4bridges_arp.exp
+++ b/test/network/4bridges_arp.exp
@@ -29,9 +29,9 @@ expect {
29 timeout {puts "TESTING ERROR 0.4\n";exit} 29 timeout {puts "TESTING ERROR 0.4\n";exit}
30 "Child process initialized" 30 "Child process initialized"
31} 31}
32sleep 2 32sleep 1
33send -- "exit\r" 33send -- "exit\r"
34sleep 2 34sleep 1
35 35
36# check eth1 36# check eth1
37send -- "firejail --net=br0 --net=br1 --net=br2 --net=br3\r" 37send -- "firejail --net=br0 --net=br1 --net=br2 --net=br3\r"
@@ -55,9 +55,9 @@ expect {
55 timeout {puts "TESTING ERROR 1.4\n";exit} 55 timeout {puts "TESTING ERROR 1.4\n";exit}
56 "Child process initialized" 56 "Child process initialized"
57} 57}
58sleep 2 58sleep 1
59send -- "exit\r" 59send -- "exit\r"
60sleep 2 60sleep 1
61 61
62 62
63# check eth2 63# check eth2
@@ -82,9 +82,9 @@ expect {
82 timeout {puts "TESTING ERROR 2.4\n";exit} 82 timeout {puts "TESTING ERROR 2.4\n";exit}
83 "Child process initialized" 83 "Child process initialized"
84} 84}
85sleep 2 85sleep 1
86send -- "exit\r" 86send -- "exit\r"
87sleep 2 87sleep 1
88 88
89 89
90 90
@@ -110,9 +110,9 @@ expect {
110 timeout {puts "TESTING ERROR 4\n";exit} 110 timeout {puts "TESTING ERROR 4\n";exit}
111 "Child process initialized" 111 "Child process initialized"
112} 112}
113sleep 2 113sleep 1
114send -- "exit\r" 114send -- "exit\r"
115sleep 2 115sleep 1
116 116
117 117
118 118
diff --git a/test/network/4bridges_ip.exp b/test/network/4bridges_ip.exp
index 3cfd71be0..e762ac285 100755
--- a/test/network/4bridges_ip.exp
+++ b/test/network/4bridges_ip.exp
@@ -29,9 +29,9 @@ expect {
29 timeout {puts "TESTING ERROR 0.4\n";exit} 29 timeout {puts "TESTING ERROR 0.4\n";exit}
30 "Child process initialized" 30 "Child process initialized"
31} 31}
32sleep 2 32sleep 1
33send -- "exit\r" 33send -- "exit\r"
34sleep 2 34sleep 1
35 35
36# check eth1 36# check eth1
37send -- "firejail --net=br0 --net=br1 --ip=10.10.30.50 --net=br2 --ip=10.10.40.100 --net=br3\r" 37send -- "firejail --net=br0 --net=br1 --ip=10.10.30.50 --net=br2 --ip=10.10.40.100 --net=br3\r"
@@ -55,9 +55,9 @@ expect {
55 timeout {puts "TESTING ERROR 1.4\n";exit} 55 timeout {puts "TESTING ERROR 1.4\n";exit}
56 "Child process initialized" 56 "Child process initialized"
57} 57}
58sleep 2 58sleep 1
59send -- "exit\r" 59send -- "exit\r"
60sleep 2 60sleep 1
61 61
62 62
63# check eth2 63# check eth2
@@ -82,9 +82,9 @@ expect {
82 timeout {puts "TESTING ERROR 2.4\n";exit} 82 timeout {puts "TESTING ERROR 2.4\n";exit}
83 "Child process initialized" 83 "Child process initialized"
84} 84}
85sleep 2 85sleep 1
86send -- "exit\r" 86send -- "exit\r"
87sleep 2 87sleep 1
88 88
89 89
90 90
@@ -110,9 +110,9 @@ expect {
110 timeout {puts "TESTING ERROR 4\n";exit} 110 timeout {puts "TESTING ERROR 4\n";exit}
111 "Child process initialized" 111 "Child process initialized"
112} 112}
113sleep 2 113sleep 1
114send -- "exit\r" 114send -- "exit\r"
115sleep 2 115sleep 1
116 116
117 117
118 118
diff --git a/test/network/README b/test/network/README
index a715d8edf..4404c53b0 100644
--- a/test/network/README
+++ b/test/network/README
@@ -11,5 +11,4 @@ Limitations - to be investigated and fixed:
11 - macvlan interfaces don't seem to work correctly under VirtualBox 11 - macvlan interfaces don't seem to work correctly under VirtualBox
12 12
13Run the test: 13Run the test:
14 $ sudo ./configure
15 $ ./network.sh | grep TESTING 14 $ ./network.sh | grep TESTING
diff --git a/test/network/bandwidth.exp b/test/network/bandwidth.exp
index 8f3a706a8..8a2e46e04 100755
--- a/test/network/bandwidth.exp
+++ b/test/network/bandwidth.exp
@@ -12,7 +12,7 @@ expect {
12 timeout {puts "TESTING ERROR 0\n";exit} 12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized" 13 "Child process initialized"
14} 14}
15sleep 2 15sleep 1
16 16
17spawn $env(SHELL) 17spawn $env(SHELL)
18send -- "firejail --bandwidth=test status\r" 18send -- "firejail --bandwidth=test status\r"
diff --git a/test/firemon-arp.exp b/test/network/firemon-arp.exp
index 3fc8c2aee..0a543c3b4 100755
--- a/test/firemon-arp.exp
+++ b/test/network/firemon-arp.exp
@@ -11,7 +11,7 @@ expect {
11} 11}
12sleep 1 12sleep 1
13 13
14send -- "firejail\r" 14send -- "firejail --name=test1\r"
15expect { 15expect {
16 timeout {puts "TESTING ERROR 1\n";exit} 16 timeout {puts "TESTING ERROR 1\n";exit}
17 "Child process initialized" 17 "Child process initialized"
@@ -19,16 +19,32 @@ expect {
19sleep 1 19sleep 1
20 20
21spawn $env(SHELL) 21spawn $env(SHELL)
22send -- "firemon --arp\r" 22send -- "firejail --name=test2\r"
23expect { 23expect {
24 timeout {puts "TESTING ERROR 2\n";exit} 24 timeout {puts "TESTING ERROR 2\n";exit}
25 "Child process initialized"
26}
27sleep 1
28
29spawn $env(SHELL)
30send -- "firemon --arp\r"
31expect {
32 timeout {puts "TESTING ERROR 3\n";exit}
33 "name=test1"
34}
35expect {
36 timeout {puts "TESTING ERROR 4\n";exit}
25 "192.168.1.1 dev eth0 lladdr" {puts "Debian testing\n";} 37 "192.168.1.1 dev eth0 lladdr" {puts "Debian testing\n";}
26 "192.168.1.1 dev enp0s3 lladdr" {puts "Centos 7 testing\n";} 38 "192.168.1.1 dev enp0s3 lladdr" {puts "Centos 7 testing\n";}
27} 39}
28expect { 40expect {
29 timeout {puts "TESTING ERROR 3\n";exit} 41 timeout {puts "TESTING ERROR 5\n";exit}
30 "REACHABLE" 42 "REACHABLE"
31} 43}
32sleep 1 44expect {
45 timeout {puts "TESTING ERROR 6\n";exit}
46 "name=test2"
47}
48after 100
33 49
34puts "\n" 50puts "\nall done\n""
diff --git a/test/firemon-route.exp b/test/network/firemon-route.exp
index a48116675..19a705778 100755
--- a/test/firemon-route.exp
+++ b/test/network/firemon-route.exp
@@ -4,7 +4,7 @@ set timeout 10
4spawn $env(SHELL) 4spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
7send -- "firejail\r" 7send -- "firejail --name=test1\r"
8expect { 8expect {
9 timeout {puts "TESTING ERROR 0\n";exit} 9 timeout {puts "TESTING ERROR 0\n";exit}
10 "Child process initialized" 10 "Child process initialized"
@@ -12,22 +12,38 @@ expect {
12sleep 1 12sleep 1
13 13
14spawn $env(SHELL) 14spawn $env(SHELL)
15send -- "firemon --route\r" 15send -- "firejail --name=test2\r"
16expect { 16expect {
17 timeout {puts "TESTING ERROR 1\n";exit} 17 timeout {puts "TESTING ERROR 1\n";exit}
18 "Child process initialized"
19}
20sleep 1
21
22spawn $env(SHELL)
23send -- "firemon --route\r"
24expect {
25 timeout {puts "TESTING ERROR 2\n";exit}
26 "name=test1"
27}
28expect {
29 timeout {puts "TESTING ERROR 3\n";exit}
18 "0.0.0.0/0 via 192.168.1.1, dev eth0, metric 0" {puts "Debian testing\n";} 30 "0.0.0.0/0 via 192.168.1.1, dev eth0, metric 0" {puts "Debian testing\n";}
19 "0.0.0.0/0 via 192.168.1.1, dev enp0s3, metric 1024" {puts "Centos 7 testing\n";} 31 "0.0.0.0/0 via 192.168.1.1, dev enp0s3, metric 1024" {puts "Centos 7 testing\n";}
20 "0.0.0.0/0 via 192.168.1.1, dev enp0s3, metric 0" {puts "OpenSUSE testing\n";} 32 "0.0.0.0/0 via 192.168.1.1, dev enp0s3, metric 0" {puts "OpenSUSE testing\n";}
21 "0.0.0.0/0 via 192.168.1.1, dev enp0s3, metric 100" {puts "Arch testing\n";} 33 "0.0.0.0/0 via 192.168.1.1, dev enp0s3, metric 100" {puts "Arch testing\n";}
22} 34}
23expect { 35expect {
24 timeout {puts "TESTING ERROR 2\n";exit} 36 timeout {puts "TESTING ERROR 4\n";exit}
25 "10.10.30.0/24, dev br1, scope link src 10.10.30.1" 37 "10.10.30.0/24, dev br1, scope link src 10.10.30.1"
26} 38}
27expect { 39expect {
28 timeout {puts "TESTING ERROR 3\n";exit} 40 timeout {puts "TESTING ERROR 5\n";exit}
29 "10.10.50.0/24, dev br3, scope link src 10.10.50.1" 41 "10.10.50.0/24, dev br3, scope link src 10.10.50.1"
30} 42}
31sleep 1 43expect {
44 timeout {puts "TESTING ERROR 6\n";exit}
45 "name=test2"
46}
47after 100
32 48
33puts "\n" 49puts "\nalldone\n"
diff --git a/test/network/interface.exp b/test/network/interface.exp
index b15563eec..bd8777c33 100755
--- a/test/network/interface.exp
+++ b/test/network/interface.exp
@@ -14,7 +14,7 @@ set chroot [lindex $argv 1]
14# 14#
15# todo: seems to be unable to find interface eth0.7 15# todo: seems to be unable to find interface eth0.7
16#send -- "firejail --noprofile --interface=eth0.5 --interface=eth0.6 --interface=eth0.7\r" 16#send -- "firejail --noprofile --interface=eth0.5 --interface=eth0.6 --interface=eth0.7\r"
17send -- "firejail --noprofile --interface=eth0.7 --interface=eth0.6\r" 17send -- "firejail --noprofile --interface=eth0.5 --interface=eth0.6\r"
18expect { 18expect {
19 timeout {puts "TESTING ERROR 0\n";exit} 19 timeout {puts "TESTING ERROR 0\n";exit}
20 "Child process initialized" 20 "Child process initialized"
diff --git a/test/network/net_ip.exp b/test/network/net_ip.exp
index 32103050d..0fa84243a 100755
--- a/test/network/net_ip.exp
+++ b/test/network/net_ip.exp
@@ -29,9 +29,9 @@ expect {
29 timeout {puts "TESTING ERROR 4\n";exit} 29 timeout {puts "TESTING ERROR 4\n";exit}
30 "Child process initialized" 30 "Child process initialized"
31} 31}
32sleep 2 32sleep 1
33send -- "exit\r" 33send -- "exit\r"
34sleep 2 34sleep 1
35 35
36# check loopback 36# check loopback
37send -- "firejail --net=br0 --ip=10.10.20.5 --protocol=unix,inet,netlink\r" 37send -- "firejail --net=br0 --ip=10.10.20.5 --protocol=unix,inet,netlink\r"
diff --git a/test/network/net_local.exp b/test/network/net_local.exp
index b72b9adaf..d58135785 100755
--- a/test/network/net_local.exp
+++ b/test/network/net_local.exp
@@ -17,9 +17,9 @@ expect {
17 timeout {puts "TESTING ERROR 4\n";exit} 17 timeout {puts "TESTING ERROR 4\n";exit}
18 "Child process initialized" 18 "Child process initialized"
19} 19}
20sleep 2 20sleep 1
21send -- "exit\r" 21send -- "exit\r"
22sleep 2 22sleep 1
23 23
24# check loopback 24# check loopback
25send -- "firejail --noprofile\r" 25send -- "firejail --noprofile\r"
diff --git a/test/network/net_netfilter.exp b/test/network/net_netfilter.exp
index f011f3746..737485d07 100755
--- a/test/network/net_netfilter.exp
+++ b/test/network/net_netfilter.exp
@@ -29,7 +29,7 @@ expect {
29 timeout {puts "TESTING ERROR 4\n";exit} 29 timeout {puts "TESTING ERROR 4\n";exit}
30 "Child process initialized" 30 "Child process initialized"
31} 31}
32sleep 2 32sleep 1
33send -- "exit\r" 33send -- "exit\r"
34sleep 1 34sleep 1
35 35
@@ -43,7 +43,7 @@ expect {
43 "ACCEPT icmp -- any any anywhere" {puts "TESTING ERROR 5.1\n";exit} 43 "ACCEPT icmp -- any any anywhere" {puts "TESTING ERROR 5.1\n";exit}
44 "Child process initialized" 44 "Child process initialized"
45} 45}
46sleep 2 46sleep 1
47send -- "exit\r" 47send -- "exit\r"
48sleep 1 48sleep 1
49 49
@@ -57,7 +57,7 @@ expect {
57 timeout {puts "TESTING ERROR 6.1\n";exit} 57 timeout {puts "TESTING ERROR 6.1\n";exit}
58 "Child process initialized" 58 "Child process initialized"
59} 59}
60sleep 2 60sleep 1
61send -- "ping -c 1 -w 3 10.10.20.1\r" 61send -- "ping -c 1 -w 3 10.10.20.1\r"
62expect { 62expect {
63 timeout {puts "TESTING ERROR 6.2\n";exit} 63 timeout {puts "TESTING ERROR 6.2\n";exit}
diff --git a/test/network/net_profile.exp b/test/network/net_profile.exp
index dee0b2793..29008d811 100755
--- a/test/network/net_profile.exp
+++ b/test/network/net_profile.exp
@@ -33,7 +33,7 @@ expect {
33 timeout {puts "TESTING ERROR 0.4\n";exit} 33 timeout {puts "TESTING ERROR 0.4\n";exit}
34 "Child process initialized" 34 "Child process initialized"
35} 35}
36sleep 2 36sleep 1
37 37
38send -- "ip route show\r" 38send -- "ip route show\r"
39expect { 39expect {
diff --git a/test/network/net_veth.exp b/test/network/net_veth.exp
new file mode 100755
index 000000000..89dedcb24
--- /dev/null
+++ b/test/network/net_veth.exp
@@ -0,0 +1,130 @@
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
10send -- "firejail --net=eth0\r"
11expect {
12 timeout {puts "TESTING ERROR 1\n";exit}
13 "lo"
14}
15expect {
16 timeout {puts "TESTING ERROR 2\n";exit}
17 "127.0.0.1"
18}
19expect {
20 timeout {puts "TESTING ERROR 3\n";exit}
21 "255.0.0.0"
22}
23expect {
24 timeout {puts "TESTING ERROR 4\n";exit}
25 "UP"
26}
27expect {
28 timeout {puts "TESTING ERROR 5\n";exit}
29 "eth0-"
30}
31expect {
32 timeout {puts "TESTING ERROR 6\n";exit}
33 "255.255.255.0"
34}
35expect {
36 timeout {puts "TESTING ERROR 7\n";exit}
37 "UP"
38}
39expect {
40 timeout {puts "TESTING ERROR 8\n";exit}
41 "Default gateway"
42}
43expect {
44 timeout {puts "TESTING ERROR 9\n";exit}
45 "Child process initialized"
46}
47sleep 1
48send -- "exit\r"
49sleep 1
50
51send -- "firejail --net=eth0 --net=eth0 --net=eth0 --net=eth0\r"
52expect {
53 timeout {puts "TESTING ERROR 11\n";exit}
54 "lo"
55}
56expect {
57 timeout {puts "TESTING ERROR 12\n";exit}
58 "127.0.0.1"
59}
60expect {
61 timeout {puts "TESTING ERROR 13\n";exit}
62 "255.0.0.0"
63}
64expect {
65 timeout {puts "TESTING ERROR 14\n";exit}
66 "UP"
67}
68expect {
69 timeout {puts "TESTING ERROR 15\n";exit}
70 "eth0-"
71}
72expect {
73 timeout {puts "TESTING ERROR 16\n";exit}
74 "255.255.255.0"
75}
76expect {
77 timeout {puts "TESTING ERROR 17\n";exit}
78 "UP"
79}
80expect {
81 timeout {puts "TESTING ERROR 18\n";exit}
82 "eth1-"
83}
84expect {
85 timeout {puts "TESTING ERROR 19\n";exit}
86 "255.255.255.0"
87}
88expect {
89 timeout {puts "TESTING ERROR 20\n";exit}
90 "UP"
91}
92expect {
93 timeout {puts "TESTING ERROR 5\n";exit}
94 "eth2-"
95}
96expect {
97 timeout {puts "TESTING ERROR 21\n";exit}
98 "255.255.255.0"
99}
100expect {
101 timeout {puts "TESTING ERROR 22\n";exit}
102 "UP"
103}
104expect {
105 timeout {puts "TESTING ERROR 23\n";exit}
106 "eth3-"
107}
108expect {
109 timeout {puts "TESTING ERROR 24\n";exit}
110 "255.255.255.0"
111}
112expect {
113 timeout {puts "TESTING ERROR 25\n";exit}
114 "UP"
115}
116expect {
117 timeout {puts "TESTING ERROR 26\n";exit}
118 "Default gateway"
119}
120expect {
121 timeout {puts "TESTING ERROR 27\n";exit}
122 "Child process initialized"
123}
124sleep 1
125send -- "exit\r"
126
127after 100
128
129puts "\n"
130
diff --git a/test/network/network.sh b/test/network/network.sh
index e0087411d..28f707952 100755
--- a/test/network/network.sh
+++ b/test/network/network.sh
@@ -6,6 +6,14 @@
6export MALLOC_CHECK_=3 6export MALLOC_CHECK_=3
7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1)) 7export MALLOC_PERTURB_=$(($RANDOM % 255 + 1))
8 8
9sudo ./configure
10
11echo "TESTING: firemon arp (firemon-arp.exp)"
12./firemon-arp.exp
13
14echo "TESTING: firemon route (firemon-route.exp)"
15./firemon-route.exp
16
9echo "TESTING: network profile (net_profile.exp)" 17echo "TESTING: network profile (net_profile.exp)"
10./net_profile.exp 18./net_profile.exp
11 19
@@ -58,6 +66,9 @@ echo "TESTING: scan (net_scan.exp)"
58echo "TESTING: interface (interface.exp)" 66echo "TESTING: interface (interface.exp)"
59./interface.exp 67./interface.exp
60 68
69echo "TESTING: veth (net_veth.exp)"
70./net_veth.exp
71
61echo "TESTING: netfilter (net_netfilter.exp)" 72echo "TESTING: netfilter (net_netfilter.exp)"
62./net_netfilter.exp 73./net_netfilter.exp
63 74