diff options
author | netblue30 <netblue30@yahoo.com> | 2020-05-18 07:33:28 -0400 |
---|---|---|
committer | netblue30 <netblue30@yahoo.com> | 2020-05-18 07:33:28 -0400 |
commit | e7a61d334b704b3fb8dd2da1f6fdace918274fa3 (patch) | |
tree | 9ac2b114a0eca9309e1ccdcacd956a2ff12f18a7 /test | |
parent | better blacklist ordering (diff) | |
download | firejail-e7a61d334b704b3fb8dd2da1f6fdace918274fa3.tar.gz firejail-e7a61d334b704b3fb8dd2da1f6fdace918274fa3.tar.zst firejail-e7a61d334b704b3fb8dd2da1f6fdace918274fa3.zip |
fixing some of the tests
Diffstat (limited to 'test')
-rwxr-xr-x | test/fs/mkdir_mkfile.exp | 14 | ||||
-rwxr-xr-x | test/utils/build.exp | 56 | ||||
-rwxr-xr-x | test/utils/utils.sh | 5 |
3 files changed, 31 insertions, 44 deletions
diff --git a/test/fs/mkdir_mkfile.exp b/test/fs/mkdir_mkfile.exp index 109984035..82dab1ddf 100755 --- a/test/fs/mkdir_mkfile.exp +++ b/test/fs/mkdir_mkfile.exp | |||
@@ -22,23 +22,23 @@ expect { | |||
22 | "_firejail_test_dir" | 22 | "_firejail_test_dir" |
23 | } | 23 | } |
24 | expect { | 24 | expect { |
25 | timeout {puts "TESTING ERROR 1\n";exit} | 25 | timeout {puts "TESTING ERROR 2\n";exit} |
26 | "_firejail_test_dir/dir1" | 26 | "_firejail_test_dir/dir1" |
27 | } | 27 | } |
28 | expect { | 28 | expect { |
29 | timeout {puts "TESTING ERROR 1\n";exit} | 29 | timeout {puts "TESTING ERROR 3\n";exit} |
30 | "_firejail_test_dir/dir1/dir2" | 30 | "_firejail_test_dir/dir1/dir2" |
31 | } | 31 | } |
32 | expect { | 32 | expect { |
33 | timeout {puts "TESTING ERROR 1\n";exit} | 33 | timeout {puts "TESTING ERROR 4\n";exit} |
34 | "_firejail_test_dir/dir1/dir2/dir3" | 34 | "_firejail_test_dir/dir1/dir2/dir3" |
35 | } | 35 | } |
36 | expect { | 36 | expect { |
37 | timeout {puts "TESTING ERROR 1\n";exit} | 37 | timeout {puts "TESTING ERROR 5\n";exit} |
38 | "_firejail_test_dir/dir1/dir2/dir3/file1" | 38 | "_firejail_test_dir/dir1/dir2/dir3/file1" |
39 | } | 39 | } |
40 | expect { | 40 | expect { |
41 | timeout {puts "TESTING ERROR 1\n";exit} | 41 | timeout {puts "TESTING ERROR 6\n";exit} |
42 | "_firejail_test_file" | 42 | "_firejail_test_file" |
43 | } | 43 | } |
44 | after 100 | 44 | after 100 |
@@ -47,8 +47,8 @@ after 100 | |||
47 | 47 | ||
48 | send -- "firejail --profile=mkfile.profile\r" | 48 | send -- "firejail --profile=mkfile.profile\r" |
49 | expect { | 49 | expect { |
50 | timeout {puts "TESTING ERROR 1\n";exit} | 50 | timeout {puts "TESTING ERROR 7\n";exit} |
51 | "only files in user home or /tmp" | 51 | "only files or directories in user home, /tmp" |
52 | } | 52 | } |
53 | after 100 | 53 | after 100 |
54 | 54 | ||
diff --git a/test/utils/build.exp b/test/utils/build.exp index ae46ffa6e..ac4f30326 100755 --- a/test/utils/build.exp +++ b/test/utils/build.exp | |||
@@ -7,22 +7,21 @@ set timeout 10 | |||
7 | spawn $env(SHELL) | 7 | spawn $env(SHELL) |
8 | match_max 100000 | 8 | match_max 100000 |
9 | 9 | ||
10 | send -- "echo testing > ~/firejail-test-file-7699\r" | ||
11 | after 100 | ||
12 | |||
10 | send -- "firejail --build cat ~/firejail-test-file-7699\r" | 13 | send -- "firejail --build cat ~/firejail-test-file-7699\r" |
11 | expect { | 14 | expect { |
12 | timeout {puts "TESTING ERROR 0\n";exit} | 15 | timeout {puts "TESTING ERROR 0\n";exit} |
13 | "whitelist ~/firejail-test-file-7699" | 16 | "whitelist $\{HOME\}/firejail-test-file-7699" |
14 | } | ||
15 | expect { | ||
16 | timeout {puts "TESTING ERROR 0.1\n";exit} | ||
17 | "include /etc/firejail/whitelist-common.inc" | ||
18 | } | 17 | } |
19 | expect { | 18 | expect { |
20 | timeout {puts "TESTING ERROR 1\n";exit} | 19 | timeout {puts "TESTING ERROR 1\n";exit} |
21 | "private-tmp" | 20 | "include whitelist-common.inc" |
22 | } | 21 | } |
23 | expect { | 22 | expect { |
24 | timeout {puts "TESTING ERROR 2\n";exit} | 23 | timeout {puts "TESTING ERROR 2\n";exit} |
25 | "private-dev" | 24 | "blacklist /usr/share" |
26 | } | 25 | } |
27 | expect { | 26 | expect { |
28 | timeout {puts "TESTING ERROR 3\n";exit} | 27 | timeout {puts "TESTING ERROR 3\n";exit} |
@@ -34,26 +33,40 @@ expect { | |||
34 | } | 33 | } |
35 | expect { | 34 | expect { |
36 | timeout {puts "TESTING ERROR 5\n";exit} | 35 | timeout {puts "TESTING ERROR 5\n";exit} |
37 | "caps.drop all" | 36 | "private-dev" |
38 | } | 37 | } |
39 | expect { | 38 | expect { |
40 | timeout {puts "TESTING ERROR 6\n";exit} | 39 | timeout {puts "TESTING ERROR 6\n";exit} |
41 | "nonewprivs" | 40 | "private-etc" |
42 | } | 41 | } |
43 | expect { | 42 | expect { |
44 | timeout {puts "TESTING ERROR 7\n";exit} | 43 | timeout {puts "TESTING ERROR 7\n";exit} |
45 | "seccomp" | 44 | "private-tmp" |
46 | } | 45 | } |
47 | expect { | 46 | expect { |
48 | timeout {puts "TESTING ERROR 8\n";exit} | 47 | timeout {puts "TESTING ERROR 8\n";exit} |
49 | "net none" | 48 | "caps.drop all" |
50 | } | 49 | } |
51 | expect { | 50 | expect { |
52 | timeout {puts "TESTING ERROR 9\n";exit} | 51 | timeout {puts "TESTING ERROR 9\n";exit} |
52 | "nonewprivs" | ||
53 | } | ||
54 | expect { | ||
55 | timeout {puts "TESTING ERROR 10\n";exit} | ||
56 | "seccomp" | ||
57 | } | ||
58 | expect { | ||
59 | timeout {puts "TESTING ERROR 11\n";exit} | ||
60 | "net none" | ||
61 | } | ||
62 | expect { | ||
63 | timeout {puts "TESTING ERROR 12\n";exit} | ||
53 | "shell none" | 64 | "shell none" |
54 | } | 65 | } |
55 | after 100 | 66 | after 100 |
56 | 67 | ||
68 | |||
69 | |||
57 | send -- "firejail --build cat /etc/passwd\r" | 70 | send -- "firejail --build cat /etc/passwd\r" |
58 | expect { | 71 | expect { |
59 | timeout {puts "TESTING ERROR 10\n";exit} | 72 | timeout {puts "TESTING ERROR 10\n";exit} |
@@ -72,21 +85,6 @@ expect { | |||
72 | } | 85 | } |
73 | after 100 | 86 | after 100 |
74 | 87 | ||
75 | |||
76 | #send -- "firejail --build cat /var/tmp/firejail-test-file-7699\r" | ||
77 | #expect { | ||
78 | # timeout {puts "TESTING ERROR 11\n";exit} | ||
79 | # "whitelist /var/tmp/firejail-test-file-7699" | ||
80 | #} | ||
81 | #after 100 | ||
82 | |||
83 | #send -- "firejail --build man firejail\r" | ||
84 | #expect { | ||
85 | # timeout {puts "TESTING ERROR 12\n";exit} | ||
86 | # "whitelist /usr/share/man" | ||
87 | #} | ||
88 | #after 100 | ||
89 | |||
90 | send -- "firejail --build wget --output-document=~ debian.org\r" | 88 | send -- "firejail --build wget --output-document=~ debian.org\r" |
91 | expect { | 89 | expect { |
92 | timeout {puts "TESTING ERROR 13\n";exit} | 90 | timeout {puts "TESTING ERROR 13\n";exit} |
@@ -98,10 +96,4 @@ expect { | |||
98 | } | 96 | } |
99 | after 100 | 97 | after 100 |
100 | 98 | ||
101 | |||
102 | send -- "firejail --build cat /tmp/firejail-test-file-7699\r" | ||
103 | #todo - bug: it comes back with private-tmp | ||
104 | sleep 1 | ||
105 | |||
106 | |||
107 | puts "all done\n" | 99 | puts "all done\n" |
diff --git a/test/utils/utils.sh b/test/utils/utils.sh index 82ccc82bb..48a8051fa 100755 --- a/test/utils/utils.sh +++ b/test/utils/utils.sh | |||
@@ -13,14 +13,9 @@ if [ -f /etc/debian_version ]; then | |||
13 | fi | 13 | fi |
14 | export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail" | 14 | export PATH="$PATH:/usr/lib/firejail:/usr/lib64/firejail" |
15 | 15 | ||
16 | echo "testing" > ~/firejail-test-file-7699 | ||
17 | echo "testing" > /tmp/firejail-test-file-7699 | ||
18 | echo "testing" > /var/tmp/firejail-test-file-7699 | ||
19 | echo "TESTING: build (test/utils/build.exp)" | 16 | echo "TESTING: build (test/utils/build.exp)" |
20 | ./build.exp | 17 | ./build.exp |
21 | rm -f ~/firejail-test-file-7699 | 18 | rm -f ~/firejail-test-file-7699 |
22 | rm -f /tmp/firejail-test-file-7699 | ||
23 | rm -f /var/tmp/firejail-test-file-7699 | ||
24 | rm -f firejail-test-file-4388 | 19 | rm -f firejail-test-file-4388 |
25 | 20 | ||
26 | if [ $(readlink /proc/self) -lt 100 ]; then | 21 | if [ $(readlink /proc/self) -lt 100 ]; then |