aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar smitsohu <smitsohu@gmail.com>2021-05-23 18:41:24 +0200
committerLibravatar smitsohu <smitsohu@gmail.com>2021-05-23 18:41:24 +0200
commit45919bfa5ed35cb6b6a639436f77e5945d589770 (patch)
tree2318162e9ef675aff2d3f9f47785f6861f97d268 /test
parentwhitelist: following up #4229 (diff)
downloadfirejail-45919bfa5ed35cb6b6a639436f77e5945d589770.tar.gz
firejail-45919bfa5ed35cb6b6a639436f77e5945d589770.tar.zst
firejail-45919bfa5ed35cb6b6a639436f77e5945d589770.zip
whitelist testing (#4229, #4297, #4300)
Diffstat (limited to 'test')
-rwxr-xr-xtest/fs/whitelist.exp66
1 files changed, 1 insertions, 65 deletions
diff --git a/test/fs/whitelist.exp b/test/fs/whitelist.exp
index 27ee2433e..dcc2276b8 100755
--- a/test/fs/whitelist.exp
+++ b/test/fs/whitelist.exp
@@ -16,10 +16,7 @@ send -- "rm ~/fjtest-file\r"
16after 200 16after 200
17send -- "rm ~/fjtest-file-lnk\r" 17send -- "rm ~/fjtest-file-lnk\r"
18after 200 18after 200
19send -- "rm /tmp/fjtest-file\r" 19
20after 200
21send -- "rm -fr /tmp/fjtest-dir\r"
22after 200
23 20
24 21
25# simple files and directories 22# simple files and directories
@@ -149,63 +146,7 @@ expect {
149send -- "exit\r" 146send -- "exit\r"
150sleep 1 147sleep 1
151 148
152# symlinks outside home to a file we don't own
153send -- "rm ~/fjtest-file-lnk\r"
154after 200
155send -- "ln -s /etc/passwd ~/fjtest-file-lnk\r"
156after 200
157send -- "firejail --whitelist=~/fjtest-file-lnk --whitelist=~/fjtest-dir-lnk\r"
158expect {
159 timeout {puts "TESTING ERROR 30\n";exit}
160 "invalid whitelist path"
161}
162expect {
163 timeout {puts "TESTING ERROR 31\n";exit}
164 "cannot sync with peer"
165}
166sleep 1
167
168# symlinks outside home to a file we own
169send -- "rm -fr ~/fjtest-dir-lnk\r"
170after 200
171send -- "rm ~/fjtest-file-lnk\r"
172after 200
173send -- "echo 123 > /tmp/fjtest-file\r"
174after 200
175send -- "mkdir /tmp/fjtest-dir\r"
176after 200
177send -- "echo 123 > /tmp/fjtest-dir/fjtest-file\r"
178after 200
179send -- "ln -s /tmp/fjtest-file ~/fjtest-file-lnk\r"
180after 200
181send -- "ln -s /tmp/fjtest-dir ~/fjtest-dir-lnk\r"
182after 200
183send -- "firejail --whitelist=~/fjtest-file-lnk --whitelist=~/fjtest-dir-lnk\r"
184expect {
185 timeout {puts "TESTING ERROR 40\n";exit}
186 "Child process initialized"
187}
188sleep 1
189
190send -- "ls -l ~/ | grep -v total | wc -l\r"
191expect {
192 timeout {puts "TESTING ERROR 41\n";exit}
193 "2"
194}
195 149
196send -- "cat ~/fjtest-file-lnk\r"
197expect {
198 timeout {puts "TESTING ERROR 42\n";exit}
199 "123"
200}
201
202send -- "cat ~/fjtest-dir-lnk/fjtest-file\r"
203expect {
204 timeout {puts "TESTING ERROR 43\n";exit}
205 "123"
206}
207send -- "exit\r"
208sleep 1
209 150
210# cleanup 151# cleanup
211send -- "rm -fr ~/fjtest-dir\r" 152send -- "rm -fr ~/fjtest-dir\r"
@@ -216,10 +157,5 @@ send -- "rm ~/fjtest-file\r"
216after 200 157after 200
217send -- "rm ~/fjtest-file-lnk\r" 158send -- "rm ~/fjtest-file-lnk\r"
218after 200 159after 200
219send -- "rm /tmp/fjtest-file\r"
220after 200
221send -- "rm -fr /tmp/fjtest-dir\r"
222after 200
223
224 160
225puts "\nall done\n" 161puts "\nall done\n"