aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@protonmail.com>2023-03-09 09:21:35 -0500
committerLibravatar netblue30 <netblue30@protonmail.com>2023-03-09 09:21:35 -0500
commit18765f235857f5c4e11f5e39fcdc13b5c76759fa (patch)
tree2fa74ff3a2af81c924f1b15acccf38d65b0b4943 /test
parentMerge branch 'master' of ssh://github.com/netblue30/firejail (diff)
downloadfirejail-18765f235857f5c4e11f5e39fcdc13b5c76759fa.tar.gz
firejail-18765f235857f5c4e11f5e39fcdc13b5c76759fa.tar.zst
firejail-18765f235857f5c4e11f5e39fcdc13b5c76759fa.zip
testing
Diffstat (limited to 'test')
-rwxr-xr-xtest/network/netfilter-template.exp41
-rwxr-xr-xtest/network/network.sh13
2 files changed, 52 insertions, 2 deletions
diff --git a/test/network/netfilter-template.exp b/test/network/netfilter-template.exp
new file mode 100755
index 000000000..2dc50cef7
--- /dev/null
+++ b/test/network/netfilter-template.exp
@@ -0,0 +1,41 @@
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
11send -- "firejail --net=br0 --ip=10.10.30.10 --name=test1 --netfilter=/etc/firejail/blablabla\r"
12expect {
13 timeout {puts "TESTING ERROR 0\n";exit}
14 "invalid network filter file"
15}
16after 500
17
18send -- "firejail --net=br0 --ip=10.10.20.10 --name=test1 --netfilter=/etc/firejail/tcpserver.net,5678\r"
19expect {
20 timeout {puts "TESTING ERROR 1\n";exit}
21 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
22}
23sleep 2
24
25spawn $env(SHELL)
26send -- "firejail --netfilter.print=test1\r"
27expect {
28 timeout {puts "TESTING ERROR 2\n";exit}
29 "Chain INPUT"
30}
31expect {
32 timeout {puts "TESTING ERROR 3\n";exit}
33 "ACCEPT"
34}
35expect {
36 timeout {puts "TESTING ERROR 4\n";exit}
37 "tcp dpt:5678 state NEW,ESTABLISHED"
38}
39sleep 1
40
41puts "\nall done\n"
diff --git a/test/network/network.sh b/test/network/network.sh
index e029722ba..6d26e967f 100755
--- a/test/network/network.sh
+++ b/test/network/network.sh
@@ -42,8 +42,14 @@ echo "TESTING: ipv6 (ip6.exp)"
42echo "TESTING: ipv6 netfilter (ip6_netfilter.exp)" 42echo "TESTING: ipv6 netfilter (ip6_netfilter.exp)"
43./ip6_netfilter.exp 43./ip6_netfilter.exp
44 44
45echo "TESTING: netstats (netstats.exp)" 45# this test will fail on github!
46./netstats.exp 46USER=`whoami`
47if [[ $USER == "runner" ]]; then
48 echo "TESTING: skip over netstats test"
49else
50 echo "TESTING: netstats (netstats.exp)"
51 ./netstats.exp
52fi
47 53
48echo "TESTING: firemon arp (firemon-arp.exp)" 54echo "TESTING: firemon arp (firemon-arp.exp)"
49./firemon-arp.exp 55./firemon-arp.exp
@@ -51,5 +57,8 @@ echo "TESTING: firemon arp (firemon-arp.exp)"
51echo "TESTING: firemon route (firemon-route.exp)" 57echo "TESTING: firemon route (firemon-route.exp)"
52./firemon-route.exp 58./firemon-route.exp
53 59
60echo "TESTING: netfilter-template (netfilter-template.exp)"
61./netfilter-template.exp
62
54sudo ip link set br0 down 63sudo ip link set br0 down
55sudo brctl delbr br0 64sudo brctl delbr br0