diff options
author | valoq <valoq@mailbox.org> | 2016-11-19 22:12:51 +0100 |
---|---|---|
committer | valoq <valoq@mailbox.org> | 2016-11-19 22:12:51 +0100 |
commit | 530db20edeee191a3b60d56b3b87999a3d10979e (patch) | |
tree | 9053d21580917bdf0e6480b2b2875e90b08b1d8c /test/fs | |
parent | readme updated (diff) | |
parent | qemu profile (diff) | |
download | firejail-530db20edeee191a3b60d56b3b87999a3d10979e.tar.gz firejail-530db20edeee191a3b60d56b3b87999a3d10979e.tar.zst firejail-530db20edeee191a3b60d56b3b87999a3d10979e.zip |
fixed readme
Diffstat (limited to 'test/fs')
-rwxr-xr-x | test/fs/fs.sh | 13 | ||||
-rwxr-xr-x | test/fs/fscheck-bindnoroot.exp | 17 | ||||
-rwxr-xr-x | test/fs/fscheck-private.exp | 50 | ||||
-rwxr-xr-x | test/fs/fscheck-readonly.exp | 15 | ||||
-rwxr-xr-x | test/fs/fscheck-tmpfs.exp | 14 | ||||
-rwxr-xr-x | test/fs/invalid_filename.exp | 15 | ||||
-rwxr-xr-x | test/fs/private-bin.exp | 22 | ||||
-rwxr-xr-x | test/fs/private-etc.exp | 34 | ||||
-rwxr-xr-x | test/fs/private-home.exp | 62 | ||||
-rwxr-xr-x | test/fs/read-write.exp | 28 | ||||
-rw-r--r-- | test/fs/testfile1 | 0 |
11 files changed, 242 insertions, 28 deletions
diff --git a/test/fs/fs.sh b/test/fs/fs.sh index efbf505ee..1c5473f79 100755 --- a/test/fs/fs.sh +++ b/test/fs/fs.sh | |||
@@ -82,10 +82,21 @@ echo "TESTING: recursive mkdir (test/fs/mkdir.exp)" | |||
82 | echo "TESTING: double whitelist (test/fs/whitelist-double.exp)" | 82 | echo "TESTING: double whitelist (test/fs/whitelist-double.exp)" |
83 | ./whitelist-double.exp | 83 | ./whitelist-double.exp |
84 | 84 | ||
85 | |||
86 | echo "TESTING: whitelist (test/fs/whitelist.exp)" | 85 | echo "TESTING: whitelist (test/fs/whitelist.exp)" |
87 | ./whitelist.exp | 86 | ./whitelist.exp |
88 | 87 | ||
88 | echo "TESTING: fscheck --bind non root (test/fs/fscheck-bindnoroot.exp)" | ||
89 | ./fscheck-bindnoroot.exp | ||
90 | |||
91 | echo "TESTING: fscheck --tmpfs non root (test/fs/fscheck-tmpfs.exp)" | ||
92 | ./fscheck-tmpfs.exp | ||
93 | |||
94 | echo "TESTING: fscheck --private= (test/fs/fscheck-private.exp)" | ||
95 | ./fscheck-private.exp | ||
96 | |||
97 | echo "TESTING: fscheck --read-only= (test/fs/fscheck-readonly.exp)" | ||
98 | ./fscheck-readonly.exp | ||
99 | |||
89 | #cleanup | 100 | #cleanup |
90 | rm -fr ~/fjtest-dir | 101 | rm -fr ~/fjtest-dir |
91 | rm -fr ~/fjtest-dir-lnk | 102 | rm -fr ~/fjtest-dir-lnk |
diff --git a/test/fs/fscheck-bindnoroot.exp b/test/fs/fscheck-bindnoroot.exp new file mode 100755 index 000000000..8cbe2b8af --- /dev/null +++ b/test/fs/fscheck-bindnoroot.exp | |||
@@ -0,0 +1,17 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | # dir | ||
8 | send -- "firejail --net=br0 --bind=testdir1,/etc\r" | ||
9 | expect { | ||
10 | timeout {puts "TESTING ERROR 0\n";exit} | ||
11 | "Error" | ||
12 | } | ||
13 | after 100 | ||
14 | |||
15 | puts "\nall done\n" | ||
16 | |||
17 | |||
diff --git a/test/fs/fscheck-private.exp b/test/fs/fscheck-private.exp new file mode 100755 index 000000000..28c921538 --- /dev/null +++ b/test/fs/fscheck-private.exp | |||
@@ -0,0 +1,50 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | |||
8 | |||
9 | # file link | ||
10 | #send -- "firejail --private=fscheck-file-link\r" | ||
11 | #expect { | ||
12 | # timeout {puts "TESTING ERROR 2\n";exit} | ||
13 | # "Error" | ||
14 | #} | ||
15 | #after 100 | ||
16 | |||
17 | # file | ||
18 | send -- "firejail --private=testfile1\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 2.1\n";exit} | ||
21 | "Error" | ||
22 | } | ||
23 | after 100 | ||
24 | |||
25 | # .. | ||
26 | send -- "firejail --private=../fs/testfile1\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2.2\n";exit} | ||
29 | "Error" | ||
30 | } | ||
31 | after 100 | ||
32 | |||
33 | # no file | ||
34 | send -- "firejail --private=../test/nodir\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 3\n";exit} | ||
37 | "Error" | ||
38 | } | ||
39 | after 100 | ||
40 | |||
41 | # same owner | ||
42 | send -- "firejail --private=/etc\r" | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 4\n";exit} | ||
45 | "Error" | ||
46 | } | ||
47 | after 100 | ||
48 | |||
49 | puts "\nall done\n" | ||
50 | |||
diff --git a/test/fs/fscheck-readonly.exp b/test/fs/fscheck-readonly.exp new file mode 100755 index 000000000..4d7528e50 --- /dev/null +++ b/test/fs/fscheck-readonly.exp | |||
@@ -0,0 +1,15 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | # dir | ||
8 | send -- "firejail --read-only=../test/testdir1\r" | ||
9 | expect { | ||
10 | timeout {puts "TESTING ERROR 0\n";exit} | ||
11 | "Error" | ||
12 | } | ||
13 | after 100 | ||
14 | |||
15 | puts "\nall done\n" | ||
diff --git a/test/fs/fscheck-tmpfs.exp b/test/fs/fscheck-tmpfs.exp new file mode 100755 index 000000000..deac5a631 --- /dev/null +++ b/test/fs/fscheck-tmpfs.exp | |||
@@ -0,0 +1,14 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | # .. | ||
8 | send -- "firejail --tmpfs=fscheck-dir\r" | ||
9 | expect { | ||
10 | timeout {puts "TESTING ERROR 0.1\n";exit} | ||
11 | "Error" | ||
12 | } | ||
13 | after 100 | ||
14 | |||
diff --git a/test/fs/invalid_filename.exp b/test/fs/invalid_filename.exp index 1acc85491..a6efc24b6 100755 --- a/test/fs/invalid_filename.exp +++ b/test/fs/invalid_filename.exp | |||
@@ -109,6 +109,21 @@ expect { | |||
109 | } | 109 | } |
110 | after 100 | 110 | after 100 |
111 | 111 | ||
112 | send -- "firejail --debug-check-filename --noprofile --private-home=\"bla&&bla\"\r" | ||
113 | expect { | ||
114 | timeout {puts "TESTING ERROR 8.1\n";exit} | ||
115 | "Checking filename bla&&bla" | ||
116 | } | ||
117 | expect { | ||
118 | timeout {puts "TESTING ERROR 8.2\n";exit} | ||
119 | "Error:" | ||
120 | } | ||
121 | expect { | ||
122 | timeout {puts "TESTING ERROR 8.3\n";exit} | ||
123 | "is an invalid filename" | ||
124 | } | ||
125 | after 100 | ||
126 | |||
112 | send -- "firejail --debug-check-filename --noprofile --private-etc=\"bla&&bla\"\r" | 127 | send -- "firejail --debug-check-filename --noprofile --private-etc=\"bla&&bla\"\r" |
113 | expect { | 128 | expect { |
114 | timeout {puts "TESTING ERROR 9.1\n";exit} | 129 | timeout {puts "TESTING ERROR 9.1\n";exit} |
diff --git a/test/fs/private-bin.exp b/test/fs/private-bin.exp index fe9468be9..f7181d218 100755 --- a/test/fs/private-bin.exp +++ b/test/fs/private-bin.exp | |||
@@ -65,6 +65,28 @@ expect { | |||
65 | "sh" | 65 | "sh" |
66 | } | 66 | } |
67 | send -- "exit\r" | 67 | send -- "exit\r" |
68 | after 100 | ||
69 | |||
70 | |||
71 | send -- "firejail --private-bin=/etc/shadow\r" | ||
72 | expect { | ||
73 | timeout {puts "TESTING ERROR 8\n";exit} | ||
74 | "invalid filename" | ||
75 | } | ||
76 | after 100 | ||
77 | |||
78 | send -- "firejail --private-bin=\"bla;bla\"\r" | ||
79 | expect { | ||
80 | timeout {puts "TESTING ERROR 9\n";exit} | ||
81 | "is an invalid filename" | ||
82 | } | ||
83 | after 100 | ||
84 | |||
85 | send -- "firejail --private-etc=../bin/ls\r" | ||
86 | expect { | ||
87 | timeout {puts "TESTING ERROR 10\n";exit} | ||
88 | "is an invalid filename" | ||
89 | } | ||
68 | 90 | ||
69 | after 100 | 91 | after 100 |
70 | puts "\nall done\n" | 92 | puts "\nall done\n" |
diff --git a/test/fs/private-etc.exp b/test/fs/private-etc.exp index e692f7382..36b5d247c 100755 --- a/test/fs/private-etc.exp +++ b/test/fs/private-etc.exp | |||
@@ -33,12 +33,40 @@ expect { | |||
33 | "resolv.conf" | 33 | "resolv.conf" |
34 | } | 34 | } |
35 | 35 | ||
36 | send -- "ls -al /etc; echo done\r" | 36 | |
37 | send -- "file /etc/shadow\r" | ||
37 | expect { | 38 | expect { |
38 | timeout {puts "TESTING ERROR 7\n";exit} | 39 | timeout {puts "TESTING ERROR 7\n";exit} |
39 | "shadow" {puts "TESTING ERROR 8\n";exit} | 40 | "No such file or directory" |
40 | "done" | 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" | ||
41 | } | 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 | |||
68 | |||
69 | |||
42 | 70 | ||
43 | after 100 | 71 | after 100 |
44 | puts "\nall done\n" | 72 | puts "\nall done\n" |
diff --git a/test/fs/private-home.exp b/test/fs/private-home.exp index de5a88dea..3840d1cb8 100755 --- a/test/fs/private-home.exp +++ b/test/fs/private-home.exp | |||
@@ -9,11 +9,19 @@ match_max 100000 | |||
9 | 9 | ||
10 | # create some test files in user home directory | 10 | # create some test files in user home directory |
11 | send -- "touch ~/_firejail_test_file1\r" | 11 | send -- "touch ~/_firejail_test_file1\r" |
12 | after 100 | ||
12 | send -- "touch ~/_firejail_test_file2\r" | 13 | send -- "touch ~/_firejail_test_file2\r" |
14 | after 100 | ||
13 | send -- "mkdir ~/_firejail_test_dir1\r" | 15 | send -- "mkdir ~/_firejail_test_dir1\r" |
16 | after 100 | ||
14 | send -- "mkdir ~/_firejail_test_dir1/_firejail_test_dir2\r" | 17 | send -- "mkdir ~/_firejail_test_dir1/_firejail_test_dir2\r" |
18 | after 100 | ||
15 | send -- "touch ~/_firejail_test_dir1/_firejail_test_dir2/_firejail_test_file3\r" | 19 | send -- "touch ~/_firejail_test_dir1/_firejail_test_dir2/_firejail_test_file3\r" |
16 | after 100 | 20 | after 100 |
21 | send -- "ln -s /etc ~/_firejail_test_link1\r" | ||
22 | after 100 | ||
23 | send -- "ln -s ~/_firejail_test_dir1 ~/_firejail_test_link2\r" | ||
24 | after 100 | ||
17 | 25 | ||
18 | send -- "firejail --private-home=_firejail_test_file1,_firejail_test_file2,_firejail_test_dir1\r" | 26 | send -- "firejail --private-home=_firejail_test_file1,_firejail_test_file2,_firejail_test_dir1\r" |
19 | expect { | 27 | expect { |
@@ -37,8 +45,58 @@ expect { | |||
37 | } | 45 | } |
38 | after 100 | 46 | after 100 |
39 | 47 | ||
40 | send -- "rm -f ~/_firejail_test_file*\r" | 48 | send -- "exit\r" |
41 | send -- "rm -fr ~/_firejail_test_dir*\r" | 49 | sleep 1 |
50 | |||
51 | send -- "firejail --private-home=\"bla;bla\"\r" | ||
52 | expect { | ||
53 | timeout {puts "TESTING ERROR 5\n";exit} | ||
54 | "is an invalid filename" | ||
55 | } | ||
56 | after 100 | ||
57 | |||
58 | send -- "firejail --private-home=/etc/shadow\r" | ||
59 | expect { | ||
60 | timeout {puts "TESTING ERROR 6\n";exit} | ||
61 | "invalid file" | ||
62 | } | ||
63 | after 100 | ||
64 | |||
65 | send -- "firejail --private-home=/etc/passwd\r" | ||
66 | expect { | ||
67 | timeout {puts "TESTING ERROR 7\n";exit} | ||
68 | "invalid file" | ||
69 | } | ||
70 | after 100 | ||
71 | |||
72 | send -- "firejail --private-home=../../etc/passwd\r" | ||
73 | expect { | ||
74 | timeout {puts "TESTING ERROR 8\n";exit} | ||
75 | "invalid file" | ||
76 | } | ||
77 | after 100 | ||
78 | |||
79 | send -- "firejail --private-home=_firejail_test_link1\r" | ||
80 | expect { | ||
81 | timeout {puts "TESTING ERROR 9\n";exit} | ||
82 | "to file or directory not owned by the user" | ||
83 | } | ||
84 | after 100 | ||
85 | |||
86 | send -- "firejail --private-home=_firejail_test_link2\r" | ||
87 | expect { | ||
88 | timeout {puts "TESTING ERROR 10\n";exit} | ||
89 | "Child process initialized" | ||
90 | } | ||
91 | after 100 | ||
92 | send -- "file file ~/_firejail_test_link2\r" | ||
93 | expect { | ||
94 | timeout {puts "TESTING ERROR 11\n";exit} | ||
95 | "broken symbolic link" | ||
96 | } | ||
97 | send -- "exit\r" | ||
98 | |||
99 | send -- "rm -f ~/_firejail_test*\r" | ||
42 | after 100 | 100 | after 100 |
43 | 101 | ||
44 | puts "\nall done\n" | 102 | puts "\nall done\n" |
diff --git a/test/fs/read-write.exp b/test/fs/read-write.exp index 57986488e..19a915f66 100755 --- a/test/fs/read-write.exp +++ b/test/fs/read-write.exp | |||
@@ -15,37 +15,21 @@ expect { | |||
15 | } | 15 | } |
16 | sleep 1 | 16 | sleep 1 |
17 | 17 | ||
18 | send -- "echo mytest >~/_firejail_test_dir/a;echo done\r" | 18 | send -- "echo mytest > ~/_firejail_test_dir/a\r" |
19 | expect { | 19 | expect { |
20 | timeout {puts "TESTING ERROR 1\n";exit} | 20 | timeout {puts "TESTING ERROR 5\n";exit} |
21 | "done" | 21 | "Read-only file system" |
22 | } | ||
23 | after 100 | ||
24 | |||
25 | send -- "echo mytest >~/_firejail_test_dir/test1/b;echo done\r" | ||
26 | expect { | ||
27 | timeout {puts "TESTING ERROR 2\n";exit} | ||
28 | "done" | ||
29 | } | 22 | } |
30 | after 100 | 23 | after 100 |
31 | 24 | ||
32 | send -- "cat ~/_firejail_test_dir/a;echo done\r" | 25 | send -- "echo mytest > ~/_firejail_test_dir/test1/b\r" |
33 | expect { | 26 | sleep 1 |
34 | timeout {puts "TESTING ERROR 3\n";exit} | ||
35 | "mytest" {puts "TESTING ERROR 4\n";exit} | ||
36 | "done" | ||
37 | } | ||
38 | after 100 | ||
39 | 27 | ||
40 | send -- "cat ~/_firejail_test_dir/test1/b;echo done\r" | 28 | send -- "cat ~/_firejail_test_dir/test1/b\r" |
41 | expect { | 29 | expect { |
42 | timeout {puts "TESTING ERROR 5\n";exit} | 30 | timeout {puts "TESTING ERROR 5\n";exit} |
43 | "mytest" | 31 | "mytest" |
44 | } | 32 | } |
45 | expect { | ||
46 | timeout {puts "TESTING ERROR 6\n";exit} | ||
47 | "done" | ||
48 | } | ||
49 | 33 | ||
50 | after 100 | 34 | after 100 |
51 | puts "\nall done\n" | 35 | puts "\nall done\n" |
diff --git a/test/fs/testfile1 b/test/fs/testfile1 new file mode 100644 index 000000000..e69de29bb --- /dev/null +++ b/test/fs/testfile1 | |||