aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@protonmail.com>2023-03-07 08:30:53 -0500
committerLibravatar netblue30 <netblue30@protonmail.com>2023-03-07 08:30:53 -0500
commita12601f02aecefd6fde2f227bd3536840f7f7b14 (patch)
treee35164d4ad8b63157170f355be3e0160eb6f172c /test
parentRun make codespell (diff)
downloadfirejail-a12601f02aecefd6fde2f227bd3536840f7f7b14.tar.gz
firejail-a12601f02aecefd6fde2f227bd3536840f7f7b14.tar.zst
firejail-a12601f02aecefd6fde2f227bd3536840f7f7b14.zip
testing
Diffstat (limited to 'test')
-rwxr-xr-xtest/network/ip6_netfilter.exp31
-rw-r--r--test/network/ip6_netfilter.profile8
-rwxr-xr-xtest/network/net_bandwidth.exp51
-rwxr-xr-xtest/network/net_ip.exp40
-rw-r--r--test/network/net_ip.profile6
-rwxr-xr-xtest/network/network.sh6
6 files changed, 142 insertions, 0 deletions
diff --git a/test/network/ip6_netfilter.exp b/test/network/ip6_netfilter.exp
new file mode 100755
index 000000000..6c478d9e7
--- /dev/null
+++ b/test/network/ip6_netfilter.exp
@@ -0,0 +1,31 @@
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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10# check default netfilter on br0
11send -- "firejail --name=test --net=br0 --netfilter6=ip6_netfilter.profile\r"
12expect {
13 timeout {puts "TESTING ERROR 0\n";exit}
14 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
15}
16sleep 2
17spawn $env(SHELL)
18
19# check default netfilter no new network
20send -- "firejail --netfilter6.print=test\r"
21expect {
22 timeout {puts "TESTING ERROR 1\n";exit}
23 "DROP"
24}
25expect {
26 timeout {puts "TESTING ERROR 2\n";exit}
27 "2001:db8:1f0a:3ec::2"
28}
29
30after 500
31puts "all done\n"
diff --git a/test/network/ip6_netfilter.profile b/test/network/ip6_netfilter.profile
new file mode 100644
index 000000000..cc8f22943
--- /dev/null
+++ b/test/network/ip6_netfilter.profile
@@ -0,0 +1,8 @@
1# Generated by ip6tables-save v1.4.14 on Wed Jan 13 10:53:40 2016
2*filter
3:INPUT ACCEPT [0:0]
4:FORWARD ACCEPT [0:0]
5:OUTPUT ACCEPT [0:0]
6-A INPUT -s 2001:db8:1f0a:3ec::2/128 -j DROP
7COMMIT
8# Completed on Wed Jan 13 10:53:40 2016
diff --git a/test/network/net_bandwidth.exp b/test/network/net_bandwidth.exp
new file mode 100755
index 000000000..0ec3b59ef
--- /dev/null
+++ b/test/network/net_bandwidth.exp
@@ -0,0 +1,51 @@
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
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --name=test --net=br0\r"
11expect {
12 timeout {puts "TESTING ERROR 1\n";exit}
13 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
14}
15sleep 2
16
17spawn $env(SHELL)
18send -- "firejail --bandwidth=test set br0 10 20\r"
19expect {
20 timeout {puts "TESTING ERROR 2\n";exit}
21 "Download speed 80kbps"
22}
23expect {
24 timeout {puts "TESTING ERROR 3\n";exit}
25 "Upload speed 160kbps"
26}
27expect {
28 timeout {puts "TESTING ERROR 4\n";exit}
29 "configuring tc ingress"
30}
31expect {
32 timeout {puts "TESTING ERROR 5\n";exit}
33 "configuring tc egress"
34}
35after 500
36
37send -- "firejail --bandwidth=test status\r"
38expect {
39 timeout {puts "TESTING ERROR 6\n";exit}
40 "rate 160Kbit burst 10Kb"
41}
42after 500
43
44send -- "firejail --bandwidth=test clear br0\r"
45expect {
46 timeout {puts "TESTING ERROR 7\n";exit}
47 "Removing bandwidth limits"
48}
49sleep 1
50
51puts "\nall done\n"
diff --git a/test/network/net_ip.exp b/test/network/net_ip.exp
index 251b55362..0cccf93a0 100755
--- a/test/network/net_ip.exp
+++ b/test/network/net_ip.exp
@@ -130,4 +130,44 @@ expect {
130} 130}
131 131
132after 500 132after 500
133
134send -- "firejail --profile=net_ip.profile ip addr show\r"
135expect {
136 timeout {puts "TESTING ERROR 26\n";exit}
137 "eth0"
138}
139expect {
140 timeout {puts "TESTING ERROR 27\n";exit}
141 "00:11:22:33:44:55"
142}
143expect {
144 timeout {puts "TESTING ERROR 28\n";exit}
145 "10.10.20.55"
146}
147expect {
148 timeout {puts "TESTING ERROR 29\n";exit}
149 "Default gateway 10.10.20.9"
150}
151expect {
152 timeout {puts "TESTING ERROR 30\n";exit}
153 "00:11:22:33:44:55"
154}
155expect {
156 timeout {puts "TESTING ERROR 31\n";exit}
157 "10.10.20.55"
158}
159after 500
160
161send -- "firejail --profile=net_ip.profile ip route show\r"
162expect {
163 timeout {puts "TESTING ERROR 32\n";exit}
164 "default via 10.10.20.9"
165}
166expect {
167 timeout {puts "TESTING ERROR 33\n";exit}
168 "10.10.20.0/24 dev eth0 proto kernel scope link src 10.10.20.55"
169}
170after 500
171
172
133puts "\nall done\n" 173puts "\nall done\n"
diff --git a/test/network/net_ip.profile b/test/network/net_ip.profile
new file mode 100644
index 000000000..72910d77e
--- /dev/null
+++ b/test/network/net_ip.profile
@@ -0,0 +1,6 @@
1net br0
2ip 10.10.20.55
3defaultgw 10.10.20.9
4mac 00:11:22:33:44:55
5mtu 1000
6
diff --git a/test/network/network.sh b/test/network/network.sh
index 877f16156..e062358d4 100755
--- a/test/network/network.sh
+++ b/test/network/network.sh
@@ -33,8 +33,14 @@ echo "TESTING: print network (net-print.exp)"
33echo "TESTING: print dns (dns-print.exp)" 33echo "TESTING: print dns (dns-print.exp)"
34./dns-print.exp 34./dns-print.exp
35 35
36echo "TESTING: bandwidth (net_bandwidth.exp)"
37./net_bandwidth.exp
38
36echo "TESTING: ipv6 (ip6.exp)" 39echo "TESTING: ipv6 (ip6.exp)"
37./ip6.exp 40./ip6.exp
38 41
42#echo "TESTING: ipv6 netfilter(ip6_netfilter.exp)"
43#./ip6_netfilter.exp
44
39sudo ip link set br0 down 45sudo ip link set br0 down
40sudo brctl delbr br0 46sudo brctl delbr br0