diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/configure | 3 | ||||
-rwxr-xr-x | test/features/2.1.exp | 18 | ||||
-rwxr-xr-x | test/features/2.6.exp | 68 | ||||
-rw-r--r-- | test/features/features.txt | 2 |
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 | |||
28 | DEFAULT_FILES="/bin/bash /bin/sh " # basic chroot files | 28 | DEFAULT_FILES="/bin/bash /bin/sh " # basic chroot files |
29 | DEFAULT_FILES+="/etc/passwd /etc/nsswitch.conf /etc/group " | 29 | DEFAULT_FILES+="/etc/passwd /etc/nsswitch.conf /etc/group " |
30 | DEFAULT_FILES+=`find /lib -name libnss*` # files required by glibc | 30 | DEFAULT_FILES+=`find /lib -name libnss*` # files required by glibc |
31 | DEFAULT_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" | 31 | DEFAULT_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 | ||
33 | rm -fr $ROOTDIR | 33 | rm -fr $ROOTDIR |
34 | mkdir -p $ROOTDIR/{root,bin,lib,lib64,usr,home,etc,dev/shm,tmp,var/run,var/tmp,var/lock,var/log,proc} | 34 | mkdir -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 | |||
40 | cp /etc/passwd $ROOTDIR/etc/. | 40 | cp /etc/passwd $ROOTDIR/etc/. |
41 | cp /etc/group $ROOTDIR/etc/. | 41 | cp /etc/group $ROOTDIR/etc/. |
42 | cp /etc/hosts $ROOTDIR/etc/. | 42 | cp /etc/hosts $ROOTDIR/etc/. |
43 | cp /etc/hostname $ROOTDIR/etc/. | ||
43 | mkdir -p $ROOTDIR/usr/lib/x86_64-linux-gnu | 44 | mkdir -p $ROOTDIR/usr/lib/x86_64-linux-gnu |
44 | cp -a /usr/lib/x86_64-linux-gnu/openssl-1.0.0 $ROOTDIR/usr/lib/x86_64-linux-gnu/. | 45 | cp -a /usr/lib/x86_64-linux-gnu/openssl-1.0.0 $ROOTDIR/usr/lib/x86_64-linux-gnu/. |
45 | cp -a /usr/lib/ssl $ROOTDIR/usr/lib/. | 46 | cp -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 | } |
25 | after 100 | 25 | after 100 |
26 | send -- "cat /etc/hostname\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 1.0\n";exit} | ||
29 | "bingo" | ||
30 | } | ||
31 | after 100 | ||
26 | send -- "getent hosts bingo\r" | 32 | send -- "getent hosts bingo\r" |
27 | expect { | 33 | expect { |
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 | } |
55 | after 100 | 61 | after 100 |
62 | send -- "cat /etc/hostname\r" | ||
63 | expect { | ||
64 | timeout {puts "TESTING ERROR 3.0\n";exit} | ||
65 | "bingo" | ||
66 | } | ||
67 | after 100 | ||
56 | send -- "getent hosts bingo\r" | 68 | send -- "getent hosts bingo\r" |
57 | expect { | 69 | expect { |
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 | } |
84 | after 100 | 96 | after 100 |
97 | send -- "cat /etc/hostname\r" | ||
98 | expect { | ||
99 | timeout {puts "TESTING ERROR 5.0\n";exit} | ||
100 | "bingo" | ||
101 | } | ||
102 | after 100 | ||
85 | send -- "getent hosts bingo\r" | 103 | send -- "getent hosts bingo\r" |
86 | expect { | 104 | expect { |
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 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | # | ||
11 | # N | ||
12 | # | ||
13 | send -- "firejail --noprofile --net=eth0 --defaultgw=192.168.1.10\r" | ||
14 | expect { | ||
15 | timeout {puts "TESTING ERROR 0\n";exit} | ||
16 | "Child process initialized" | ||
17 | } | ||
18 | sleep 1 | ||
19 | |||
20 | send -- "netstat -rn\r" | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 1\n";exit} | ||
23 | "0.0.0.0 192.168.1.10" | ||
24 | } | ||
25 | after 100 | ||
26 | send -- "exit\r" | ||
27 | sleep 1 | ||
28 | |||
29 | # | ||
30 | # O | ||
31 | # | ||
32 | send -- "firejail --noprofile --overlay --net=eth0 --defaultgw=192.168.1.10\r" | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 2\n";exit} | ||
35 | "Child process initialized" | ||
36 | } | ||
37 | sleep 1 | ||
38 | |||
39 | send -- "netstat -rn\r" | ||
40 | expect { | ||
41 | timeout {puts "TESTING ERROR 3\n";exit} | ||
42 | "0.0.0.0 192.168.1.10" | ||
43 | } | ||
44 | after 100 | ||
45 | send -- "exit\r" | ||
46 | sleep 1 | ||
47 | |||
48 | # | ||
49 | # C | ||
50 | # | ||
51 | send -- "firejail --noprofile --chroot=/tmp/chroot --net=eth0 --defaultgw=192.168.1.10\r" | ||
52 | expect { | ||
53 | timeout {puts "TESTING ERROR 4\n";exit} | ||
54 | "Child process initialized" | ||
55 | } | ||
56 | sleep 1 | ||
57 | |||
58 | send -- "netstat -rn\r" | ||
59 | expect { | ||
60 | timeout {puts "TESTING ERROR 5\n";exit} | ||
61 | "0.0.0.0 192.168.1.10" | ||
62 | } | ||
63 | after 100 | ||
64 | send -- "exit\r" | ||
65 | sleep 1 | ||
66 | |||
67 | |||
68 | puts "\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 | ||
62 | 2.5 interface | 62 | 2.5 interface |
63 | - N, O, C | ||
63 | 64 | ||
64 | 2.6 Default gw (--noprofile --net=eth0 --defaultgw=192.168.1.10, run netstat -rn) | 65 | 2.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 | ||
69 | 3. Filesystem features (use --noprofile) | 70 | 3. Filesystem features (use --noprofile) |
70 | 71 | ||
72 | 3.1 tmpfs | ||
71 | \ No newline at end of file | 73 | \ No newline at end of file |