diff options
author | netblue30 <netblue30@yahoo.com> | 2015-11-24 11:47:38 -0500 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2015-11-24 11:47:38 -0500 |
commit | 0df2fd2efce584ff9430cb2e523136b75df92c20 (patch) | |
tree | 5e7e8fadd1be89f31c299a77d7cbf0f63ebc755d /test | |
parent | feature testing (diff) | |
download | firejail-0df2fd2efce584ff9430cb2e523136b75df92c20.tar.gz firejail-0df2fd2efce584ff9430cb2e523136b75df92c20.tar.zst firejail-0df2fd2efce584ff9430cb2e523136b75df92c20.zip |
feature testing
Diffstat (limited to 'test')
-rwxr-xr-x | test/configure | 2 | ||||
-rwxr-xr-x | test/features/2.3.exp | 10 | ||||
-rwxr-xr-x | test/features/3.2.exp | 2 | ||||
-rwxr-xr-x | test/features/3.3.exp | 69 | ||||
-rwxr-xr-x | test/features/3.4.exp | 69 | ||||
-rw-r--r-- | test/features/features.txt | 3 | ||||
-rwxr-xr-x | test/features/test.sh | 16 |
7 files changed, 164 insertions, 7 deletions
diff --git a/test/configure b/test/configure index 67122cfe1..c7fd66cfb 100755 --- a/test/configure +++ b/test/configure | |||
@@ -36,6 +36,8 @@ mkdir -p $ROOTDIR/etc/firejail | |||
36 | mkdir -p $ROOTDIR/home/netblue/.config/firejail | 36 | mkdir -p $ROOTDIR/home/netblue/.config/firejail |
37 | chown netblue:netblue $ROOTDIR/home/netblue | 37 | chown netblue:netblue $ROOTDIR/home/netblue |
38 | chown netblue:netblue $ROOTDIR/home/netblue/.config | 38 | chown netblue:netblue $ROOTDIR/home/netblue/.config |
39 | cp /home/netblue/.Xauthority $ROOTDIR/home/netblue/. | ||
40 | cp -a /etc/skel $ROOTDIR/etc/. | ||
39 | mkdir $ROOTDIR/home/someotheruser | 41 | mkdir $ROOTDIR/home/someotheruser |
40 | mkdir $ROOTDIR/boot | 42 | mkdir $ROOTDIR/boot |
41 | mkdir $ROOTDIR/selinux | 43 | mkdir $ROOTDIR/selinux |
diff --git a/test/features/2.3.exp b/test/features/2.3.exp index a70005781..c519c72ad 100755 --- a/test/features/2.3.exp +++ b/test/features/2.3.exp | |||
@@ -56,7 +56,7 @@ expect { | |||
56 | after 100 | 56 | after 100 |
57 | 57 | ||
58 | send -- "exit\r" | 58 | send -- "exit\r" |
59 | sleep 1 | 59 | sleep 3 |
60 | 60 | ||
61 | send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244\r" | 61 | send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244\r" |
62 | expect { | 62 | expect { |
@@ -104,7 +104,7 @@ expect { | |||
104 | after 100 | 104 | after 100 |
105 | 105 | ||
106 | send -- "exit\r" | 106 | send -- "exit\r" |
107 | sleep 1 | 107 | sleep 3 |
108 | 108 | ||
109 | # | 109 | # |
110 | # O | 110 | # O |
@@ -155,7 +155,7 @@ expect { | |||
155 | after 100 | 155 | after 100 |
156 | 156 | ||
157 | send -- "exit\r" | 157 | send -- "exit\r" |
158 | sleep 1 | 158 | sleep 3 |
159 | 159 | ||
160 | send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --overlay\r" | 160 | send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --overlay\r" |
161 | expect { | 161 | expect { |
@@ -203,7 +203,7 @@ expect { | |||
203 | after 100 | 203 | after 100 |
204 | 204 | ||
205 | send -- "exit\r" | 205 | send -- "exit\r" |
206 | sleep 1 | 206 | sleep 3 |
207 | 207 | ||
208 | 208 | ||
209 | # | 209 | # |
@@ -255,7 +255,7 @@ expect { | |||
255 | after 100 | 255 | after 100 |
256 | 256 | ||
257 | send -- "exit\r" | 257 | send -- "exit\r" |
258 | sleep 1 | 258 | sleep 3 |
259 | 259 | ||
260 | send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --chroot=/tmp/chroot\r" | 260 | send -- "firejail --noprofile --net=eth0 --ip=192.168.1.244 --chroot=/tmp/chroot\r" |
261 | expect { | 261 | expect { |
diff --git a/test/features/3.2.exp b/test/features/3.2.exp index f6ed01310..44d9b73f3 100755 --- a/test/features/3.2.exp +++ b/test/features/3.2.exp | |||
@@ -1,6 +1,6 @@ | |||
1 | #!/usr/bin/expect -f | 1 | #!/usr/bin/expect -f |
2 | # | 2 | # |
3 | # disable /boot | 3 | # read-only |
4 | # | 4 | # |
5 | 5 | ||
6 | set timeout 10 | 6 | set timeout 10 |
diff --git a/test/features/3.3.exp b/test/features/3.3.exp new file mode 100755 index 000000000..432a135d7 --- /dev/null +++ b/test/features/3.3.exp | |||
@@ -0,0 +1,69 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # | ||
3 | # blacklist | ||
4 | # | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | # | ||
11 | # N | ||
12 | # | ||
13 | send -- "firejail --noprofile --blacklist=/home/netblue/.config\r" | ||
14 | expect { | ||
15 | timeout {puts "TESTING ERROR 0\n";exit} | ||
16 | "Child process initialized" | ||
17 | } | ||
18 | sleep 1 | ||
19 | |||
20 | send -- "cd ~/.config\r" | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 1\n";exit} | ||
23 | "Permission denied" | ||
24 | } | ||
25 | after 100 | ||
26 | send -- "exit\r" | ||
27 | sleep 1 | ||
28 | |||
29 | |||
30 | # | ||
31 | # O | ||
32 | # | ||
33 | send -- "firejail --noprofile --overlay --blacklist=/home/netblue/.config\r" | ||
34 | expect { | ||
35 | timeout {puts "TESTING ERROR 2\n";exit} | ||
36 | "Child process initialized" | ||
37 | } | ||
38 | sleep 1 | ||
39 | |||
40 | send -- "cd ~/.config\r" | ||
41 | expect { | ||
42 | timeout {puts "TESTING ERROR 3\n";exit} | ||
43 | "Permission denied" | ||
44 | } | ||
45 | after 100 | ||
46 | send -- "exit\r" | ||
47 | sleep 1 | ||
48 | |||
49 | # | ||
50 | # C | ||
51 | # | ||
52 | send -- "firejail --noprofile --chroot=/tmp/chroot --blacklist=/home/netblue/.config\r" | ||
53 | expect { | ||
54 | timeout {puts "TESTING ERROR 4\n";exit} | ||
55 | "Child process initialized" | ||
56 | } | ||
57 | sleep 1 | ||
58 | |||
59 | send -- "cd ~/.config\r" | ||
60 | expect { | ||
61 | timeout {puts "TESTING ERROR 5\n";exit} | ||
62 | "Permission denied" | ||
63 | } | ||
64 | after 100 | ||
65 | send -- "exit\r" | ||
66 | sleep 1 | ||
67 | |||
68 | |||
69 | puts "\nall done\n" | ||
diff --git a/test/features/3.4.exp b/test/features/3.4.exp new file mode 100755 index 000000000..bc6e10733 --- /dev/null +++ b/test/features/3.4.exp | |||
@@ -0,0 +1,69 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # | ||
3 | # whitelist | ||
4 | # | ||
5 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | # | ||
11 | # N | ||
12 | # | ||
13 | send -- "firejail --noprofile --whitelist=/home/netblue/.config\r" | ||
14 | expect { | ||
15 | timeout {puts "TESTING ERROR 0\n";exit} | ||
16 | "Child process initialized" | ||
17 | } | ||
18 | sleep 1 | ||
19 | |||
20 | send -- "ls -al ~/. | wc -l\r" | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 1\n";exit} | ||
23 | "6" | ||
24 | } | ||
25 | after 100 | ||
26 | send -- "exit\r" | ||
27 | sleep 1 | ||
28 | |||
29 | |||
30 | # | ||
31 | # O | ||
32 | # | ||
33 | send -- "firejail --noprofile --overlay --whitelist=/home/netblue/.config\r" | ||
34 | expect { | ||
35 | timeout {puts "TESTING ERROR 2\n";exit} | ||
36 | "Child process initialized" | ||
37 | } | ||
38 | sleep 1 | ||
39 | |||
40 | send -- "ls -al ~/. | wc -l\r" | ||
41 | expect { | ||
42 | timeout {puts "TESTING ERROR 1\n";exit} | ||
43 | "6" | ||
44 | } | ||
45 | after 100 | ||
46 | send -- "exit\r" | ||
47 | sleep 1 | ||
48 | |||
49 | # | ||
50 | # C | ||
51 | # | ||
52 | send -- "firejail --noprofile --chroot=/tmp/chroot --whitelist=/home/netblue/.config\r" | ||
53 | expect { | ||
54 | timeout {puts "TESTING ERROR 4\n";exit} | ||
55 | "Child process initialized" | ||
56 | } | ||
57 | sleep 1 | ||
58 | |||
59 | send -- "ls -al ~/. | wc -l\r" | ||
60 | expect { | ||
61 | timeout {puts "TESTING ERROR 1\n";exit} | ||
62 | "6" | ||
63 | } | ||
64 | after 100 | ||
65 | send -- "exit\r" | ||
66 | sleep 1 | ||
67 | |||
68 | |||
69 | puts "\nall done\n" | ||
diff --git a/test/features/features.txt b/test/features/features.txt index 492843adc..d372d2f7a 100644 --- a/test/features/features.txt +++ b/test/features/features.txt | |||
@@ -71,4 +71,5 @@ C - chroot filesystem | |||
71 | 71 | ||
72 | 3.1 tmpfs | 72 | 3.1 tmpfs |
73 | 3.2 read-only | 73 | 3.2 read-only |
74 | \ No newline at end of file | 74 | 3.3 blacklist |
75 | 3.4 whitelist | ||
diff --git a/test/features/test.sh b/test/features/test.sh index 8047bbd0c..e49dfc3f0 100755 --- a/test/features/test.sh +++ b/test/features/test.sh | |||
@@ -44,3 +44,19 @@ echo "TESTING: 2.4 bridge" | |||
44 | 44 | ||
45 | echo "TESTING: 2.5 interface" | 45 | echo "TESTING: 2.5 interface" |
46 | ./2.5.exp | 46 | ./2.5.exp |
47 | |||
48 | echo "TESTING: 2.6 Default gateway" | ||
49 | ./2.6.exp | ||
50 | |||
51 | echo "TESTING: 3.1 tmpfs" | ||
52 | ./3.1.exp | ||
53 | |||
54 | echo "TESTING: 3.2 read-only" | ||
55 | ./3.2.exp | ||
56 | |||
57 | echo "TESTING: 3.3 blacklist" | ||
58 | ./3.3.exp | ||
59 | |||
60 | echo "TESTING: 3.4 whitelist" | ||
61 | ./3.4.exp | ||
62 | |||