diff options
author | 2023-02-06 22:28:25 -0500 | |
---|---|---|
committer | 2023-02-06 22:28:25 -0500 | |
commit | cb1104edf9c6ed0dc753724259b5c12fa5619afb (patch) | |
tree | d654d6547a7836faf5467cb37dac9f3ab50f7107 /test/fs | |
parent | testing (diff) | |
download | firejail-cb1104edf9c6ed0dc753724259b5c12fa5619afb.tar.gz firejail-cb1104edf9c6ed0dc753724259b5c12fa5619afb.tar.zst firejail-cb1104edf9c6ed0dc753724259b5c12fa5619afb.zip |
private-etc testing
Diffstat (limited to 'test/fs')
-rwxr-xr-x | test/fs/fs.sh | 6 | ||||
-rwxr-xr-x | test/fs/private-etc-empty.exp | 42 | ||||
-rw-r--r-- | test/fs/private-etc-empty.profile | 1 | ||||
-rwxr-xr-x | test/fs/private-etc.exp | 69 |
4 files changed, 0 insertions, 118 deletions
diff --git a/test/fs/fs.sh b/test/fs/fs.sh index 4b85d3006..affc4bc7e 100755 --- a/test/fs/fs.sh +++ b/test/fs/fs.sh | |||
@@ -80,12 +80,6 @@ rm -fr ~/_firejail_test_dir1 | |||
80 | rm -f ~/_firejail_test_link1 | 80 | rm -f ~/_firejail_test_link1 |
81 | rm -f ~/_firejail_test_link2 | 81 | rm -f ~/_firejail_test_link2 |
82 | 82 | ||
83 | echo "TESTING: private-etc (test/fs/private-etc.exp)" | ||
84 | ./private-etc.exp | ||
85 | |||
86 | #echo "TESTING: empty private-etc (test/fs/private-etc-empty.exp)" | ||
87 | #./private-etc-empty.exp | ||
88 | |||
89 | echo "TESTING: private-bin (test/fs/private-bin.exp)" | 83 | echo "TESTING: private-bin (test/fs/private-bin.exp)" |
90 | ./private-bin.exp | 84 | ./private-bin.exp |
91 | 85 | ||
diff --git a/test/fs/private-etc-empty.exp b/test/fs/private-etc-empty.exp deleted file mode 100755 index 6878a642c..000000000 --- a/test/fs/private-etc-empty.exp +++ /dev/null | |||
@@ -1,42 +0,0 @@ | |||
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 --private-etc=blablabla\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | send -- "ls -l /etc | wc -l\r" | ||
18 | expect { | ||
19 | timeout {puts "TESTING ERROR 1\n";exit} | ||
20 | "0" {puts "Debian\n"} | ||
21 | "1" {puts "Arch\n"} | ||
22 | } | ||
23 | send -- "exit\r" | ||
24 | sleep 1 | ||
25 | |||
26 | send -- "firejail --profile=private-etc-empty.profile\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 0\n";exit} | ||
29 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
30 | } | ||
31 | sleep 1 | ||
32 | |||
33 | send -- "ls -l /etc | wc -l\r" | ||
34 | expect { | ||
35 | timeout {puts "TESTING ERROR 1\n";exit} | ||
36 | "0" {puts "Debian\n"} | ||
37 | "1" {puts "Arch\n"} | ||
38 | |||
39 | } | ||
40 | |||
41 | after 100 | ||
42 | puts "\nall done\n" | ||
diff --git a/test/fs/private-etc-empty.profile b/test/fs/private-etc-empty.profile deleted file mode 100644 index 38aa8cd68..000000000 --- a/test/fs/private-etc-empty.profile +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | private-etc blablabla | ||
diff --git a/test/fs/private-etc.exp b/test/fs/private-etc.exp deleted file mode 100755 index f51fc5221..000000000 --- a/test/fs/private-etc.exp +++ /dev/null | |||
@@ -1,69 +0,0 @@ | |||
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 | # directory with ~ | ||
11 | send -- "firejail --private-etc=passwd,group,resolv.conf,X11\r" | ||
12 | expect { | ||
13 | timeout {puts "TESTING ERROR 1\n";exit} | ||
14 | -re "Child process initialized in \[0-9\]+.\[0-9\]+ ms" | ||
15 | } | ||
16 | sleep 1 | ||
17 | |||
18 | send -- "LC_ALL=C ls -al /etc\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 3\n";exit} | ||
21 | "X11" | ||
22 | } | ||
23 | expect { | ||
24 | timeout {puts "TESTING ERROR 4\n";exit} | ||
25 | "group" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 5\n";exit} | ||
29 | "passwd" | ||
30 | } | ||
31 | expect { | ||
32 | timeout {puts "TESTING ERROR 6\n";exit} | ||
33 | "resolv.conf" | ||
34 | } | ||
35 | |||
36 | |||
37 | send -- "file /etc/shadow\r" | ||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 7\n";exit} | ||
40 | "No such file or directory" | ||
41 | } | ||
42 | after 100 | ||
43 | send -- "exit\r" | ||
44 | sleep 1 | ||
45 | |||
46 | send -- "firejail --private-etc=shadow\r" | ||
47 | expect { | ||
48 | timeout {puts "TESTING ERROR 8\n";exit} | ||
49 | "invalid file type" | ||
50 | } | ||
51 | after 100 | ||
52 | |||
53 | send -- "firejail --private-etc=\"bla;bla\"\r" | ||
54 | expect { | ||
55 | timeout {puts "TESTING ERROR 9\n";exit} | ||
56 | "is an invalid filename" | ||
57 | } | ||
58 | after 100 | ||
59 | |||
60 | send -- "firejail --private-etc=../bin/ls\r" | ||
61 | expect { | ||
62 | timeout {puts "TESTING ERROR 10\n";exit} | ||
63 | "is an invalid filename" | ||
64 | } | ||
65 | after 100 | ||
66 | |||
67 | send -- "exit\r" | ||
68 | after 100 | ||
69 | puts "\nall done\n" | ||