diff options
author | netblue30 <netblue30@protonmail.com> | 2023-03-06 16:09:33 -0500 |
---|---|---|
committer | netblue30 <netblue30@protonmail.com> | 2023-03-06 16:09:33 -0500 |
commit | c79beb5a151e28e1185e380638073d259f0da24b (patch) | |
tree | ae221f117231853166c70bd9af7190eb47ce9d56 /test/network | |
parent | ci: remove extra space on codespell job (diff) | |
download | firejail-c79beb5a151e28e1185e380638073d259f0da24b.tar.gz firejail-c79beb5a151e28e1185e380638073d259f0da24b.tar.zst firejail-c79beb5a151e28e1185e380638073d259f0da24b.zip |
testing
Diffstat (limited to 'test/network')
-rwxr-xr-x | test/network/ip6.exp | 48 | ||||
-rw-r--r-- | test/network/ip6.profile | 3 | ||||
-rwxr-xr-x | test/network/net-print.exp | 34 | ||||
-rwxr-xr-x | test/network/network.sh | 6 |
4 files changed, 91 insertions, 0 deletions
diff --git a/test/network/ip6.exp b/test/network/ip6.exp new file mode 100755 index 000000000..e2e83fe0e --- /dev/null +++ b/test/network/ip6.exp | |||
@@ -0,0 +1,48 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2022 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --noprofile --net=br0 --ip6=2001:0db8:0:f101::1/64 ip addr show\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
14 | } | ||
15 | expect { | ||
16 | timeout {puts "TESTING ERROR 1\n";exit} | ||
17 | "eth0" | ||
18 | } | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 2\n";exit} | ||
21 | "inet6" | ||
22 | } | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 3\n";exit} | ||
25 | "2001:db8:0:f101::1/64" | ||
26 | } | ||
27 | sleep 1 | ||
28 | |||
29 | send -- "firejail --profile=ip6.profile ip addr show\r" | ||
30 | expect { | ||
31 | timeout {puts "TESTING ERROR 4\n";exit} | ||
32 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
33 | } | ||
34 | expect { | ||
35 | timeout {puts "TESTING ERROR 5\n";exit} | ||
36 | "eth0" | ||
37 | } | ||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 6\n";exit} | ||
40 | "inet6" | ||
41 | } | ||
42 | expect { | ||
43 | timeout {puts "TESTING ERROR 7\n";exit} | ||
44 | "2001:db8:0:f101::1/64" | ||
45 | } | ||
46 | after 500 | ||
47 | puts "\nall done\n" | ||
48 | exit | ||
diff --git a/test/network/ip6.profile b/test/network/ip6.profile new file mode 100644 index 000000000..d4611ec41 --- /dev/null +++ b/test/network/ip6.profile | |||
@@ -0,0 +1,3 @@ | |||
1 | net br0 | ||
2 | ip6 2001:0db8:0:f101::1/64 | ||
3 | #netfilter6 ipv6.net | ||
diff --git a/test/network/net-print.exp b/test/network/net-print.exp new file mode 100755 index 000000000..691114cf4 --- /dev/null +++ b/test/network/net-print.exp | |||
@@ -0,0 +1,34 @@ | |||
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.9\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --net.print=test\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "lo" | ||
22 | } | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 2\n";exit} | ||
25 | "eth0" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 3\n";exit} | ||
29 | "10.10.20.9" | ||
30 | } | ||
31 | |||
32 | after 500 | ||
33 | |||
34 | puts "\nall done\n" | ||
diff --git a/test/network/network.sh b/test/network/network.sh index 319927493..877f16156 100755 --- a/test/network/network.sh +++ b/test/network/network.sh | |||
@@ -27,8 +27,14 @@ echo "TESTING: network scan (net_scan.exp)" | |||
27 | echo "TESTING: netfilter (net_netfilter.exp)" | 27 | echo "TESTING: netfilter (net_netfilter.exp)" |
28 | ./net_netfilter.exp | 28 | ./net_netfilter.exp |
29 | 29 | ||
30 | echo "TESTING: print network (net-print.exp)" | ||
31 | ./net-print.exp | ||
32 | |||
30 | echo "TESTING: print dns (dns-print.exp)" | 33 | echo "TESTING: print dns (dns-print.exp)" |
31 | ./dns-print.exp | 34 | ./dns-print.exp |
32 | 35 | ||
36 | echo "TESTING: ipv6 (ip6.exp)" | ||
37 | ./ip6.exp | ||
38 | |||
33 | sudo ip link set br0 down | 39 | sudo ip link set br0 down |
34 | sudo brctl delbr br0 | 40 | sudo brctl delbr br0 |