diff options
author | netblue30 <netblue30@protonmail.com> | 2023-03-07 17:49:25 -0500 |
---|---|---|
committer | netblue30 <netblue30@protonmail.com> | 2023-03-07 17:49:25 -0500 |
commit | ec7d55fc4404aded7cef1ace81634355a102dcda (patch) | |
tree | c3a5fc1811d21188402d5a8d54be0b6149bafee2 /test/network | |
parent | remove DNS lookup for --netfilter.print and --netfilter6.print commands (diff) | |
download | firejail-ec7d55fc4404aded7cef1ace81634355a102dcda.tar.gz firejail-ec7d55fc4404aded7cef1ace81634355a102dcda.tar.zst firejail-ec7d55fc4404aded7cef1ace81634355a102dcda.zip |
testing
Diffstat (limited to 'test/network')
-rwxr-xr-x | test/network/firemon-arp.exp | 28 | ||||
-rwxr-xr-x | test/network/firemon-interface.exp | 28 | ||||
-rwxr-xr-x | test/network/firemon-route.exp | 40 | ||||
-rwxr-xr-x | test/network/netstats.exp | 30 | ||||
-rwxr-xr-x | test/network/network.sh | 14 |
5 files changed, 139 insertions, 1 deletions
diff --git a/test/network/firemon-arp.exp b/test/network/firemon-arp.exp new file mode 100755 index 000000000..87f0ddf4e --- /dev/null +++ b/test/network/firemon-arp.exp | |||
@@ -0,0 +1,28 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2023 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --name=test --net=br0 --ip=10.10.20.50\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 1\n";exit} | ||
13 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
14 | } | ||
15 | sleep 2 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firemon --arp\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 2\n";exit} | ||
21 | "firejail --name=test --net=br0 --ip=10.10.20.50" | ||
22 | } | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 3\n";exit} | ||
25 | "ARP Table:" | ||
26 | } | ||
27 | after 500 | ||
28 | puts "\nall done\n" | ||
diff --git a/test/network/firemon-interface.exp b/test/network/firemon-interface.exp new file mode 100755 index 000000000..6ae57ac6a --- /dev/null +++ b/test/network/firemon-interface.exp | |||
@@ -0,0 +1,28 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2023 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --name=test --net=br0 --ip=10.10.20.50\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 1\n";exit} | ||
13 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
14 | } | ||
15 | sleep 2 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firemon --interface\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 2\n";exit} | ||
21 | "firejail --name=test --net=br0 --ip=10.10.20.50" | ||
22 | } | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 3\n";exit} | ||
25 | "eth0 UP, 10.10.20.50/24" | ||
26 | } | ||
27 | sleep 2 | ||
28 | puts "\nall done\n" | ||
diff --git a/test/network/firemon-route.exp b/test/network/firemon-route.exp new file mode 100755 index 000000000..2ca6f2fca --- /dev/null +++ b/test/network/firemon-route.exp | |||
@@ -0,0 +1,40 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2023 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --name=test --net=br0 --ip=10.10.20.50\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 1\n";exit} | ||
13 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
14 | } | ||
15 | sleep 2 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firemon --route\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 2\n";exit} | ||
21 | "firejail --name=test --net=br0 --ip=10.10.20.50" | ||
22 | } | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 3\n";exit} | ||
25 | "Route table:" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 4\n";exit} | ||
29 | "0.0.0.0/0 via 10.10.20.1" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 5\n";exit} | ||
33 | "10.10.20.0/24, dev eth0" | ||
34 | } | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 6\n";exit} | ||
37 | "src 10.10.20.50" | ||
38 | } | ||
39 | after 500 | ||
40 | puts "\nall done\n" | ||
diff --git a/test/network/netstats.exp b/test/network/netstats.exp new file mode 100755 index 000000000..5cb272728 --- /dev/null +++ b/test/network/netstats.exp | |||
@@ -0,0 +1,30 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2023 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --name=test --net=br0\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 1\n";exit} | ||
13 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
14 | } | ||
15 | sleep 2 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --netstats\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 2\n";exit} | ||
21 | "statistics only for sandboxes using a new network namespace" | ||
22 | } | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 3\n";exit} | ||
25 | "firejail --name=test --net=br0" | ||
26 | } | ||
27 | after 500 | ||
28 | send -- "\r" | ||
29 | after 500 | ||
30 | puts "\nall done\n" | ||
diff --git a/test/network/network.sh b/test/network/network.sh index 2a7de2680..dad1ed42d 100755 --- a/test/network/network.sh +++ b/test/network/network.sh | |||
@@ -39,8 +39,20 @@ echo "TESTING: bandwidth (net_bandwidth.exp)" | |||
39 | echo "TESTING: ipv6 (ip6.exp)" | 39 | echo "TESTING: ipv6 (ip6.exp)" |
40 | ./ip6.exp | 40 | ./ip6.exp |
41 | 41 | ||
42 | echo "TESTING: ipv6 netfilter(ip6_netfilter.exp)" | 42 | echo "TESTING: ipv6 netfilter (ip6_netfilter.exp)" |
43 | ./ip6_netfilter.exp | 43 | ./ip6_netfilter.exp |
44 | 44 | ||
45 | echo "TESTING: netstats (netstats.exp)" | ||
46 | ./netstats.exp | ||
47 | |||
48 | echo "TESTING: firemon arp (firemon-arp.exp)" | ||
49 | ./firemon-arp.exp | ||
50 | |||
51 | echo "TESTING: firemon route (firemon-route.exp)" | ||
52 | ./firemon-route.exp | ||
53 | |||
54 | #echo "TESTING: firemon interface (firemon-interface.exp)" | ||
55 | #sudo ./firemon-interface.exp | ||
56 | |||
45 | sudo ip link set br0 down | 57 | sudo ip link set br0 down |
46 | sudo brctl delbr br0 | 58 | sudo brctl delbr br0 |