diff options
author | netblue30 <netblue30@yahoo.com> | 2015-11-15 13:18:52 -0500 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2015-11-15 13:18:52 -0500 |
commit | 27637c0fcdf34559b37490f56142e283f1ebf0bb (patch) | |
tree | 7d97be0f26bd92174bf3507bb41bff32d62c45ff | |
parent | server testing (diff) | |
download | firejail-27637c0fcdf34559b37490f56142e283f1ebf0bb.tar.gz firejail-27637c0fcdf34559b37490f56142e283f1ebf0bb.tar.zst firejail-27637c0fcdf34559b37490f56142e283f1ebf0bb.zip |
servers testing
-rwxr-xr-x | test/servers2.exp | 42 | ||||
-rwxr-xr-x | test/servers3.exp | 42 | ||||
-rwxr-xr-x | test/servers4.exp | 46 | ||||
-rwxr-xr-x | test/servers5.exp | 1 | ||||
-rwxr-xr-x | test/test-root.sh | 6 |
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 | ||
3 | set timeout 10 | 3 | set timeout 5 |
4 | spawn $env(SHELL) | 4 | spawn $env(SHELL) |
5 | match_max 100000 | 5 | match_max 100000 |
6 | 6 | ||
@@ -10,22 +10,48 @@ expect { | |||
10 | "root" | 10 | "root" |
11 | } | 11 | } |
12 | 12 | ||
13 | send -- "firejail --net=br0 --ip=10.10.20.5--seccomp\r" | 13 | send -- "pkill snmpd\r" |
14 | sleep 2 | ||
15 | |||
16 | |||
17 | send -- "firejail --name=snmpd /etc/init.d/snmpd start\r" | ||
14 | expect { | 18 | expect { |
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 | } |
18 | sleep 2 | 22 | sleep 2 |
19 | 23 | ||
20 | send -- "/etc/init.d/snmpd start" | 24 | spawn $env(SHELL) |
25 | send -- "firejail --tree\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 2\n";exit} | ||
28 | "snmp:/usr/sbin/snmpd" | ||
29 | } | ||
21 | sleep 2 | 30 | sleep 2 |
22 | 31 | ||
23 | send -- "ps aux; pwd\r" | 32 | send -- "tail /var/log/syslog\r" |
24 | expect { | 33 | expect { |
25 | timeout {puts "TESTING ERROR 1\n";exit} | 34 | timeout {puts "TESTING ERROR 3\n";exit} |
26 | "snmpd" | 35 | "snmpd" |
27 | } | 36 | } |
37 | expect { | ||
38 | timeout {puts "TESTING ERROR 4\n";exit} | ||
39 | "NET-SNMP version" | ||
40 | } | ||
28 | 41 | ||
29 | send -- "exit\r" | 42 | send -- "firejail --join=snmpd\r" |
30 | sleep 1 | 43 | sleep 2 |
31 | puts "\n" | 44 | |
45 | send -- "ls /dev\r" | ||
46 | expect { | ||
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 | } | ||
54 | sleep 2 | ||
55 | |||
56 | sleep 2 | ||
57 | puts "\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 | ||
3 | set timeout 10 | 3 | set timeout 5 |
4 | spawn $env(SHELL) | 4 | spawn $env(SHELL) |
5 | match_max 100000 | 5 | match_max 100000 |
6 | 6 | ||
@@ -10,37 +10,59 @@ expect { | |||
10 | "root" | 10 | "root" |
11 | } | 11 | } |
12 | 12 | ||
13 | send -- "firejail --net=br0 --ip=10.10.20.5 --seccomp\r" | 13 | send -- "pkill apache\r" |
14 | sleep 2 | ||
15 | |||
16 | |||
17 | send -- "firejail --name=apache /etc/init.d/apache2 start\r" | ||
14 | expect { | 18 | expect { |
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 | } |
18 | sleep 2 | 22 | sleep 2 |
19 | 23 | ||
20 | send -- "/etc/init.d/apache2 start\r" | ||
21 | sleep 2 | ||
22 | 24 | ||
23 | send -- "ps aux; pwd\r" | 25 | spawn $env(SHELL) |
26 | send -- "firejail --tree\r" | ||
24 | expect { | 27 | expect { |
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 | } |
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 2\n";exit} | ||
33 | "www-data:/usr/sbin/apache2" | ||
34 | } | ||
35 | sleep 2 | ||
36 | |||
28 | 37 | ||
29 | send -- "rm index.html\r" | 38 | send -- "rm index.html\r" |
30 | sleep 1 | 39 | sleep 1 |
31 | send -- "wget 0\r" | 40 | send -- "wget 0\r" |
32 | expect { | 41 | expect { |
33 | timeout {puts "TESTING ERROR 2\n";exit} | 42 | timeout {puts "TESTING ERROR 3\n";exit} |
34 | "saved" | 43 | "saved" |
35 | } | 44 | } |
36 | send -- "cat index.html\r" | 45 | send -- "cat index.html\r" |
37 | expect { | 46 | expect { |
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 | ||
51 | sleep 1 | ||
52 | send -- "rm index.html\r" | ||
53 | |||
54 | send -- "firejail --join=apache\r" | ||
55 | sleep 2 | ||
42 | 56 | ||
57 | send -- "ls /dev\r" | ||
58 | expect { | ||
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 | } | ||
66 | sleep 2 | ||
43 | 67 | ||
44 | send -- "exit\r" | ||
45 | sleep 1 | ||
46 | puts "\nall done\n" | 68 | puts "\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 | ||
3 | set timeout 10 | 3 | set timeout 5 |
4 | spawn $env(SHELL) | 4 | spawn $env(SHELL) |
5 | match_max 100000 | 5 | match_max 100000 |
6 | 6 | ||
@@ -10,23 +10,49 @@ expect { | |||
10 | "root" | 10 | "root" |
11 | } | 11 | } |
12 | 12 | ||
13 | send -- "firejail --net=br0 --ip=10.10.20.5 --seccomp\r" | 13 | send -- "pkill dhcpd\r" |
14 | sleep 2 | ||
15 | |||
16 | send -- "firejail --name=dhcpd /etc/init.d/isc-dhcp-server start\r" | ||
14 | expect { | 17 | expect { |
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 | } |
18 | sleep 2 | 21 | sleep 2 |
19 | 22 | ||
20 | send -- "/etc/init.d/isc-dhcp-server start\r" | 23 | spawn $env(SHELL) |
21 | sleep 5 | 24 | send -- "firejail --tree\r" |
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 2\n";exit} | ||
27 | "root:/usr/sbin/dhcpd" | ||
28 | } | ||
29 | sleep 2 | ||
30 | |||
31 | send -- "tail -n 200 /var/log/syslog\r" | ||
32 | expect { | ||
33 | timeout {puts "TESTING ERROR 3\n";exit} | ||
34 | "Internet Systems Consortium DHCP Server" | ||
35 | } | ||
36 | expect { | ||
37 | timeout {puts "TESTING ERROR 4\n";exit} | ||
38 | "Wrote 0 leases to leases file" | ||
39 | } | ||
40 | sleep 2 | ||
22 | 41 | ||
42 | send -- "firejail --join=dhcpd\r" | ||
43 | sleep 2 | ||
23 | 44 | ||
24 | send -- "ps aux; pwd\r" | 45 | send -- "ls /dev\r" |
25 | expect { | 46 | expect { |
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 | } |
54 | sleep 2 | ||
55 | |||
56 | |||
57 | puts "\nall done\n" | ||
29 | 58 | ||
30 | send -- "exit\r" | ||
31 | sleep 1 | ||
32 | puts "\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 | } |
53 | sleep 2 | 54 | sleep 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 | ||
14 | if [ -f /etc/init.d/snmpd ] | 14 | if [ -f /etc/init.d/snmpd ] |
15 | then | 15 | then |
16 | echo "TESTING: servers snmpd" | 16 | echo "TESTING: servers snmpd, private-dev" |
17 | ./servers2.exp | 17 | ./servers2.exp |
18 | fi | 18 | fi |
19 | 19 | ||
20 | if [ -f /etc/init.d/apache2 ] | 20 | if [ -f /etc/init.d/apache2 ] |
21 | then | 21 | then |
22 | echo "TESTING: servers apache2" | 22 | echo "TESTING: servers apache2, private-dev" |
23 | ./servers3.exp | 23 | ./servers3.exp |
24 | fi | 24 | fi |
25 | 25 | ||
26 | if [ -f /etc/init.d/isc-dhcp-server ] | 26 | if [ -f /etc/init.d/isc-dhcp-server ] |
27 | then | 27 | then |
28 | echo "TESTING: servers isc dhcp server" | 28 | echo "TESTING: servers isc dhcp server, private-dev" |
29 | ./servers4.exp | 29 | ./servers4.exp |
30 | fi | 30 | fi |
31 | 31 | ||