diff options
author | startx2017 <vradu.startx@protonmail.com> | 2021-07-29 07:47:16 -0400 |
---|---|---|
committer | startx2017 <vradu.startx@protonmail.com> | 2021-07-29 07:47:16 -0400 |
commit | b4424d947838cc41fc82f1ba9a7c06b8a49f9bae (patch) | |
tree | 2ac1fd1d9f2611bd7a19cd78cc76478c2d111125 /test/fs | |
parent | Fixup: Fix Firefox 'Profile not found' - whitelist /run/user/xxx/firefox (diff) | |
download | firejail-b4424d947838cc41fc82f1ba9a7c06b8a49f9bae.tar.gz firejail-b4424d947838cc41fc82f1ba9a7c06b8a49f9bae.tar.zst firejail-b4424d947838cc41fc82f1ba9a7c06b8a49f9bae.zip |
rework make test-fs
Diffstat (limited to 'test/fs')
-rwxr-xr-x | test/fs/fs.sh | 51 | ||||
-rwxr-xr-x | test/fs/fs_dev_shm.exp | 16 | ||||
-rwxr-xr-x | test/fs/fs_var_tmp.exp | 16 | ||||
-rwxr-xr-x | test/fs/mkdir.exp | 20 | ||||
-rw-r--r-- | test/fs/mkdir.profile | 12 | ||||
-rwxr-xr-x | test/fs/option_blacklist.exp | 2 | ||||
-rwxr-xr-x | test/fs/option_blacklist_file.exp | 25 | ||||
-rwxr-xr-x | test/fs/option_blacklist_glob.exp | 25 | ||||
-rwxr-xr-x | test/fs/private-etc.exp | 5 | ||||
-rwxr-xr-x | test/fs/private-home-dir.exp | 15 | ||||
-rwxr-xr-x | test/fs/private-home.exp | 13 | ||||
-rwxr-xr-x | test/fs/read-write.exp | 13 | ||||
-rwxr-xr-x | test/fs/whitelist-dev.exp | 3 | ||||
-rwxr-xr-x | test/fs/whitelist-double.exp | 10 | ||||
-rwxr-xr-x | test/fs/whitelist-readonly.exp | 10 |
15 files changed, 164 insertions, 72 deletions
diff --git a/test/fs/fs.sh b/test/fs/fs.sh index 591fc1a06..9c3310b31 100755 --- a/test/fs/fs.sh +++ b/test/fs/fs.sh | |||
@@ -15,15 +15,18 @@ echo "TESTING: mkdir/mkfile (test/fs/mkdir_mkfile.exp)" | |||
15 | ./mkdir_mkfile.exp | 15 | ./mkdir_mkfile.exp |
16 | rm -fr ~/_firejail_test_* | 16 | rm -fr ~/_firejail_test_* |
17 | 17 | ||
18 | mkdir ~/_firejail_test_dir | 18 | echo "TESTING: recursive mkdir (test/fs/mkdir.exp)" |
19 | touch ~/_firejail_test_dir/a | 19 | ./mkdir.exp |
20 | mkdir ~/_firejail_test_dir/test1 | 20 | rm -fr ~/_firejail_test_* |
21 | touch ~/_firejail_test_dir/test1/b | 21 | rm -fr /tmp/_firejail_test_* |
22 | |||
22 | echo "TESTING: read/write (test/fs/read-write.exp)" | 23 | echo "TESTING: read/write (test/fs/read-write.exp)" |
23 | ./read-write.exp | 24 | ./read-write.exp |
25 | rm -fr ~/_firejail_test_dir | ||
26 | |||
24 | echo "TESTING: whitelist readonly (test/fs/whitelist-readonly.exp)" | 27 | echo "TESTING: whitelist readonly (test/fs/whitelist-readonly.exp)" |
25 | ./whitelist-readonly.exp | 28 | ./whitelist-readonly.exp |
26 | rm -fr ~/_firejail_test_* | 29 | rm -f ~/_firejail_test_dir |
27 | 30 | ||
28 | echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)" | 31 | echo "TESTING: /sys/fs access (test/fs/sys_fs.exp)" |
29 | ./sys_fs.exp | 32 | ./sys_fs.exp |
@@ -37,16 +40,19 @@ fi | |||
37 | 40 | ||
38 | echo "TESTING: read/write /var/tmp (test/fs/fs_var_tmp.exp)" | 41 | echo "TESTING: read/write /var/tmp (test/fs/fs_var_tmp.exp)" |
39 | ./fs_var_tmp.exp | 42 | ./fs_var_tmp.exp |
43 | rm -f /var/tmp/_firejail_test_file | ||
40 | 44 | ||
41 | echo "TESTING: private-lib (test/fs/private-lib.exp)" | 45 | echo "TESTING: private-lib (test/fs/private-lib.exp)" |
42 | ./private-lib.exp | 46 | ./private-lib.exp |
43 | 47 | ||
44 | echo "TESTING: read/write /var/lock (test/fs/fs_var_lock.exp)" | 48 | echo "TESTING: read/write /var/lock (test/fs/fs_var_lock.exp)" |
45 | ./fs_var_lock.exp | 49 | ./fs_var_lock.exp |
50 | rm -f /var/lock/_firejail_test_file | ||
46 | 51 | ||
47 | if [ -w /dev/shm ]; then | 52 | if [ -w /dev/shm ]; then |
48 | echo "TESTING: read/write /dev/shm (test/fs/fs_dev_shm.exp)" | 53 | echo "TESTING: read/write /dev/shm (test/fs/fs_dev_shm.exp)" |
49 | ./fs_dev_shm.exp | 54 | ./fs_dev_shm.exp |
55 | rm -f /dev/shm/_firejail_test_file | ||
50 | else | 56 | else |
51 | echo "TESTING SKIP: /dev/shm not writable" | 57 | echo "TESTING SKIP: /dev/shm not writable" |
52 | fi | 58 | fi |
@@ -56,12 +62,23 @@ echo "TESTING: private (test/fs/private.exp)" | |||
56 | 62 | ||
57 | echo "TESTING: private home (test/fs/private-home.exp)" | 63 | echo "TESTING: private home (test/fs/private-home.exp)" |
58 | ./private-home.exp | 64 | ./private-home.exp |
65 | rm -f ~/_firejail_test_file1 | ||
66 | rm -f ~/_firejail_test_file2 | ||
67 | rm -fr ~/_firejail_test_dir1 | ||
68 | rm -f ~/_firejail_test_link1 | ||
69 | rm -f ~/_firejail_test_link2 | ||
59 | 70 | ||
60 | echo "TESTING: private home dir (test/fs/private-home-dir.exp)" | 71 | echo "TESTING: private home dir (test/fs/private-home-dir.exp)" |
61 | ./private-home-dir.exp | 72 | ./private-home-dir.exp |
73 | rm -fr ~/_firejail_test_dir1 | ||
62 | 74 | ||
63 | echo "TESTING: private home dir same as user home (test/fs/private-homedir.exp)" | 75 | echo "TESTING: private home dir same as user home (test/fs/private-homedir.exp)" |
64 | ./private-homedir.exp | 76 | ./private-homedir.exp |
77 | rm -f ~/_firejail_test_file1 | ||
78 | rm -f ~/_firejail_test_file2 | ||
79 | rm -fr ~/_firejail_test_dir1 | ||
80 | rm -f ~/_firejail_test_link1 | ||
81 | rm -f ~/_firejail_test_link2 | ||
65 | 82 | ||
66 | echo "TESTING: private-etc (test/fs/private-etc.exp)" | 83 | echo "TESTING: private-etc (test/fs/private-etc.exp)" |
67 | ./private-etc.exp | 84 | ./private-etc.exp |
@@ -74,6 +91,7 @@ echo "TESTING: private-bin (test/fs/private-bin.exp)" | |||
74 | 91 | ||
75 | echo "TESTING: private-cache (test/fs/private-cache.exp)" | 92 | echo "TESTING: private-cache (test/fs/private-cache.exp)" |
76 | ./private-cache.exp | 93 | ./private-cache.exp |
94 | rm -f ~/.cache/abcdefg | ||
77 | 95 | ||
78 | echo "TESTING: private-cwd (test/fs/private-cwd.exp)" | 96 | echo "TESTING: private-cwd (test/fs/private-cwd.exp)" |
79 | ./private-cwd.exp | 97 | ./private-cwd.exp |
@@ -83,6 +101,12 @@ echo "TESTING: macros (test/fs/macro.exp)" | |||
83 | 101 | ||
84 | echo "TESTING: whitelist empty (test/fs/whitelist-empty.exp)" | 102 | echo "TESTING: whitelist empty (test/fs/whitelist-empty.exp)" |
85 | ./whitelist-empty.exp | 103 | ./whitelist-empty.exp |
104 | rm -f ~/Videos/_firejail_test_fil | ||
105 | rm -f ~/Pictures/_firejail_test_file | ||
106 | rm -f ~/Music/_firejail_test_file | ||
107 | rm -f ~/Downloads/_firejail_test_file | ||
108 | rm -f ~/Documents/_firejail_test_file | ||
109 | rm -f ~/Desktop/_firejail_test_file | ||
86 | 110 | ||
87 | echo "TESTING: private whitelist (test/fs/private-whitelist.exp)" | 111 | echo "TESTING: private whitelist (test/fs/private-whitelist.exp)" |
88 | ./private-whitelist.exp | 112 | ./private-whitelist.exp |
@@ -95,9 +119,11 @@ echo "TESTING: blacklist directory (test/fs/option_blacklist.exp)" | |||
95 | 119 | ||
96 | echo "TESTING: blacklist file (test/fs/option_blacklist_file.exp)" | 120 | echo "TESTING: blacklist file (test/fs/option_blacklist_file.exp)" |
97 | ./option_blacklist_file.exp | 121 | ./option_blacklist_file.exp |
122 | rm -fr ~/_firejail_test_dir | ||
98 | 123 | ||
99 | echo "TESTING: blacklist glob (test/fs/option_blacklist_glob.exp)" | 124 | echo "TESTING: blacklist glob (test/fs/option_blacklist_glob.exp)" |
100 | ./option_blacklist_glob.exp | 125 | ./option_blacklist_glob.exp |
126 | rm -fr ~/_firejail_test_dir | ||
101 | 127 | ||
102 | echo "TESTING: noblacklist blacklist noexec (test/fs/noblacklist-blacklist-noexec.exp)" | 128 | echo "TESTING: noblacklist blacklist noexec (test/fs/noblacklist-blacklist-noexec.exp)" |
103 | ./noblacklist-blacklist-noexec.exp | 129 | ./noblacklist-blacklist-noexec.exp |
@@ -108,14 +134,13 @@ echo "TESTING: noblacklist blacklist readonly (test/fs/noblacklist-blacklist-rea | |||
108 | echo "TESTING: bind as user (test/fs/option_bind_user.exp)" | 134 | echo "TESTING: bind as user (test/fs/option_bind_user.exp)" |
109 | ./option_bind_user.exp | 135 | ./option_bind_user.exp |
110 | 136 | ||
111 | echo "TESTING: recursive mkdir (test/fs/mkdir.exp)" | ||
112 | ./mkdir.exp | ||
113 | |||
114 | echo "TESTING: double whitelist (test/fs/whitelist-double.exp)" | 137 | echo "TESTING: double whitelist (test/fs/whitelist-double.exp)" |
115 | ./whitelist-double.exp | 138 | ./whitelist-double.exp |
139 | rm -f /tmp/_firejail_test_file | ||
116 | 140 | ||
117 | echo "TESTING: whitelist (test/fs/whitelist.exp)" | 141 | echo "TESTING: whitelist (test/fs/whitelist.exp)" |
118 | ./whitelist.exp | 142 | ./whitelist.exp |
143 | rm -fr ~/_firejail_test_* | ||
119 | 144 | ||
120 | echo "TESTING: whitelist dev, var(test/fs/whitelist-dev.exp)" | 145 | echo "TESTING: whitelist dev, var(test/fs/whitelist-dev.exp)" |
121 | ./whitelist-dev.exp | 146 | ./whitelist-dev.exp |
@@ -131,6 +156,8 @@ echo "TESTING: fscheck --bind non root (test/fs/fscheck-bindnoroot.exp)" | |||
131 | 156 | ||
132 | echo "TESTING: fscheck --tmpfs non root (test/fs/fscheck-tmpfs.exp)" | 157 | echo "TESTING: fscheck --tmpfs non root (test/fs/fscheck-tmpfs.exp)" |
133 | ./fscheck-tmpfs.exp | 158 | ./fscheck-tmpfs.exp |
159 | rm -fr ~/_firejail_test_dir | ||
160 | rm -fr /tmp/_firejail_test_dir | ||
134 | 161 | ||
135 | echo "TESTING: fscheck --private= (test/fs/fscheck-private.exp)" | 162 | echo "TESTING: fscheck --private= (test/fs/fscheck-private.exp)" |
136 | ./fscheck-private.exp | 163 | ./fscheck-private.exp |
@@ -139,10 +166,4 @@ echo "TESTING: fscheck --read-only= (test/fs/fscheck-readonly.exp)" | |||
139 | ./fscheck-readonly.exp | 166 | ./fscheck-readonly.exp |
140 | 167 | ||
141 | #cleanup | 168 | #cleanup |
142 | rm -fr ~/fjtest-dir | 169 | rm -fr ~/_firejail_test* |
143 | rm -fr ~/fjtest-dir-lnk | ||
144 | rm -f ~/fjtest-file | ||
145 | rm -f ~/fjtest-file-lnk | ||
146 | rm -f /tmp/fjtest-file | ||
147 | rm -fr /tmp/fjtest-dir | ||
148 | rm -fr ~/_firejail_test_* | ||
diff --git a/test/fs/fs_dev_shm.exp b/test/fs/fs_dev_shm.exp index 04e6e2383..5f0503494 100755 --- a/test/fs/fs_dev_shm.exp +++ b/test/fs/fs_dev_shm.exp | |||
@@ -16,13 +16,13 @@ expect { | |||
16 | after 100 | 16 | after 100 |
17 | send -- "stty -echo\r" | 17 | send -- "stty -echo\r" |
18 | 18 | ||
19 | send -- "echo mytest > /dev/shm/ttt;echo done\r" | 19 | send -- "echo mytest > /dev/shm/_firejail_test_file;echo done\r" |
20 | expect { | 20 | expect { |
21 | timeout {puts "TESTING ERROR 1\n";exit} | 21 | timeout {puts "TESTING ERROR 1\n";exit} |
22 | "done" | 22 | "done" |
23 | } | 23 | } |
24 | 24 | ||
25 | send -- "cat /dev/shm/ttt;echo done\r" | 25 | send -- "cat /dev/shm/_firejail_test_file;echo done\r" |
26 | expect { | 26 | expect { |
27 | timeout {puts "TESTING ERROR 2\n";exit} | 27 | timeout {puts "TESTING ERROR 2\n";exit} |
28 | "mytest" | 28 | "mytest" |
@@ -32,13 +32,13 @@ expect { | |||
32 | "done" | 32 | "done" |
33 | } | 33 | } |
34 | 34 | ||
35 | send -- "rm /dev/shm/ttt;echo done\r" | 35 | send -- "rm /dev/shm/_firejail_test_file;echo done\r" |
36 | expect { | 36 | expect { |
37 | timeout {puts "TESTING ERROR 4\n";exit} | 37 | timeout {puts "TESTING ERROR 4\n";exit} |
38 | "done" | 38 | "done" |
39 | } | 39 | } |
40 | 40 | ||
41 | send -- "cat /dev/shm/ttt;echo done\r" | 41 | send -- "cat /dev/shm/_firejail_test_file;echo done\r" |
42 | expect { | 42 | expect { |
43 | timeout {puts "TESTING ERROR 5\n";exit} | 43 | timeout {puts "TESTING ERROR 5\n";exit} |
44 | "mytest" {puts "TESTING ERROR 6\n";exit} | 44 | "mytest" {puts "TESTING ERROR 6\n";exit} |
@@ -57,13 +57,13 @@ expect { | |||
57 | after 100 | 57 | after 100 |
58 | send -- "stty -echo\r" | 58 | send -- "stty -echo\r" |
59 | 59 | ||
60 | send -- "echo mytest > /dev/shm/ttt;echo done\r" | 60 | send -- "echo mytest > /dev/shm/_firejail_test_file;echo done\r" |
61 | expect { | 61 | expect { |
62 | timeout {puts "TESTING ERROR 8\n";exit} | 62 | timeout {puts "TESTING ERROR 8\n";exit} |
63 | "done" | 63 | "done" |
64 | } | 64 | } |
65 | 65 | ||
66 | send -- "cat /dev/shm/ttt;echo done\r" | 66 | send -- "cat /dev/shm/_firejail_test_file;echo done\r" |
67 | expect { | 67 | expect { |
68 | timeout {puts "TESTING ERROR 9\n";exit} | 68 | timeout {puts "TESTING ERROR 9\n";exit} |
69 | "mytest" | 69 | "mytest" |
@@ -73,13 +73,13 @@ expect { | |||
73 | "done" | 73 | "done" |
74 | } | 74 | } |
75 | 75 | ||
76 | send -- "rm /dev/shm/ttt;echo done\r" | 76 | send -- "rm /dev/shm/_firejail_test_file;echo done\r" |
77 | expect { | 77 | expect { |
78 | timeout {puts "TESTING ERROR 11\n";exit} | 78 | timeout {puts "TESTING ERROR 11\n";exit} |
79 | "done" | 79 | "done" |
80 | } | 80 | } |
81 | 81 | ||
82 | send -- "cat /dev/shm/ttt;echo done\r" | 82 | send -- "cat /dev/shm/_firejail_test_file;echo done\r" |
83 | expect { | 83 | expect { |
84 | timeout {puts "TESTING ERROR 12\n";exit} | 84 | timeout {puts "TESTING ERROR 12\n";exit} |
85 | "mytest" {puts "TESTING ERROR 13\n";exit} | 85 | "mytest" {puts "TESTING ERROR 13\n";exit} |
diff --git a/test/fs/fs_var_tmp.exp b/test/fs/fs_var_tmp.exp index 004425719..c7d4b0c20 100755 --- a/test/fs/fs_var_tmp.exp +++ b/test/fs/fs_var_tmp.exp | |||
@@ -16,13 +16,13 @@ expect { | |||
16 | after 100 | 16 | after 100 |
17 | send -- "stty -echo\r" | 17 | send -- "stty -echo\r" |
18 | 18 | ||
19 | send -- "echo mytest > /var/tmp/ttt;echo done\r" | 19 | send -- "echo mytest > /var/tmp/_firejail_test_file;echo done\r" |
20 | expect { | 20 | expect { |
21 | timeout {puts "TESTING ERROR 1\n";exit} | 21 | timeout {puts "TESTING ERROR 1\n";exit} |
22 | "done" | 22 | "done" |
23 | } | 23 | } |
24 | 24 | ||
25 | send -- "cat /var/tmp/ttt;echo done\r" | 25 | send -- "cat /var/tmp/_firejail_test_file;echo done\r" |
26 | expect { | 26 | expect { |
27 | timeout {puts "TESTING ERROR 2\n";exit} | 27 | timeout {puts "TESTING ERROR 2\n";exit} |
28 | "mytest" | 28 | "mytest" |
@@ -32,13 +32,13 @@ expect { | |||
32 | "done" | 32 | "done" |
33 | } | 33 | } |
34 | 34 | ||
35 | send -- "rm /var/tmp/ttt;echo done\r" | 35 | send -- "rm /var/tmp/_firejail_test_file;echo done\r" |
36 | expect { | 36 | expect { |
37 | timeout {puts "TESTING ERROR 4\n";exit} | 37 | timeout {puts "TESTING ERROR 4\n";exit} |
38 | "done" | 38 | "done" |
39 | } | 39 | } |
40 | 40 | ||
41 | send -- "cat /var/tmp/ttt;echo done\r" | 41 | send -- "cat /var/tmp/_firejail_test_file;echo done\r" |
42 | expect { | 42 | expect { |
43 | timeout {puts "TESTING ERROR 5\n";exit} | 43 | timeout {puts "TESTING ERROR 5\n";exit} |
44 | "mytest" {puts "TESTING ERROR 6\n";exit} | 44 | "mytest" {puts "TESTING ERROR 6\n";exit} |
@@ -58,13 +58,13 @@ expect { | |||
58 | after 100 | 58 | after 100 |
59 | send -- "stty -echo\r" | 59 | send -- "stty -echo\r" |
60 | 60 | ||
61 | send -- "echo mytest > /var/tmp/ttt;echo done\r" | 61 | send -- "echo mytest > /var/tmp/_firejail_test_file;echo done\r" |
62 | expect { | 62 | expect { |
63 | timeout {puts "TESTING ERROR 8\n";exit} | 63 | timeout {puts "TESTING ERROR 8\n";exit} |
64 | "done" | 64 | "done" |
65 | } | 65 | } |
66 | 66 | ||
67 | send -- "cat /var/tmp/ttt;echo done\r" | 67 | send -- "cat /var/tmp/_firejail_test_file;echo done\r" |
68 | expect { | 68 | expect { |
69 | timeout {puts "TESTING ERROR 9\n";exit} | 69 | timeout {puts "TESTING ERROR 9\n";exit} |
70 | "mytest" | 70 | "mytest" |
@@ -74,13 +74,13 @@ expect { | |||
74 | "done" | 74 | "done" |
75 | } | 75 | } |
76 | 76 | ||
77 | send -- "rm /var/tmp/ttt;echo done\r" | 77 | send -- "rm /var/tmp/_firejail_test_file;echo done\r" |
78 | expect { | 78 | expect { |
79 | timeout {puts "TESTING ERROR 11\n";exit} | 79 | timeout {puts "TESTING ERROR 11\n";exit} |
80 | "done" | 80 | "done" |
81 | } | 81 | } |
82 | 82 | ||
83 | send -- "cat /var/tmp/ttt;echo done\r" | 83 | send -- "cat /var/tmp/_firejail_test_file;echo done\r" |
84 | expect { | 84 | expect { |
85 | timeout {puts "TESTING ERROR 12\n";exit} | 85 | timeout {puts "TESTING ERROR 12\n";exit} |
86 | "mytest" {puts "TESTING ERROR 13\n";exit} | 86 | "mytest" {puts "TESTING ERROR 13\n";exit} |
diff --git a/test/fs/mkdir.exp b/test/fs/mkdir.exp index 8b787f114..da04a431c 100755 --- a/test/fs/mkdir.exp +++ b/test/fs/mkdir.exp | |||
@@ -7,34 +7,34 @@ set timeout 3 | |||
7 | spawn $env(SHELL) | 7 | spawn $env(SHELL) |
8 | match_max 100000 | 8 | match_max 100000 |
9 | 9 | ||
10 | send -- "rm -fr ~/.firejail_test\r" | 10 | send -- "rm -fr ~/_firejail_test_dir\r" |
11 | after 100 | 11 | after 100 |
12 | 12 | ||
13 | send -- "firejail --profile=mkdir.profile find ~/.firejail_test\r" | 13 | send -- "firejail --profile=mkdir.profile find ~/_firejail_test_dir\r" |
14 | expect { | 14 | expect { |
15 | timeout {puts "TESTING ERROR 1.1\n";exit} | 15 | timeout {puts "TESTING ERROR 1.1\n";exit} |
16 | ".firejail_test/a/b/c/d.txt" | 16 | "_firejail_test_dir/_firejail_test_file" |
17 | } | 17 | } |
18 | send -- "rm -rf ~/.firejail_test\r" | 18 | send -- "rm -rf ~/_firejail_test_dir\r" |
19 | after 100 | 19 | after 100 |
20 | 20 | ||
21 | send -- "firejail --profile=mkdir.profile find /tmp/.firejail_test\r" | 21 | send -- "firejail --profile=mkdir.profile find /tmp/_firejail_test_dir\r" |
22 | expect { | 22 | expect { |
23 | timeout {puts "TESTING ERROR 2.1\n";exit} | 23 | timeout {puts "TESTING ERROR 2.1\n";exit} |
24 | "/tmp/.firejail_test/a/b/c/d.txt" | 24 | "_firejail_test_dir/_firejail_test_file" |
25 | } | 25 | } |
26 | send -- "rm -rf /tmp/.firejail_test\r" | 26 | send -- "rm -rf /tmp/_firejail_test_dir\r" |
27 | after 100 | 27 | after 100 |
28 | 28 | ||
29 | set UID [exec id -u] | 29 | set UID [exec id -u] |
30 | set fexist [file exist /run/user/$UID] | 30 | set fexist [file exist /run/user/$UID] |
31 | if { $fexist } { | 31 | if { $fexist } { |
32 | send -- "firejail --profile=mkdir.profile find /run/user/$UID/.firejail_test\r" | 32 | send -- "firejail --profile=mkdir.profile find /run/user/$UID/_firejail_test_dir\r" |
33 | expect { | 33 | expect { |
34 | timeout {puts "TESTING ERROR 3.1\n";exit} | 34 | timeout {puts "TESTING ERROR 3.1\n";exit} |
35 | "/run/user/$UID/.firejail_test/a/b/c/d.txt" | 35 | "_firejail_test_dir/_firejail_test_file" |
36 | } | 36 | } |
37 | send -- "rm -rf /run/user/$UID/.firejail_test\r" | 37 | send -- "rm -rf /run/user/$UID/_firejail_test_dir\r" |
38 | after 100 | 38 | after 100 |
39 | 39 | ||
40 | 40 | ||
diff --git a/test/fs/mkdir.profile b/test/fs/mkdir.profile index 35c27c872..fba93f466 100644 --- a/test/fs/mkdir.profile +++ b/test/fs/mkdir.profile | |||
@@ -1,6 +1,6 @@ | |||
1 | mkdir ~/.firejail_test/a/b/c | 1 | mkdir ~/_firejail_test_dir |
2 | mkfile ~/.firejail_test/a/b/c/d.txt | 2 | mkfile ~/_firejail_test_dir/_firejail_test_file |
3 | mkdir /tmp/.firejail_test/a/b/c | 3 | mkdir /tmp/_firejail_test_dir |
4 | mkfile /tmp/.firejail_test/a/b/c/d.txt | 4 | mkfile /tmp/_firejail_test_dir/_firejail_test_file |
5 | mkdir ${RUNUSER}/.firejail_test/a/b/c | 5 | mkdir ${RUNUSER}/_firejail_test_dir |
6 | mkfile ${RUNUSER}/.firejail_test/a/b/c/d.txt | 6 | mkfile ${RUNUSER}/_firejail_test_dir/_firejail_test_file |
diff --git a/test/fs/option_blacklist.exp b/test/fs/option_blacklist.exp index 6ee2b07ca..48dfcc069 100755 --- a/test/fs/option_blacklist.exp +++ b/test/fs/option_blacklist.exp | |||
@@ -35,4 +35,4 @@ expect { | |||
35 | } | 35 | } |
36 | after 100 | 36 | after 100 |
37 | 37 | ||
38 | puts "\n" | 38 | puts "\nall done\n" |
diff --git a/test/fs/option_blacklist_file.exp b/test/fs/option_blacklist_file.exp index b0bcc741b..247e69121 100755 --- a/test/fs/option_blacklist_file.exp +++ b/test/fs/option_blacklist_file.exp | |||
@@ -7,7 +7,12 @@ set timeout 10 | |||
7 | spawn $env(SHELL) | 7 | spawn $env(SHELL) |
8 | match_max 100000 | 8 | match_max 100000 |
9 | 9 | ||
10 | send -- "firejail --blacklist=/etc/passwd\r" | 10 | send -- "mkdir ~/_firejail_test_dir\r" |
11 | after 100 | ||
12 | send -- "touch ~/_firejail_test_dir/a\r" | ||
13 | after 100 | ||
14 | |||
15 | send -- "firejail --blacklist=/etc/passwd --blacklist=~/_firejail_test_dir\r" | ||
11 | expect { | 16 | expect { |
12 | timeout {puts "TESTING ERROR 0\n";exit} | 17 | timeout {puts "TESTING ERROR 0\n";exit} |
13 | "Child process initialized" | 18 | "Child process initialized" |
@@ -17,6 +22,16 @@ sleep 1 | |||
17 | send -- "cat /etc/passwd;echo done\r" | 22 | send -- "cat /etc/passwd;echo done\r" |
18 | expect { | 23 | expect { |
19 | timeout {puts "TESTING ERROR 1\n";exit} | 24 | timeout {puts "TESTING ERROR 1\n";exit} |
25 | "No such file or directory" | ||
26 | } | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "done" | ||
30 | } | ||
31 | after 100 | ||
32 | send -- "cat ~/_firejail_test_dir/a;echo done\r" | ||
33 | expect { | ||
34 | timeout {puts "TESTING ERROR 1\n";exit} | ||
20 | "Permission denied" | 35 | "Permission denied" |
21 | } | 36 | } |
22 | expect { | 37 | expect { |
@@ -25,4 +40,10 @@ expect { | |||
25 | } | 40 | } |
26 | after 100 | 41 | after 100 |
27 | 42 | ||
28 | puts "\n" | 43 | send -- "exit\r" |
44 | sleep 1 | ||
45 | |||
46 | send -- "rm -fr ~/_firejail_test_dir\r" | ||
47 | after 100 | ||
48 | |||
49 | puts "\nall done\n" | ||
diff --git a/test/fs/option_blacklist_glob.exp b/test/fs/option_blacklist_glob.exp index ee79eabf4..a4be4a97d 100755 --- a/test/fs/option_blacklist_glob.exp +++ b/test/fs/option_blacklist_glob.exp | |||
@@ -7,26 +7,41 @@ set timeout 10 | |||
7 | spawn $env(SHELL) | 7 | spawn $env(SHELL) |
8 | match_max 100000 | 8 | match_max 100000 |
9 | 9 | ||
10 | send -- "firejail --blacklist=testdir1/*\r" | 10 | send -- "mkdir ~/_firejail_test_dir\r" |
11 | after 100 | ||
12 | send -- "touch ~/_firejail_test_dir/a\r" | ||
13 | after 100 | ||
14 | send -- "mkdir ~/_firejail_test_dir/test1\r" | ||
15 | after 100 | ||
16 | send -- "touch ~/_firejail_test_dir/test1/b\r" | ||
17 | after 100 | ||
18 | |||
19 | send -- "firejail --blacklist=~/_firejail_test_dir/*\r" | ||
11 | expect { | 20 | expect { |
12 | timeout {puts "TESTING ERROR 0\n";exit} | 21 | timeout {puts "TESTING ERROR 0\n";exit} |
13 | "Child process initialized" | 22 | "Child process initialized" |
14 | } | 23 | } |
15 | sleep 1 | 24 | sleep 1 |
16 | send -- "cd testdir1\r" | 25 | send -- "cd ~/_firejail_test_dir\r" |
17 | sleep 1 | 26 | sleep 1 |
18 | 27 | ||
19 | send -- "cat .file\r" | 28 | send -- "cat a\r" |
20 | expect { | 29 | expect { |
21 | timeout {puts "TESTING ERROR 1\n";exit} | 30 | timeout {puts "TESTING ERROR 1\n";exit} |
22 | "Permission denied" | 31 | "Permission denied" |
23 | } | 32 | } |
24 | 33 | ||
25 | send -- "ls .directory\r" | 34 | send -- "ls test1\r" |
26 | expect { | 35 | expect { |
27 | timeout {puts "TESTING ERROR 2\n";exit} | 36 | timeout {puts "TESTING ERROR 2\n";exit} |
28 | "Permission denied" | 37 | "Permission denied" |
29 | } | 38 | } |
30 | after 100 | 39 | after 100 |
31 | 40 | ||
32 | puts "\n" | 41 | send -- "exit\r" |
42 | sleep 1 | ||
43 | |||
44 | send -- "rm -fr ~/_firejail_test_dir\r" | ||
45 | after 100 | ||
46 | |||
47 | puts "\nall done\n" | ||
diff --git a/test/fs/private-etc.exp b/test/fs/private-etc.exp index c9a74f96e..7d0e9f619 100755 --- a/test/fs/private-etc.exp +++ b/test/fs/private-etc.exp | |||
@@ -64,9 +64,6 @@ expect { | |||
64 | } | 64 | } |
65 | after 100 | 65 | after 100 |
66 | 66 | ||
67 | 67 | send -- "exit\r" | |
68 | |||
69 | |||
70 | |||
71 | after 100 | 68 | after 100 |
72 | puts "\nall done\n" | 69 | puts "\nall done\n" |
diff --git a/test/fs/private-home-dir.exp b/test/fs/private-home-dir.exp index 75ac5aea5..bd8cab16f 100755 --- a/test/fs/private-home-dir.exp +++ b/test/fs/private-home-dir.exp | |||
@@ -21,13 +21,13 @@ if {[file exists ~/.Xauthority]} { | |||
21 | send -- "touch ~/.Xauthority\r" | 21 | send -- "touch ~/.Xauthority\r" |
22 | } | 22 | } |
23 | after 100 | 23 | after 100 |
24 | send -- "rm -fr ~/_firejail_test_dir_\r" | 24 | send -- "rm -fr ~/_firejail_test_dir1_\r" |
25 | after 100 | 25 | after 100 |
26 | send -- "mkdir ~/_firejail_test_dir_\r" | 26 | send -- "mkdir ~/_firejail_test_dir1_\r" |
27 | sleep 1 | 27 | sleep 1 |
28 | 28 | ||
29 | # testing profile and private | 29 | # testing profile and private |
30 | send -- "firejail --private=~/_firejail_test_dir_\r" | 30 | send -- "firejail --private=~/_firejail_test_dir1_\r" |
31 | expect { | 31 | expect { |
32 | timeout {puts "TESTING ERROR 0\n";exit} | 32 | timeout {puts "TESTING ERROR 0\n";exit} |
33 | "Child process initialized" | 33 | "Child process initialized" |
@@ -67,12 +67,12 @@ expect { | |||
67 | "private directory is not owned by the current user" | 67 | "private directory is not owned by the current user" |
68 | } | 68 | } |
69 | sleep 1 | 69 | sleep 1 |
70 | send -- "mkdir ~/_firejail_test_dir_/test_dir_2\r" | 70 | send -- "mkdir ~/_firejail_test_dir1_/test_dir_2\r" |
71 | after 100 | 71 | after 100 |
72 | send -- "touch ~/_firejail_test_dir_/test_dir_2/testfile\r" | 72 | send -- "touch ~/_firejail_test_dir1_/test_dir_2/testfile\r" |
73 | sleep 1 | 73 | sleep 1 |
74 | 74 | ||
75 | send -- "firejail --debug --noprofile --blacklist=~/test_dir_2 --private=~/_firejail_test_dir_\r" | 75 | send -- "firejail --debug --noprofile --blacklist=~/test_dir_2 --private=~/_firejail_test_dir1_\r" |
76 | expect { | 76 | expect { |
77 | timeout {puts "TESTING ERROR 10\n";exit} | 77 | timeout {puts "TESTING ERROR 10\n";exit} |
78 | "Disable" | 78 | "Disable" |
@@ -98,7 +98,8 @@ after 100 | |||
98 | send "exit\r" | 98 | send "exit\r" |
99 | sleep 1 | 99 | sleep 1 |
100 | 100 | ||
101 | send -- "rm -fr ~/_firejail_test_dir_\r" | 101 | send -- "rm -fr ~/_firejail_test_dir1\r" |
102 | after 100 | 102 | after 100 |
103 | 103 | ||
104 | |||
104 | puts "\nall done\n" | 105 | puts "\nall done\n" |
diff --git a/test/fs/private-home.exp b/test/fs/private-home.exp index 2f297e93f..6fbe8b0f6 100755 --- a/test/fs/private-home.exp +++ b/test/fs/private-home.exp | |||
@@ -95,8 +95,19 @@ expect { | |||
95 | "broken symbolic link" | 95 | "broken symbolic link" |
96 | } | 96 | } |
97 | send -- "exit\r" | 97 | send -- "exit\r" |
98 | sleep 1 | ||
98 | 99 | ||
99 | send -- "rm -f ~/_firejail_test*\r" | 100 | send -- "echo cleanup\r" |
101 | after 100 | ||
102 | send -- "rm -f ~/_firejail_test_file1\r" | ||
103 | after 100 | ||
104 | send -- "rm -f ~/_firejail_test_file2\r" | ||
105 | after 100 | ||
106 | send -- "rm -fr ~/_firejail_test_dir1\r" | ||
107 | after 100 | ||
108 | send -- "rm -f ~/_firejail_test_link1\r" | ||
109 | after 100 | ||
110 | send -- "rm -f ~/_firejail_test_link2\r" | ||
100 | after 100 | 111 | after 100 |
101 | 112 | ||
102 | puts "\nall done\n" | 113 | puts "\nall done\n" |
diff --git a/test/fs/read-write.exp b/test/fs/read-write.exp index ad51c2db1..6c0f755da 100755 --- a/test/fs/read-write.exp +++ b/test/fs/read-write.exp | |||
@@ -7,6 +7,14 @@ set timeout 10 | |||
7 | spawn $env(SHELL) | 7 | spawn $env(SHELL) |
8 | match_max 100000 | 8 | match_max 100000 |
9 | 9 | ||
10 | send -- "mkdir ~/_firejail_test_dir\r" | ||
11 | after 100 | ||
12 | send -- "touch ~/_firejail_test_dir/a\r" | ||
13 | after 100 | ||
14 | send -- "mkdir ~/_firejail_test_dir/test1\r" | ||
15 | after 100 | ||
16 | send -- "touch ~/_firejail_test_dir/test1/b\r" | ||
17 | after 100 | ||
10 | 18 | ||
11 | send -- "firejail --read-only=~/_firejail_test_dir --read-write=~/_firejail_test_dir/test1\r" | 19 | send -- "firejail --read-only=~/_firejail_test_dir --read-write=~/_firejail_test_dir/test1\r" |
12 | expect { | 20 | expect { |
@@ -32,4 +40,9 @@ expect { | |||
32 | } | 40 | } |
33 | 41 | ||
34 | after 100 | 42 | after 100 |
43 | send -- "exit\r" | ||
44 | sleep 1 | ||
45 | |||
46 | send -- "rm -fr ~/_firejail_test_dir\r" | ||
47 | after 100 | ||
35 | puts "\nall done\n" | 48 | puts "\nall done\n" |
diff --git a/test/fs/whitelist-dev.exp b/test/fs/whitelist-dev.exp index ad5c54a9c..d0466bbeb 100755 --- a/test/fs/whitelist-dev.exp +++ b/test/fs/whitelist-dev.exp | |||
@@ -61,6 +61,9 @@ expect { | |||
61 | "19" {puts "OK\n"} | 61 | "19" {puts "OK\n"} |
62 | "20" {puts "OK\n"} | 62 | "20" {puts "OK\n"} |
63 | "21" {puts "OK\n"} | 63 | "21" {puts "OK\n"} |
64 | "22" {puts "OK\n"} | ||
65 | "23" {puts "OK\n"} | ||
66 | "24" {puts "OK\n"} | ||
64 | } | 67 | } |
65 | after 100 | 68 | after 100 |
66 | 69 | ||
diff --git a/test/fs/whitelist-double.exp b/test/fs/whitelist-double.exp index 5ce9d8ad7..e653517a6 100755 --- a/test/fs/whitelist-double.exp +++ b/test/fs/whitelist-double.exp | |||
@@ -7,17 +7,17 @@ set timeout 10 | |||
7 | spawn $env(SHELL) | 7 | spawn $env(SHELL) |
8 | match_max 100000 | 8 | match_max 100000 |
9 | 9 | ||
10 | send -- "echo 123 > /tmp/firejal-deleteme\r" | 10 | send -- "echo 123 > /tmp/_firejail_test_file\r" |
11 | sleep 1 | 11 | sleep 1 |
12 | 12 | ||
13 | send -- "firejail --whitelist=/tmp/firejal-deleteme --whitelist=/tmp/firejal-deleteme\r" | 13 | send -- "firejail --whitelist=/tmp/_firejail_test_file --whitelist=/tmp/_firejail_test_file\r" |
14 | expect { | 14 | expect { |
15 | timeout {puts "TESTING ERROR 0\n";exit} | 15 | timeout {puts "TESTING ERROR 0\n";exit} |
16 | "Child process initialized" | 16 | "Child process initialized" |
17 | } | 17 | } |
18 | sleep 1 | 18 | sleep 1 |
19 | 19 | ||
20 | send -- "cat /tmp/firejal-deleteme\r" | 20 | send -- "cat /tmp/_firejail_test_file\r" |
21 | expect { | 21 | expect { |
22 | timeout {puts "TESTING ERROR 1\n";exit} | 22 | timeout {puts "TESTING ERROR 1\n";exit} |
23 | "123" | 23 | "123" |
@@ -26,13 +26,13 @@ expect { | |||
26 | send -- "exit\r" | 26 | send -- "exit\r" |
27 | sleep 1 | 27 | sleep 1 |
28 | 28 | ||
29 | send -- "cat /tmp/firejal-deleteme\r" | 29 | send -- "cat /tmp/_firejail_test_file\r" |
30 | expect { | 30 | expect { |
31 | timeout {puts "TESTING ERROR 2\n";exit} | 31 | timeout {puts "TESTING ERROR 2\n";exit} |
32 | "123" | 32 | "123" |
33 | } | 33 | } |
34 | 34 | ||
35 | send -- "rm -v /tmp/firejal-deleteme\r" | 35 | send -- "rm -v /tmp/_firejail_test_file\r" |
36 | expect { | 36 | expect { |
37 | timeout {puts "TESTING ERROR 3\n";exit} | 37 | timeout {puts "TESTING ERROR 3\n";exit} |
38 | "removed" | 38 | "removed" |
diff --git a/test/fs/whitelist-readonly.exp b/test/fs/whitelist-readonly.exp index e5c9cc400..f9d78b7c0 100755 --- a/test/fs/whitelist-readonly.exp +++ b/test/fs/whitelist-readonly.exp | |||
@@ -7,6 +7,14 @@ set timeout 10 | |||
7 | spawn $env(SHELL) | 7 | spawn $env(SHELL) |
8 | match_max 100000 | 8 | match_max 100000 |
9 | 9 | ||
10 | send -- "mkdir ~/_firejail_test_dir\r" | ||
11 | after 100 | ||
12 | send -- "touch ~/_firejail_test_dir/a\r" | ||
13 | after 100 | ||
14 | send -- "mkdir ~/_firejail_test_dir/test1\r" | ||
15 | after 100 | ||
16 | send -- "touch ~/_firejail_test_dir/test1/b\r" | ||
17 | after 100 | ||
10 | 18 | ||
11 | send -- "firejail --noprofile --whitelist=~/_firejail_test_dir --read-only=~\r" | 19 | send -- "firejail --noprofile --whitelist=~/_firejail_test_dir --read-only=~\r" |
12 | expect { | 20 | expect { |
@@ -25,4 +33,6 @@ after 100 | |||
25 | send -- "exit\r" | 33 | send -- "exit\r" |
26 | sleep 1 | 34 | sleep 1 |
27 | 35 | ||
36 | send -- "rm -fr ~/_firejail_test_dir\r" | ||
37 | after 100 | ||
28 | puts "\nall done\n" | 38 | puts "\nall done\n" |