aboutsummaryrefslogtreecommitdiffstats
path: root/test/network
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-05-03 10:33:10 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2016-05-03 10:33:10 -0400
commit723dde8d085f6b2510fcf210721d0de8e8f14a86 (patch)
treec3c10c494c72eb1c3f0cda4a3b0be748a4ce42d4 /test/network
parentnetworking features testing (diff)
downloadfirejail-723dde8d085f6b2510fcf210721d0de8e8f14a86.tar.gz
firejail-723dde8d085f6b2510fcf210721d0de8e8f14a86.tar.zst
firejail-723dde8d085f6b2510fcf210721d0de8e8f14a86.zip
networking features testing
Diffstat (limited to 'test/network')
-rwxr-xr-xtest/network/4bridges_arp.exp3
-rwxr-xr-xtest/network/4bridges_ip.exp3
-rw-r--r--test/network/README15
-rwxr-xr-xtest/network/bandwidth.exp7
-rwxr-xr-xtest/network/configure3
-rwxr-xr-xtest/network/hostname.exp9
-rwxr-xr-xtest/network/ip6.exp3
-rwxr-xr-xtest/network/net_arp.exp3
-rwxr-xr-xtest/network/net_badip.exp3
-rwxr-xr-xtest/network/net_defaultgw.exp3
-rwxr-xr-xtest/network/net_defaultgw2.exp3
-rwxr-xr-xtest/network/net_defaultgw3.exp3
-rwxr-xr-xtest/network/net_interface.exp3
-rwxr-xr-xtest/network/net_ip.exp3
-rwxr-xr-xtest/network/net_local.exp3
-rwxr-xr-xtest/network/net_mac.exp3
-rwxr-xr-xtest/network/net_macvlan.exp3
-rwxr-xr-xtest/network/net_mtu.exp3
-rwxr-xr-xtest/network/net_netfilter.exp3
-rwxr-xr-xtest/network/net_noip.exp11
-rwxr-xr-xtest/network/net_noip2.exp11
-rwxr-xr-xtest/network/net_none.exp21
-rwxr-xr-xtest/network/net_profile.exp3
23 files changed, 103 insertions, 22 deletions
diff --git a/test/network/4bridges_arp.exp b/test/network/4bridges_arp.exp
index 6a3e6db2a..f769df43b 100755
--- a/test/network/4bridges_arp.exp
+++ b/test/network/4bridges_arp.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/4bridges_ip.exp b/test/network/4bridges_ip.exp
index 8068aeebb..db7a61867 100755
--- a/test/network/4bridges_ip.exp
+++ b/test/network/4bridges_ip.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/README b/test/network/README
new file mode 100644
index 000000000..27e5667a2
--- /dev/null
+++ b/test/network/README
@@ -0,0 +1,15 @@
1Warning: this test requires root access to configure a number of bridge, macvlan and
2vlan devices. Please take a look at configure file. By the time you are finished testing,
3you'll probably have to reboot the computer to get your networking subsytem
4back to normal.
5
6Limitations - to be investigated and fixed:
7 - the test is assuming an eth0 wired interface to be present
8 - using netstat and ifconfig - this needs to be moved to iproute2 utilities
9 - configure script inserts an entry in system netfilter configuration
10 - the test will probably not work on grsecurity settings
11 - macvlan interfaces don't seem to work correctly under VirtualBox
12
13Run the test:
14 $ sudo ./configure
15 $ ./network.sh | grep TESTING
diff --git a/test/network/bandwidth.exp b/test/network/bandwidth.exp
index 33b351296..a3dc9b55f 100755
--- a/test/network/bandwidth.exp
+++ b/test/network/bandwidth.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
@@ -51,11 +54,11 @@ expect {
51} 54}
52sleep 1 55sleep 1
53 56
54send -- "firejail --bandwidth=test status; pwd\r" 57send -- "firejail --bandwidth=test status; echo done\r"
55expect { 58expect {
56 timeout {puts "TESTING ERROR 8\n";exit} 59 timeout {puts "TESTING ERROR 8\n";exit}
57 "rate 80Kbit burst 10Kb" {puts "TESTING ERROR 9\n";exit} 60 "rate 80Kbit burst 10Kb" {puts "TESTING ERROR 9\n";exit}
58 "home" {puts "ok\n"} 61 "done"
59} 62}
60sleep 1 63sleep 1
61 64
diff --git a/test/network/configure b/test/network/configure
index 788c5a9a0..35d938340 100755
--- a/test/network/configure
+++ b/test/network/configure
@@ -1,4 +1,7 @@
1#!/bin/bash 1#!/bin/bash
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3brctl addbr br0 6brctl addbr br0
4ifconfig br0 10.10.20.1/29 up 7ifconfig br0 10.10.20.1/29 up
diff --git a/test/network/hostname.exp b/test/network/hostname.exp
index 4e5c7e073..53f24f7b1 100755
--- a/test/network/hostname.exp
+++ b/test/network/hostname.exp
@@ -1,24 +1,27 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
5match_max 100000 8match_max 100000
6 9
7send -- "firejail --hostname=baluba --noprofile\r" 10send -- "firejail --hostname=bingo --noprofile\r"
8expect { 11expect {
9 timeout {puts "TESTING ERROR 1\n";exit} 12 timeout {puts "TESTING ERROR 1\n";exit}
10 "Child process initialized" 13 "Child process initialized"
11} 14}
12sleep 1 15sleep 1
13 16
14send -- "ping -c 3 baluba;pwd\r" 17send -- "ping -c 3 bingo; echo done\r"
15expect { 18expect {
16 timeout {puts "TESTING ERROR 2\n";exit} 19 timeout {puts "TESTING ERROR 2\n";exit}
17 "3 packets transmitted, 3 received" 20 "3 packets transmitted, 3 received"
18} 21}
19expect { 22expect {
20 timeout {puts "TESTING ERROR 3\n";exit} 23 timeout {puts "TESTING ERROR 3\n";exit}
21 "home" 24 "done"
22} 25}
23sleep 1 26sleep 1
24 27
diff --git a/test/network/ip6.exp b/test/network/ip6.exp
index fba47d095..2cd756a1d 100755
--- a/test/network/ip6.exp
+++ b/test/network/ip6.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_arp.exp b/test/network/net_arp.exp
index 9e07744f3..f27f85814 100755
--- a/test/network/net_arp.exp
+++ b/test/network/net_arp.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_badip.exp b/test/network/net_badip.exp
index 71b69e104..8003252d6 100755
--- a/test/network/net_badip.exp
+++ b/test/network/net_badip.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_defaultgw.exp b/test/network/net_defaultgw.exp
index 840f2ccac..5534b7706 100755
--- a/test/network/net_defaultgw.exp
+++ b/test/network/net_defaultgw.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_defaultgw2.exp b/test/network/net_defaultgw2.exp
index db14e17cb..86f204e8c 100755
--- a/test/network/net_defaultgw2.exp
+++ b/test/network/net_defaultgw2.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_defaultgw3.exp b/test/network/net_defaultgw3.exp
index 64da9dfca..30150938f 100755
--- a/test/network/net_defaultgw3.exp
+++ b/test/network/net_defaultgw3.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_interface.exp b/test/network/net_interface.exp
index 4b55187ff..2e6619938 100755
--- a/test/network/net_interface.exp
+++ b/test/network/net_interface.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_ip.exp b/test/network/net_ip.exp
index f5d487ecc..0eff212dd 100755
--- a/test/network/net_ip.exp
+++ b/test/network/net_ip.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_local.exp b/test/network/net_local.exp
index 642213658..60ab2af05 100755
--- a/test/network/net_local.exp
+++ b/test/network/net_local.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_mac.exp b/test/network/net_mac.exp
index 076634730..5c48be9fd 100755
--- a/test/network/net_mac.exp
+++ b/test/network/net_mac.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_macvlan.exp b/test/network/net_macvlan.exp
index 20d022de9..ca503c26a 100755
--- a/test/network/net_macvlan.exp
+++ b/test/network/net_macvlan.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_mtu.exp b/test/network/net_mtu.exp
index 7943b2866..21b9aa5cb 100755
--- a/test/network/net_mtu.exp
+++ b/test/network/net_mtu.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_netfilter.exp b/test/network/net_netfilter.exp
index 989fcc407..f011f3746 100755
--- a/test/network/net_netfilter.exp
+++ b/test/network/net_netfilter.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
diff --git a/test/network/net_noip.exp b/test/network/net_noip.exp
index 8d28adb39..3fb53d860 100755
--- a/test/network/net_noip.exp
+++ b/test/network/net_noip.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
@@ -16,24 +19,24 @@ send -- "bash\r"
16sleep 1 19sleep 1
17 20
18# no default gateway configured 21# no default gateway configured
19send -- "netstat -rn;pwd\r" 22send -- "netstat -rn;echo done\r"
20expect { 23expect {
21 timeout {puts "TESTING ERROR 2\n";exit} 24 timeout {puts "TESTING ERROR 2\n";exit}
22 "0.0.0.0" {puts "TESTING ERROR 3\n";exit} 25 "0.0.0.0" {puts "TESTING ERROR 3\n";exit}
23 "eth0" {puts "TESTING ERROR 4\n";exit} 26 "eth0" {puts "TESTING ERROR 4\n";exit}
24 "home" 27 "done"
25} 28}
26sleep 1 29sleep 1
27 30
28# eth0 configured 31# eth0 configured
29send -- "/sbin/ifconfig;pwd\r" 32send -- "/sbin/ifconfig;echo done\r"
30expect { 33expect {
31 timeout {puts "TESTING ERROR 5\n";exit} 34 timeout {puts "TESTING ERROR 5\n";exit}
32 "eth0" 35 "eth0"
33} 36}
34expect { 37expect {
35 timeout {puts "TESTING ERROR 6\n";exit} 38 timeout {puts "TESTING ERROR 6\n";exit}
36 "home" 39 "done"
37} 40}
38after 100 41after 100
39 42
diff --git a/test/network/net_noip2.exp b/test/network/net_noip2.exp
index 58f90422b..cf86d7f6b 100755
--- a/test/network/net_noip2.exp
+++ b/test/network/net_noip2.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
@@ -16,24 +19,24 @@ send -- "bash\r"
16sleep 1 19sleep 1
17 20
18# no default gateway configured 21# no default gateway configured
19send -- "netstat -rn;pwd\r" 22send -- "netstat -rn;echo done\r"
20expect { 23expect {
21 timeout {puts "TESTING ERROR 2\n";exit} 24 timeout {puts "TESTING ERROR 2\n";exit}
22 "0.0.0.0" {puts "TESTING ERROR 3\n";exit} 25 "0.0.0.0" {puts "TESTING ERROR 3\n";exit}
23 "eth0" {puts "TESTING ERROR 4\n";exit} 26 "eth0" {puts "TESTING ERROR 4\n";exit}
24 "home" 27 "done"
25} 28}
26sleep 1 29sleep 1
27 30
28# eth0 configured 31# eth0 configured
29send -- "/sbin/ifconfig;pwd\r" 32send -- "/sbin/ifconfig;echo done\r"
30expect { 33expect {
31 timeout {puts "TESTING ERROR 5\n";exit} 34 timeout {puts "TESTING ERROR 5\n";exit}
32 "eth0" 35 "eth0"
33} 36}
34expect { 37expect {
35 timeout {puts "TESTING ERROR 6\n";exit} 38 timeout {puts "TESTING ERROR 6\n";exit}
36 "home" 39 "done"
37} 40}
38after 100 41after 100
39 42
diff --git a/test/network/net_none.exp b/test/network/net_none.exp
index 54b6cb946..1c1577d76 100755
--- a/test/network/net_none.exp
+++ b/test/network/net_none.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)
@@ -16,20 +19,20 @@ sleep 1
16# test default gw 19# test default gw
17send -- "bash\r" 20send -- "bash\r"
18sleep 1 21sleep 1
19send -- "netstat -rn; pwd\r" 22send -- "netstat -rn; echo done\r"
20expect { 23expect {
21 timeout {puts "TESTING ERROR 1\n";exit} 24 timeout {puts "TESTING ERROR 1\n";exit}
22 "0.0.0.0" {puts "TESTING ERROR 1.1\n";exit} 25 "0.0.0.0" {puts "TESTING ERROR 1.1\n";exit}
23 "home" 26 "done"
24} 27}
25sleep 1 28sleep 1
26 29
27# check again devices 30# check again devices
28send -- "cat /proc/1/net/dev;pwd\r" 31send -- "cat /proc/1/net/dev;echo done\r"
29expect { 32expect {
30 timeout {puts "TESTING ERROR 2\n";exit} 33 timeout {puts "TESTING ERROR 2\n";exit}
31 "eth0" {puts "TESTING ERROR 2.1\n";exit} 34 "eth0" {puts "TESTING ERROR 2.1\n";exit}
32 "home" 35 "done"
33} 36}
34send -- "exit\r" 37send -- "exit\r"
35sleep 1 38sleep 1
@@ -48,21 +51,21 @@ sleep 1
48# test default gw 51# test default gw
49send -- "bash\r" 52send -- "bash\r"
50sleep 1 53sleep 1
51send -- "netstat -rn; pwd\r" 54send -- "netstat -rn; echo done\r"
52expect { 55expect {
53 timeout {puts "TESTING ERROR 4\n";exit} 56 timeout {puts "TESTING ERROR 4\n";exit}
54 "0.0.0.0" {puts "TESTING ERROR 4.1\n";exit} 57 "0.0.0.0" {puts "TESTING ERROR 4.1\n";exit}
55 "home" 58 "done"
56} 59}
57sleep 1 60sleep 1
58 61
59# check again devices 62# check again devices
60send -- "cat /proc/1/net/dev;pwd\r" 63send -- "cat /proc/1/net/dev;echo done\r"
61expect { 64expect {
62 timeout {puts "TESTING ERROR 5\n";exit} 65 timeout {puts "TESTING ERROR 5\n";exit}
63 "eth0" {puts "TESTING ERROR 5.1\n";exit} 66 "eth0" {puts "TESTING ERROR 5.1\n";exit}
64 "home" 67 "done"
65} 68}
66sleep 1 69sleep 1
67 70
68puts "\n" 71puts "\nall done\n"
diff --git a/test/network/net_profile.exp b/test/network/net_profile.exp
index 37043c906..7e88193cc 100755
--- a/test/network/net_profile.exp
+++ b/test/network/net_profile.exp
@@ -1,4 +1,7 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2016 Firejail Authors
4# License GPL v2
2 5
3set timeout 10 6set timeout 10
4spawn $env(SHELL) 7spawn $env(SHELL)