diff options
author | netblue30 <netblue30@yahoo.com> | 2016-11-16 20:11:29 -0500 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2016-11-16 20:11:29 -0500 |
commit | f233eee37465218ff2b8a7b8806f1d85ea757c70 (patch) | |
tree | 3cfa0efd5b7a3ae0e1d864e0f92487221d38badd /test | |
parent | fcopy part 2 (diff) | |
download | firejail-f233eee37465218ff2b8a7b8806f1d85ea757c70.tar.gz firejail-f233eee37465218ff2b8a7b8806f1d85ea757c70.tar.zst firejail-f233eee37465218ff2b8a7b8806f1d85ea757c70.zip |
testing
Diffstat (limited to 'test')
-rwxr-xr-x | test/fs/fs.sh | 13 | ||||
-rwxr-xr-x | test/fs/fscheck-bindnoroot.exp (renamed from test/fscheck-bindnoroot.exp) | 5 | ||||
-rwxr-xr-x | test/fs/fscheck-private.exp | 50 | ||||
-rwxr-xr-x | test/fs/fscheck-readonly.exp (renamed from test/fscheck-readonly.exp) | 3 | ||||
-rwxr-xr-x | test/fs/fscheck-tmpfs.exp (renamed from test/fscheck-tmpfs.exp) | 2 | ||||
-rwxr-xr-x | test/fs/read-write.exp | 28 | ||||
-rw-r--r-- | test/fs/testfile1 | 0 | ||||
-rwxr-xr-x | test/fscheck-private.exp | 70 |
8 files changed, 75 insertions, 96 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/fscheck-bindnoroot.exp b/test/fs/fscheck-bindnoroot.exp index 796a7d975..8cbe2b8af 100755 --- a/test/fscheck-bindnoroot.exp +++ b/test/fs/fscheck-bindnoroot.exp | |||
@@ -5,10 +5,13 @@ spawn $env(SHELL) | |||
5 | match_max 100000 | 5 | match_max 100000 |
6 | 6 | ||
7 | # dir | 7 | # dir |
8 | send -- "firejail --net=br0 --bind=fscheck-dir,/etc\r" | 8 | send -- "firejail --net=br0 --bind=testdir1,/etc\r" |
9 | expect { | 9 | expect { |
10 | timeout {puts "TESTING ERROR 0\n";exit} | 10 | timeout {puts "TESTING ERROR 0\n";exit} |
11 | "Error" | 11 | "Error" |
12 | } | 12 | } |
13 | after 100 | 13 | after 100 |
14 | 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/fscheck-readonly.exp b/test/fs/fscheck-readonly.exp index e0f0a8a1d..4d7528e50 100755 --- a/test/fscheck-readonly.exp +++ b/test/fs/fscheck-readonly.exp | |||
@@ -5,10 +5,11 @@ spawn $env(SHELL) | |||
5 | match_max 100000 | 5 | match_max 100000 |
6 | 6 | ||
7 | # dir | 7 | # dir |
8 | send -- "firejail --net=br0 --read-only=../test/fscheck-dir\r" | 8 | send -- "firejail --read-only=../test/testdir1\r" |
9 | expect { | 9 | expect { |
10 | timeout {puts "TESTING ERROR 0\n";exit} | 10 | timeout {puts "TESTING ERROR 0\n";exit} |
11 | "Error" | 11 | "Error" |
12 | } | 12 | } |
13 | after 100 | 13 | after 100 |
14 | 14 | ||
15 | puts "\nall done\n" | ||
diff --git a/test/fscheck-tmpfs.exp b/test/fs/fscheck-tmpfs.exp index d5bbccd96..deac5a631 100755 --- a/test/fscheck-tmpfs.exp +++ b/test/fs/fscheck-tmpfs.exp | |||
@@ -5,7 +5,7 @@ spawn $env(SHELL) | |||
5 | match_max 100000 | 5 | match_max 100000 |
6 | 6 | ||
7 | # .. | 7 | # .. |
8 | send -- "firejail --net=br0 --tmpfs=../test/fscheck-dir\r" | 8 | send -- "firejail --tmpfs=fscheck-dir\r" |
9 | expect { | 9 | expect { |
10 | timeout {puts "TESTING ERROR 0.1\n";exit} | 10 | timeout {puts "TESTING ERROR 0.1\n";exit} |
11 | "Error" | 11 | "Error" |
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 | |||
diff --git a/test/fscheck-private.exp b/test/fscheck-private.exp deleted file mode 100755 index 8e485cc03..000000000 --- a/test/fscheck-private.exp +++ /dev/null | |||
@@ -1,70 +0,0 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | |||
3 | set timeout 10 | ||
4 | spawn $env(SHELL) | ||
5 | match_max 100000 | ||
6 | |||
7 | |||
8 | # .. | ||
9 | #send -- "firejail --net=br0 --private=../test/fscheck-dir\r" | ||
10 | #expect { | ||
11 | # timeout {puts "TESTING ERROR 0.1\n";exit} | ||
12 | # "Error" | ||
13 | #} | ||
14 | #after 100 | ||
15 | |||
16 | # dir link | ||
17 | #send -- "firejail --net=br0 --private=fscheck-dir-link\r" | ||
18 | #expect { | ||
19 | # timeout {puts "TESTING ERROR 1\n";exit} | ||
20 | # "Error" | ||
21 | #} | ||
22 | #after 100 | ||
23 | |||
24 | # .. | ||
25 | #send -- "firejail --net=br0 --private=../test/fscheck-dir-link\r" | ||
26 | #expect { | ||
27 | # timeout {puts "TESTING ERROR 1.1\n";exit} | ||
28 | # "Error" | ||
29 | #} | ||
30 | #after 100 | ||
31 | |||
32 | # file link | ||
33 | send -- "firejail --net=br0 --private=fscheck-file-link\r" | ||
34 | expect { | ||
35 | timeout {puts "TESTING ERROR 2\n";exit} | ||
36 | "Error" | ||
37 | } | ||
38 | after 100 | ||
39 | |||
40 | # file | ||
41 | send -- "firejail --net=br0 --private=fscheck-file\r" | ||
42 | expect { | ||
43 | timeout {puts "TESTING ERROR 2.1\n";exit} | ||
44 | "Error" | ||
45 | } | ||
46 | after 100 | ||
47 | |||
48 | # .. | ||
49 | send -- "firejail --net=br0 --private=../test/fscheck-file\r" | ||
50 | expect { | ||
51 | timeout {puts "TESTING ERROR 2.2\n";exit} | ||
52 | "Error" | ||
53 | } | ||
54 | after 100 | ||
55 | |||
56 | # no file | ||
57 | send -- "firejail --net=br0 --private=../test/nodir\r" | ||
58 | expect { | ||
59 | timeout {puts "TESTING ERROR 3\n";exit} | ||
60 | "Error" | ||
61 | } | ||
62 | after 100 | ||
63 | |||
64 | # same owner | ||
65 | send -- "firejail --net=br0 --private=/etc\r" | ||
66 | expect { | ||
67 | timeout {puts "TESTING ERROR 4\n";exit} | ||
68 | "Error" | ||
69 | } | ||
70 | after 100 | ||