aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xtest/configure3
-rwxr-xr-xtest/features/2.1.exp18
-rwxr-xr-xtest/features/2.6.exp68
-rw-r--r--test/features/features.txt2
4 files changed, 90 insertions, 1 deletions
diff --git a/test/configure b/test/configure
index 2827582f3..73c808020 100755
--- a/test/configure
+++ b/test/configure
@@ -28,7 +28,7 @@ ROOTDIR="/tmp/chroot" # default chroot directory
28DEFAULT_FILES="/bin/bash /bin/sh " # basic chroot files 28DEFAULT_FILES="/bin/bash /bin/sh " # basic chroot files
29DEFAULT_FILES+="/etc/passwd /etc/nsswitch.conf /etc/group " 29DEFAULT_FILES+="/etc/passwd /etc/nsswitch.conf /etc/group "
30DEFAULT_FILES+=`find /lib -name libnss*` # files required by glibc 30DEFAULT_FILES+=`find /lib -name libnss*` # files required by glibc
31DEFAULT_FILES+=" /bin/cp /bin/ls /bin/cat /bin/ps /bin/ping /sbin/ifconfig /bin/hostname /bin/grep /usr/bin/dig /usr/bin/openssl /usr/bin/id /usr/bin/getent /usr/bin/whoami /usr/bin/wc /usr/bin/wget /bin/umount" 31DEFAULT_FILES+=" /bin/cp /bin/ls /bin/cat /bin/ps /bin/netstat /bin/ping /sbin/ifconfig /bin/hostname /bin/grep /usr/bin/dig /usr/bin/openssl /usr/bin/id /usr/bin/getent /usr/bin/whoami /usr/bin/wc /usr/bin/wget /bin/umount"
32 32
33rm -fr $ROOTDIR 33rm -fr $ROOTDIR
34mkdir -p $ROOTDIR/{root,bin,lib,lib64,usr,home,etc,dev/shm,tmp,var/run,var/tmp,var/lock,var/log,proc} 34mkdir -p $ROOTDIR/{root,bin,lib,lib64,usr,home,etc,dev/shm,tmp,var/run,var/tmp,var/lock,var/log,proc}
@@ -40,6 +40,7 @@ mkdir $ROOTDIR/selinux
40cp /etc/passwd $ROOTDIR/etc/. 40cp /etc/passwd $ROOTDIR/etc/.
41cp /etc/group $ROOTDIR/etc/. 41cp /etc/group $ROOTDIR/etc/.
42cp /etc/hosts $ROOTDIR/etc/. 42cp /etc/hosts $ROOTDIR/etc/.
43cp /etc/hostname $ROOTDIR/etc/.
43mkdir -p $ROOTDIR/usr/lib/x86_64-linux-gnu 44mkdir -p $ROOTDIR/usr/lib/x86_64-linux-gnu
44cp -a /usr/lib/x86_64-linux-gnu/openssl-1.0.0 $ROOTDIR/usr/lib/x86_64-linux-gnu/. 45cp -a /usr/lib/x86_64-linux-gnu/openssl-1.0.0 $ROOTDIR/usr/lib/x86_64-linux-gnu/.
45cp -a /usr/lib/ssl $ROOTDIR/usr/lib/. 46cp -a /usr/lib/ssl $ROOTDIR/usr/lib/.
diff --git a/test/features/2.1.exp b/test/features/2.1.exp
index 6b2b3f7f5..a2ae321ce 100755
--- a/test/features/2.1.exp
+++ b/test/features/2.1.exp
@@ -23,6 +23,12 @@ expect {
23 "bingo" 23 "bingo"
24} 24}
25after 100 25after 100
26send -- "cat /etc/hostname\r"
27expect {
28 timeout {puts "TESTING ERROR 1.0\n";exit}
29 "bingo"
30}
31after 100
26send -- "getent hosts bingo\r" 32send -- "getent hosts bingo\r"
27expect { 33expect {
28 timeout {puts "TESTING ERROR 1.1\n";exit} 34 timeout {puts "TESTING ERROR 1.1\n";exit}
@@ -53,6 +59,12 @@ expect {
53 "bingo" 59 "bingo"
54} 60}
55after 100 61after 100
62send -- "cat /etc/hostname\r"
63expect {
64 timeout {puts "TESTING ERROR 3.0\n";exit}
65 "bingo"
66}
67after 100
56send -- "getent hosts bingo\r" 68send -- "getent hosts bingo\r"
57expect { 69expect {
58 timeout {puts "TESTING ERROR 3.1\n";exit} 70 timeout {puts "TESTING ERROR 3.1\n";exit}
@@ -82,6 +94,12 @@ expect {
82 "bingo" 94 "bingo"
83} 95}
84after 100 96after 100
97send -- "cat /etc/hostname\r"
98expect {
99 timeout {puts "TESTING ERROR 5.0\n";exit}
100 "bingo"
101}
102after 100
85send -- "getent hosts bingo\r" 103send -- "getent hosts bingo\r"
86expect { 104expect {
87 timeout {puts "TESTING ERROR 5.1\n";exit} 105 timeout {puts "TESTING ERROR 5.1\n";exit}
diff --git a/test/features/2.6.exp b/test/features/2.6.exp
new file mode 100755
index 000000000..dc2381393
--- /dev/null
+++ b/test/features/2.6.exp
@@ -0,0 +1,68 @@
1#!/usr/bin/expect -f
2#
3# default gateway
4#
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10#
11# N
12#
13send -- "firejail --noprofile --net=eth0 --defaultgw=192.168.1.10\r"
14expect {
15 timeout {puts "TESTING ERROR 0\n";exit}
16 "Child process initialized"
17}
18sleep 1
19
20send -- "netstat -rn\r"
21expect {
22 timeout {puts "TESTING ERROR 1\n";exit}
23 "0.0.0.0 192.168.1.10"
24}
25after 100
26send -- "exit\r"
27sleep 1
28
29#
30# O
31#
32send -- "firejail --noprofile --overlay --net=eth0 --defaultgw=192.168.1.10\r"
33expect {
34 timeout {puts "TESTING ERROR 2\n";exit}
35 "Child process initialized"
36}
37sleep 1
38
39send -- "netstat -rn\r"
40expect {
41 timeout {puts "TESTING ERROR 3\n";exit}
42 "0.0.0.0 192.168.1.10"
43}
44after 100
45send -- "exit\r"
46sleep 1
47
48#
49# C
50#
51send -- "firejail --noprofile --chroot=/tmp/chroot --net=eth0 --defaultgw=192.168.1.10\r"
52expect {
53 timeout {puts "TESTING ERROR 4\n";exit}
54 "Child process initialized"
55}
56sleep 1
57
58send -- "netstat -rn\r"
59expect {
60 timeout {puts "TESTING ERROR 5\n";exit}
61 "0.0.0.0 192.168.1.10"
62}
63after 100
64send -- "exit\r"
65sleep 1
66
67
68puts "\nall done\n"
diff --git a/test/features/features.txt b/test/features/features.txt
index 9ac7b944e..95e8cc5a0 100644
--- a/test/features/features.txt
+++ b/test/features/features.txt
@@ -60,6 +60,7 @@ C - chroot filesystem
60 - test --ip: N, O, C 60 - test --ip: N, O, C
61 61
622.5 interface 622.5 interface
63 - N, O, C
63 64
642.6 Default gw (--noprofile --net=eth0 --defaultgw=192.168.1.10, run netstat -rn) 652.6 Default gw (--noprofile --net=eth0 --defaultgw=192.168.1.10, run netstat -rn)
65 - N, O, C 66 - N, O, C
@@ -68,4 +69,5 @@ C - chroot filesystem
68 69
693. Filesystem features (use --noprofile) 703. Filesystem features (use --noprofile)
70 71
723.1 tmpfs
71 \ No newline at end of file 73 \ No newline at end of file