aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2015-11-15 13:18:52 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2015-11-15 13:18:52 -0500
commit27637c0fcdf34559b37490f56142e283f1ebf0bb (patch)
tree7d97be0f26bd92174bf3507bb41bff32d62c45ff /test
parentserver testing (diff)
downloadfirejail-27637c0fcdf34559b37490f56142e283f1ebf0bb.tar.gz
firejail-27637c0fcdf34559b37490f56142e283f1ebf0bb.tar.zst
firejail-27637c0fcdf34559b37490f56142e283f1ebf0bb.zip
servers testing
Diffstat (limited to 'test')
-rwxr-xr-xtest/servers2.exp42
-rwxr-xr-xtest/servers3.exp42
-rwxr-xr-xtest/servers4.exp46
-rwxr-xr-xtest/servers5.exp1
-rwxr-xr-xtest/test-root.sh6
5 files changed, 106 insertions, 31 deletions
diff --git a/test/servers2.exp b/test/servers2.exp
index 28bcae207..90e34470f 100755
--- a/test/servers2.exp
+++ b/test/servers2.exp
@@ -1,6 +1,6 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2 2
3set timeout 10 3set timeout 5
4spawn $env(SHELL) 4spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
@@ -10,22 +10,48 @@ expect {
10 "root" 10 "root"
11} 11}
12 12
13send -- "firejail --net=br0 --ip=10.10.20.5--seccomp\r" 13send -- "pkill snmpd\r"
14sleep 2
15
16
17send -- "firejail --name=snmpd /etc/init.d/snmpd start\r"
14expect { 18expect {
15 timeout {puts "TESTING ERROR 0\n";exit} 19 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized" 20 "Child process initialized"
17} 21}
18sleep 2 22sleep 2
19 23
20send -- "/etc/init.d/snmpd start" 24spawn $env(SHELL)
25send -- "firejail --tree\r"
26expect {
27 timeout {puts "TESTING ERROR 2\n";exit}
28 "snmp:/usr/sbin/snmpd"
29}
21sleep 2 30sleep 2
22 31
23send -- "ps aux; pwd\r" 32send -- "tail /var/log/syslog\r"
24expect { 33expect {
25 timeout {puts "TESTING ERROR 1\n";exit} 34 timeout {puts "TESTING ERROR 3\n";exit}
26 "snmpd" 35 "snmpd"
27} 36}
37expect {
38 timeout {puts "TESTING ERROR 4\n";exit}
39 "NET-SNMP version"
40}
28 41
29send -- "exit\r" 42send -- "firejail --join=snmpd\r"
30sleep 1 43sleep 2
31puts "\n" 44
45send -- "ls /dev\r"
46expect {
47 timeout {puts "TESTING ERROR 5\n";exit}
48 "tty0" {puts "TESTING ERROR 6\n";exit}
49 "ttyS0" {puts "TESTING ERROR 6\n";exit}
50 "audio" {puts "TESTING ERROR 6\n";exit}
51 "ppp" {puts "TESTING ERROR 6\n";exit}
52 "log"
53}
54sleep 2
55
56sleep 2
57puts "\nall done\n"
diff --git a/test/servers3.exp b/test/servers3.exp
index da44a28ee..20a20a88d 100755
--- a/test/servers3.exp
+++ b/test/servers3.exp
@@ -1,6 +1,6 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2 2
3set timeout 10 3set timeout 5
4spawn $env(SHELL) 4spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
@@ -10,37 +10,59 @@ expect {
10 "root" 10 "root"
11} 11}
12 12
13send -- "firejail --net=br0 --ip=10.10.20.5 --seccomp\r" 13send -- "pkill apache\r"
14sleep 2
15
16
17send -- "firejail --name=apache /etc/init.d/apache2 start\r"
14expect { 18expect {
15 timeout {puts "TESTING ERROR 0\n";exit} 19 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized" 20 "Child process initialized"
17} 21}
18sleep 2 22sleep 2
19 23
20send -- "/etc/init.d/apache2 start\r"
21sleep 2
22 24
23send -- "ps aux; pwd\r" 25spawn $env(SHELL)
26send -- "firejail --tree\r"
24expect { 27expect {
25 timeout {puts "TESTING ERROR 1\n";exit} 28 timeout {puts "TESTING ERROR 1\n";exit}
26 "apache" 29 "root:/usr/sbin/apache2"
27} 30}
31expect {
32 timeout {puts "TESTING ERROR 2\n";exit}
33 "www-data:/usr/sbin/apache2"
34}
35sleep 2
36
28 37
29send -- "rm index.html\r" 38send -- "rm index.html\r"
30sleep 1 39sleep 1
31send -- "wget 0\r" 40send -- "wget 0\r"
32expect { 41expect {
33 timeout {puts "TESTING ERROR 2\n";exit} 42 timeout {puts "TESTING ERROR 3\n";exit}
34 "saved" 43 "saved"
35} 44}
36send -- "cat index.html\r" 45send -- "cat index.html\r"
37expect { 46expect {
38 timeout {puts "TESTING ERROR 3\n";exit} 47 timeout {puts "TESTING ERROR 4\n";exit}
39 "This is the default web page for this server" 48 "This is the default web page for this server"
40} 49}
41 50
51sleep 1
52send -- "rm index.html\r"
53
54send -- "firejail --join=apache\r"
55sleep 2
42 56
57send -- "ls /dev\r"
58expect {
59 timeout {puts "TESTING ERROR 5\n";exit}
60 "tty0" {puts "TESTING ERROR 6\n";exit}
61 "ttyS0" {puts "TESTING ERROR 6\n";exit}
62 "audio" {puts "TESTING ERROR 6\n";exit}
63 "ppp" {puts "TESTING ERROR 6\n";exit}
64 "log"
65}
66sleep 2
43 67
44send -- "exit\r"
45sleep 1
46puts "\nall done\n" 68puts "\nall done\n"
diff --git a/test/servers4.exp b/test/servers4.exp
index 9feeecf61..86500707a 100755
--- a/test/servers4.exp
+++ b/test/servers4.exp
@@ -1,6 +1,6 @@
1#!/usr/bin/expect -f 1#!/usr/bin/expect -f
2 2
3set timeout 10 3set timeout 5
4spawn $env(SHELL) 4spawn $env(SHELL)
5match_max 100000 5match_max 100000
6 6
@@ -10,23 +10,49 @@ expect {
10 "root" 10 "root"
11} 11}
12 12
13send -- "firejail --net=br0 --ip=10.10.20.5 --seccomp\r" 13send -- "pkill dhcpd\r"
14sleep 2
15
16send -- "firejail --name=dhcpd /etc/init.d/isc-dhcp-server start\r"
14expect { 17expect {
15 timeout {puts "TESTING ERROR 0\n";exit} 18 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized" 19 "Child process initialized"
17} 20}
18sleep 2 21sleep 2
19 22
20send -- "/etc/init.d/isc-dhcp-server start\r" 23spawn $env(SHELL)
21sleep 5 24send -- "firejail --tree\r"
25expect {
26 timeout {puts "TESTING ERROR 2\n";exit}
27 "root:/usr/sbin/dhcpd"
28}
29sleep 2
30
31send -- "tail -n 200 /var/log/syslog\r"
32expect {
33 timeout {puts "TESTING ERROR 3\n";exit}
34 "Internet Systems Consortium DHCP Server"
35}
36expect {
37 timeout {puts "TESTING ERROR 4\n";exit}
38 "Wrote 0 leases to leases file"
39}
40sleep 2
22 41
42send -- "firejail --join=dhcpd\r"
43sleep 2
23 44
24send -- "ps aux; pwd\r" 45send -- "ls /dev\r"
25expect { 46expect {
26 timeout {puts "TESTING ERROR 1\n";exit} 47 timeout {puts "TESTING ERROR 5\n";exit}
27 "dhcpd" 48 "tty0" {puts "TESTING ERROR 6\n";exit}
49 "ttyS0" {puts "TESTING ERROR 6\n";exit}
50 "ppp" {puts "TESTING ERROR 6\n";exit}
51 "audio" {puts "TESTING ERROR 6\n";exit}
52 "log"
28} 53}
54sleep 2
55
56
57puts "\nall done\n"
29 58
30send -- "exit\r"
31sleep 1
32puts "\n"
diff --git a/test/servers5.exp b/test/servers5.exp
index 68c986cbb..193e662ff 100755
--- a/test/servers5.exp
+++ b/test/servers5.exp
@@ -48,6 +48,7 @@ expect {
48 "tty0" {puts "TESTING ERROR 6\n";exit} 48 "tty0" {puts "TESTING ERROR 6\n";exit}
49 "ttyS0" {puts "TESTING ERROR 6\n";exit} 49 "ttyS0" {puts "TESTING ERROR 6\n";exit}
50 "audio" {puts "TESTING ERROR 6\n";exit} 50 "audio" {puts "TESTING ERROR 6\n";exit}
51 "ppp" {puts "TESTING ERROR 6\n";exit}
51 "log" 52 "log"
52} 53}
53sleep 2 54sleep 2
diff --git a/test/test-root.sh b/test/test-root.sh
index 69a594e85..43bf84bfe 100755
--- a/test/test-root.sh
+++ b/test/test-root.sh
@@ -13,19 +13,19 @@ echo "TESTING: servers rsyslogd, sshd, nginx"
13 13
14if [ -f /etc/init.d/snmpd ] 14if [ -f /etc/init.d/snmpd ]
15then 15then
16 echo "TESTING: servers snmpd" 16 echo "TESTING: servers snmpd, private-dev"
17 ./servers2.exp 17 ./servers2.exp
18fi 18fi
19 19
20if [ -f /etc/init.d/apache2 ] 20if [ -f /etc/init.d/apache2 ]
21then 21then
22 echo "TESTING: servers apache2" 22 echo "TESTING: servers apache2, private-dev"
23 ./servers3.exp 23 ./servers3.exp
24fi 24fi
25 25
26if [ -f /etc/init.d/isc-dhcp-server ] 26if [ -f /etc/init.d/isc-dhcp-server ]
27then 27then
28 echo "TESTING: servers isc dhcp server" 28 echo "TESTING: servers isc dhcp server, private-dev"
29 ./servers4.exp 29 ./servers4.exp
30fi 30fi
31 31