aboutsummaryrefslogtreecommitdiffstats
path: root/test/private-etc/private-etc.exp
diff options
context:
space:
mode:
Diffstat (limited to 'test/private-etc/private-etc.exp')
-rwxr-xr-xtest/private-etc/private-etc.exp68
1 files changed, 68 insertions, 0 deletions
diff --git a/test/private-etc/private-etc.exp b/test/private-etc/private-etc.exp
new file mode 100755
index 000000000..3aac7cdf2
--- /dev/null
+++ b/test/private-etc/private-etc.exp
@@ -0,0 +1,68 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2022 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --private-etc=passwd,group,resolv.conf,X11\r"
11expect {
12 timeout {puts "TESTING ERROR 1\n";exit}
13 -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms"
14}
15sleep 1
16
17send -- "LC_ALL=C ls -al /etc\r"
18expect {
19 timeout {puts "TESTING ERROR 3\n";exit}
20 "X11"
21}
22expect {
23 timeout {puts "TESTING ERROR 4\n";exit}
24 "group"
25}
26expect {
27 timeout {puts "TESTING ERROR 5\n";exit}
28 "passwd"
29}
30expect {
31 timeout {puts "TESTING ERROR 6\n";exit}
32 "resolv.conf"
33}
34
35
36send -- "file /etc/shadow\r"
37expect {
38 timeout {puts "TESTING ERROR 7\n";exit}
39 "No such file or directory"
40}
41after 100
42send -- "exit\r"
43sleep 1
44
45send -- "firejail --private-etc=shadow\r"
46expect {
47 timeout {puts "TESTING ERROR 8\n";exit}
48 "invalid file type"
49}
50after 100
51
52send -- "firejail --private-etc=\"bla;bla\"\r"
53expect {
54 timeout {puts "TESTING ERROR 9\n";exit}
55 "is an invalid filename"
56}
57after 100
58
59send -- "firejail --private-etc=../bin/ls\r"
60expect {
61 timeout {puts "TESTING ERROR 10\n";exit}
62 "is an invalid filename"
63}
64after 100
65
66send -- "exit\r"
67after 100
68puts "\nall done\n"