diff options
author | 2023-02-06 22:28:25 -0500 | |
---|---|---|
committer | 2023-02-06 22:28:25 -0500 | |
commit | cb1104edf9c6ed0dc753724259b5c12fa5619afb (patch) | |
tree | d654d6547a7836faf5467cb37dac9f3ab50f7107 /test/private-etc/profile.exp | |
parent | testing (diff) | |
download | firejail-cb1104edf9c6ed0dc753724259b5c12fa5619afb.tar.gz firejail-cb1104edf9c6ed0dc753724259b5c12fa5619afb.tar.zst firejail-cb1104edf9c6ed0dc753724259b5c12fa5619afb.zip |
private-etc testing
Diffstat (limited to 'test/private-etc/profile.exp')
-rwxr-xr-x | test/private-etc/profile.exp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/test/private-etc/profile.exp b/test/private-etc/profile.exp new file mode 100755 index 000000000..d5713fe95 --- /dev/null +++ b/test/private-etc/profile.exp | |||
@@ -0,0 +1,90 @@ | |||
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 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --profile=p1.profile\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 1\n";exit} | ||
13 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | send -- "LC_ALL=C ls -al /etc\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 3\n";exit} | ||
20 | "X11" | ||
21 | } | ||
22 | expect { | ||
23 | timeout {puts "TESTING ERROR 4\n";exit} | ||
24 | "group" | ||
25 | } | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 5\n";exit} | ||
28 | "passwd" | ||
29 | } | ||
30 | expect { | ||
31 | timeout {puts "TESTING ERROR 6\n";exit} | ||
32 | "resolv.conf" | ||
33 | } | ||
34 | |||
35 | |||
36 | send -- "file /etc/shadow\r" | ||
37 | expect { | ||
38 | timeout {puts "TESTING ERROR 7\n";exit} | ||
39 | "No such file or directory" | ||
40 | } | ||
41 | after 100 | ||
42 | send -- "exit\r" | ||
43 | sleep 1 | ||
44 | |||
45 | send -- "firejail --profile=p2.profile\r" | ||
46 | expect { | ||
47 | timeout {puts "TESTING ERROR 11\n";exit} | ||
48 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
49 | } | ||
50 | sleep 1 | ||
51 | |||
52 | send -- "LC_ALL=C ls -al /etc\r" | ||
53 | expect { | ||
54 | timeout {puts "TESTING ERROR 13\n";exit} | ||
55 | "X11" | ||
56 | } | ||
57 | expect { | ||
58 | timeout {puts "TESTING ERROR 14\n";exit} | ||
59 | "group" | ||
60 | } | ||
61 | expect { | ||
62 | timeout {puts "TESTING ERROR 15\n";exit} | ||
63 | "passwd" | ||
64 | } | ||
65 | expect { | ||
66 | timeout {puts "TESTING ERROR 16\n";exit} | ||
67 | "resolv.conf" | ||
68 | } | ||
69 | |||
70 | |||
71 | send -- "file /etc/shadow\r" | ||
72 | expect { | ||
73 | timeout {puts "TESTING ERROR 17\n";exit} | ||
74 | "No such file or directory" | ||
75 | } | ||
76 | after 100 | ||
77 | send -- "exit\r" | ||
78 | sleep 1 | ||
79 | |||
80 | |||
81 | |||
82 | |||
83 | |||
84 | |||
85 | |||
86 | |||
87 | |||
88 | |||
89 | after 100 | ||
90 | puts "\nall done\n" | ||