diff options
Diffstat (limited to 'test')
-rwxr-xr-x | test/extract_command.exp | 16 | ||||
-rwxr-xr-x | test/invalid_filename.exp | 236 | ||||
-rwxr-xr-x | test/private.exp | 2 | ||||
-rwxr-xr-x | test/profile_apps.exp | 48 | ||||
-rwxr-xr-x | test/test.sh | 6 |
5 files changed, 250 insertions, 58 deletions
diff --git a/test/extract_command.exp b/test/extract_command.exp index c49614b84..b4a1eeeb5 100755 --- a/test/extract_command.exp +++ b/test/extract_command.exp | |||
@@ -4,20 +4,24 @@ set timeout 10 | |||
4 | spawn $env(SHELL) | 4 | spawn $env(SHELL) |
5 | match_max 100000 | 5 | match_max 100000 |
6 | 6 | ||
7 | send -- "firejail --debug /usr/bin/firefox www.gentoo.org\r" | 7 | send -- "firejail --debug ls -al\r" |
8 | expect { | 8 | expect { |
9 | timeout {puts "TESTING ERROR 0\n";exit} | 9 | timeout {puts "TESTING ERROR 0\n";exit} |
10 | "Reading profile /etc/firejail/firefox.profile" | 10 | "Reading profile /etc/firejail/generic.profile" |
11 | } | 11 | } |
12 | expect { | 12 | expect { |
13 | timeout {puts "TESTING ERROR 1\n";exit} | 13 | timeout {puts "TESTING ERROR 1\n";exit} |
14 | "Starting /usr/bin/firefox" | 14 | "Starting ls -al" |
15 | } | 15 | } |
16 | expect { | 16 | expect { |
17 | timeout {puts "TESTING ERROR 1\n";exit} | 17 | timeout {puts "TESTING ERROR 2\n";exit} |
18 | "Child process initialized" | 18 | "Child process initialized" |
19 | } | 19 | } |
20 | sleep 5 | 20 | expect { |
21 | timeout {puts "TESTING ERROR 2\n";exit} | ||
22 | "parent is shutting down, bye" | ||
23 | } | ||
24 | sleep 1 | ||
21 | 25 | ||
22 | puts "\n" | 26 | puts "\nall done\n" |
23 | 27 | ||
diff --git a/test/invalid_filename.exp b/test/invalid_filename.exp new file mode 100755 index 000000000..ca35262f8 --- /dev/null +++ b/test/invalid_filename.exp | |||
@@ -0,0 +1,236 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | #invalid_filename checks: | ||
4 | # | ||
5 | #--bind (two files) - profile.c - Note: The test is not implemented here, need to be root to test it | ||
6 | #--blacklist - profile.c | ||
7 | #--cgroup - cgroup.c | ||
8 | #--chroot - main.c | ||
9 | #--netfilter - netfilter.c | ||
10 | #--output - output.c | ||
11 | #--private - fs_home.c | ||
12 | #--privte-bin (list) - fs_bin.c | ||
13 | #--private-keep/--private-home (list) - fs_home.c | ||
14 | #--private-etc (list) - fs_etc.c | ||
15 | #--profile - main.c | ||
16 | #--read_only - profile.c | ||
17 | #--shell - main.c | ||
18 | #--tmpfs - profile.c | ||
19 | #--white-list | ||
20 | |||
21 | |||
22 | set timeout 10 | ||
23 | spawn $env(SHELL) | ||
24 | match_max 100000 | ||
25 | |||
26 | send -- "firejail --debug --noprofile --blacklist=\"bla&&bla\"\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 1.1\n";exit} | ||
29 | "Checking filename bla&&bla" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 1.2\n";exit} | ||
33 | "Error:" | ||
34 | } | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 1.3\n";exit} | ||
37 | "is an invalid filename" | ||
38 | } | ||
39 | after 100 | ||
40 | |||
41 | send -- "firejail --debug --noprofile --cgroup=\"bla&&bla\"\r" | ||
42 | expect { | ||
43 | timeout {puts "TESTING ERROR 2.1\n";exit} | ||
44 | "Checking filename bla&&bla" | ||
45 | } | ||
46 | expect { | ||
47 | timeout {puts "TESTING ERROR 2.2\n";exit} | ||
48 | "Error:" | ||
49 | } | ||
50 | expect { | ||
51 | timeout {puts "TESTING ERROR 2.3\n";exit} | ||
52 | "is an invalid filename" | ||
53 | } | ||
54 | after 100 | ||
55 | |||
56 | send -- "firejail --debug --noprofile --chroot=\"bla&&bla\"\r" | ||
57 | expect { | ||
58 | timeout {puts "TESTING ERROR 3.1\n";exit} | ||
59 | "Checking filename bla&&bla" | ||
60 | } | ||
61 | expect { | ||
62 | timeout {puts "TESTING ERROR 3.2\n";exit} | ||
63 | "Error:" | ||
64 | } | ||
65 | expect { | ||
66 | timeout {puts "TESTING ERROR 3.3\n";exit} | ||
67 | "is an invalid filename" | ||
68 | } | ||
69 | after 100 | ||
70 | |||
71 | send -- "firejail --debug --noprofile --netfilter=\"bla&&bla\"\r" | ||
72 | expect { | ||
73 | timeout {puts "TESTING ERROR 4.1\n";exit} | ||
74 | "Checking filename bla&&bla" | ||
75 | } | ||
76 | expect { | ||
77 | timeout {puts "TESTING ERROR 4.2\n";exit} | ||
78 | "Error:" | ||
79 | } | ||
80 | expect { | ||
81 | timeout {puts "TESTING ERROR 4.3\n";exit} | ||
82 | "is an invalid filename" | ||
83 | } | ||
84 | after 100 | ||
85 | |||
86 | send -- "firejail --debug --noprofile --output=\"bla&&bla\"\r" | ||
87 | expect { | ||
88 | timeout {puts "TESTING ERROR 5.2\n";exit} | ||
89 | "Error:" | ||
90 | } | ||
91 | expect { | ||
92 | timeout {puts "TESTING ERROR 5.3\n";exit} | ||
93 | "is an invalid filename" | ||
94 | } | ||
95 | after 100 | ||
96 | |||
97 | send -- "firejail --debug --noprofile --private=\"bla&&bla\"\r" | ||
98 | expect { | ||
99 | timeout {puts "TESTING ERROR 6.1\n";exit} | ||
100 | "Checking filename bla&&bla" | ||
101 | } | ||
102 | expect { | ||
103 | timeout {puts "TESTING ERROR 6.2\n";exit} | ||
104 | "Error:" | ||
105 | } | ||
106 | expect { | ||
107 | timeout {puts "TESTING ERROR 6.3\n";exit} | ||
108 | "is an invalid filename" | ||
109 | } | ||
110 | after 100 | ||
111 | |||
112 | send -- "firejail --debug --noprofile --private-bin=\"bla&&bla\"\r" | ||
113 | expect { | ||
114 | timeout {puts "TESTING ERROR 7.1\n";exit} | ||
115 | "Checking filename bla&&bla" | ||
116 | } | ||
117 | expect { | ||
118 | timeout {puts "TESTING ERROR 7.2\n";exit} | ||
119 | "Error:" | ||
120 | } | ||
121 | expect { | ||
122 | timeout {puts "TESTING ERROR 7.3\n";exit} | ||
123 | "is an invalid filename" | ||
124 | } | ||
125 | after 100 | ||
126 | |||
127 | send -- "firejail --debug --noprofile --private-home=\"bla&&bla\"\r" | ||
128 | expect { | ||
129 | timeout {puts "TESTING ERROR 8.1\n";exit} | ||
130 | "Checking filename bla&&bla" | ||
131 | } | ||
132 | expect { | ||
133 | timeout {puts "TESTING ERROR 8.2\n";exit} | ||
134 | "Error:" | ||
135 | } | ||
136 | expect { | ||
137 | timeout {puts "TESTING ERROR 8.3\n";exit} | ||
138 | "is an invalid filename" | ||
139 | } | ||
140 | after 100 | ||
141 | |||
142 | |||
143 | send -- "firejail --debug --noprofile --private-etc=\"bla&&bla\"\r" | ||
144 | expect { | ||
145 | timeout {puts "TESTING ERROR 9.1\n";exit} | ||
146 | "Checking filename bla&&bla" | ||
147 | } | ||
148 | expect { | ||
149 | timeout {puts "TESTING ERROR 9.2\n";exit} | ||
150 | "Error:" | ||
151 | } | ||
152 | expect { | ||
153 | timeout {puts "TESTING ERROR 9.3\n";exit} | ||
154 | "is an invalid filename" | ||
155 | } | ||
156 | after 100 | ||
157 | |||
158 | send -- "firejail --debug --profile=\"bla&&bla\"\r" | ||
159 | expect { | ||
160 | timeout {puts "TESTING ERROR 10.1\n";exit} | ||
161 | "Checking filename bla&&bla" | ||
162 | } | ||
163 | expect { | ||
164 | timeout {puts "TESTING ERROR 10.2\n";exit} | ||
165 | "Error:" | ||
166 | } | ||
167 | expect { | ||
168 | timeout {puts "TESTING ERROR 10.3\n";exit} | ||
169 | "is an invalid filename" | ||
170 | } | ||
171 | after 100 | ||
172 | |||
173 | send -- "firejail --debug --read-only=\"bla&&bla\"\r" | ||
174 | expect { | ||
175 | timeout {puts "TESTING ERROR 11.1\n";exit} | ||
176 | "Checking filename bla&&bla" | ||
177 | } | ||
178 | expect { | ||
179 | timeout {puts "TESTING ERROR 11.2\n";exit} | ||
180 | "Error:" | ||
181 | } | ||
182 | expect { | ||
183 | timeout {puts "TESTING ERROR 11.3\n";exit} | ||
184 | "is an invalid filename" | ||
185 | } | ||
186 | after 100 | ||
187 | |||
188 | send -- "firejail --debug --shell=\"bla&&bla\"\r" | ||
189 | expect { | ||
190 | timeout {puts "TESTING ERROR 12.1\n";exit} | ||
191 | "Checking filename bla&&bla" | ||
192 | } | ||
193 | expect { | ||
194 | timeout {puts "TESTING ERROR 12.2\n";exit} | ||
195 | "Error:" | ||
196 | } | ||
197 | expect { | ||
198 | timeout {puts "TESTING ERROR 12.3\n";exit} | ||
199 | "is an invalid filename" | ||
200 | } | ||
201 | after 100 | ||
202 | |||
203 | send -- "firejail --debug --tmpfs=\"bla&&bla\"\r" | ||
204 | expect { | ||
205 | timeout {puts "TESTING ERROR 13.1\n";exit} | ||
206 | "Checking filename bla&&bla" | ||
207 | } | ||
208 | expect { | ||
209 | timeout {puts "TESTING ERROR 13.2\n";exit} | ||
210 | "Error:" | ||
211 | } | ||
212 | expect { | ||
213 | timeout {puts "TESTING ERROR 13.3\n";exit} | ||
214 | "is an invalid filename" | ||
215 | } | ||
216 | after 100 | ||
217 | |||
218 | send -- "firejail --debug --whitelist=\"bla&&bla\"\r" | ||
219 | expect { | ||
220 | timeout {puts "TESTING ERROR 14.1\n";exit} | ||
221 | "Checking filename bla&&bla" | ||
222 | } | ||
223 | expect { | ||
224 | timeout {puts "TESTING ERROR 14.2\n";exit} | ||
225 | "Error:" | ||
226 | } | ||
227 | expect { | ||
228 | timeout {puts "TESTING ERROR 14.3\n";exit} | ||
229 | "is an invalid filename" | ||
230 | } | ||
231 | after 100 | ||
232 | |||
233 | |||
234 | |||
235 | puts "\nall done\n" | ||
236 | |||
diff --git a/test/private.exp b/test/private.exp index 6f9dadf8f..8a6796802 100755 --- a/test/private.exp +++ b/test/private.exp | |||
@@ -12,7 +12,7 @@ if { $argc != 1 } { | |||
12 | } | 12 | } |
13 | 13 | ||
14 | # testing profile and private | 14 | # testing profile and private |
15 | send -- "firejail --private --profile=/etc/firejail/firefox.profile\r" | 15 | send -- "firejail --private --profile=/etc/firejail/generic.profile\r" |
16 | expect { | 16 | expect { |
17 | timeout {puts "TESTING ERROR 0\n";exit} | 17 | timeout {puts "TESTING ERROR 0\n";exit} |
18 | "Child process initialized" | 18 | "Child process initialized" |
diff --git a/test/profile_apps.exp b/test/profile_apps.exp deleted file mode 100755 index c57b31489..000000000 --- a/test/profile_apps.exp +++ /dev/null | |||
@@ -1,48 +0,0 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | # firefox | ||
8 | send -- "firejail --profile=/etc/firejail/firefox.profile\r" | ||
9 | expect { | ||
10 | timeout {puts "TESTING ERROR 0\n";exit} | ||
11 | "Child process initialized" | ||
12 | } | ||
13 | sleep 1 | ||
14 | send -- "exit\r" | ||
15 | sleep 1 | ||
16 | |||
17 | # iceweasel | ||
18 | send -- "firejail --profile=/etc/firejail/iceweasel.profile\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | sleep 1 | ||
24 | send -- "exit\r" | ||
25 | sleep 1 | ||
26 | |||
27 | # evince | ||
28 | send -- "firejail --profile=/etc/firejail/evince.profile\r" | ||
29 | expect { | ||
30 | timeout {puts "TESTING ERROR 2\n";exit} | ||
31 | "Child process initialized" | ||
32 | } | ||
33 | sleep 1 | ||
34 | send -- "exit\r" | ||
35 | sleep 1 | ||
36 | |||
37 | # midori | ||
38 | send -- "firejail --profile=/etc/firejail/midori.profile\r" | ||
39 | expect { | ||
40 | timeout {puts "TESTING ERROR 3\n";exit} | ||
41 | "Child process initialized" | ||
42 | } | ||
43 | sleep 1 | ||
44 | send -- "exit\r" | ||
45 | sleep 1 | ||
46 | |||
47 | |||
48 | puts "\n" | ||
diff --git a/test/test.sh b/test/test.sh index 7d43a5786..c986b5f29 100755 --- a/test/test.sh +++ b/test/test.sh | |||
@@ -12,6 +12,9 @@ done | |||
12 | 12 | ||
13 | ./fscheck.sh | 13 | ./fscheck.sh |
14 | 14 | ||
15 | echo "TESTING: invalid filename" | ||
16 | ./invalid_filename.exp | ||
17 | |||
15 | echo "TESTING: environment variables" | 18 | echo "TESTING: environment variables" |
16 | ./env.exp | 19 | ./env.exp |
17 | 20 | ||
@@ -276,9 +279,6 @@ echo "TESTING: profile read-only" | |||
276 | echo "TESTING: profile tmpfs" | 279 | echo "TESTING: profile tmpfs" |
277 | ./profile_tmpfs.exp | 280 | ./profile_tmpfs.exp |
278 | 281 | ||
279 | echo "TESTING: profile applications" | ||
280 | ./profile_apps.exp | ||
281 | |||
282 | echo "TESTING: private" | 282 | echo "TESTING: private" |
283 | ./private.exp `whoami` | 283 | ./private.exp `whoami` |
284 | 284 | ||