aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2016-11-18 09:11:30 -0500
committerLibravatar netblue30 <netblue30@yahoo.com>2016-11-18 09:11:30 -0500
commit8c2b460d143d8dda4a86b826c0920918aa15f1f7 (patch)
treeeae4c3a6f4805f0940e487299ccad8804665c843 /test
parenttesting appimage (diff)
downloadfirejail-8c2b460d143d8dda4a86b826c0920918aa15f1f7.tar.gz
firejail-8c2b460d143d8dda4a86b826c0920918aa15f1f7.tar.zst
firejail-8c2b460d143d8dda4a86b826c0920918aa15f1f7.zip
fcopy part 4
Diffstat (limited to 'test')
-rwxr-xr-xtest/environment/dns.exp26
-rwxr-xr-xtest/fs/invalid_filename.exp15
-rwxr-xr-xtest/fs/private-etc.exp34
-rwxr-xr-xtest/fs/private-home.exp62
4 files changed, 131 insertions, 6 deletions
diff --git a/test/environment/dns.exp b/test/environment/dns.exp
index 6ffb124cf..a6a7171eb 100755
--- a/test/environment/dns.exp
+++ b/test/environment/dns.exp
@@ -22,9 +22,33 @@ expect {
22 timeout {puts "TESTING ERROR 1.2\n";exit} 22 timeout {puts "TESTING ERROR 1.2\n";exit}
23 "53" 23 "53"
24} 24}
25
26after 100 25after 100
27 26
28send -- "rm index.html\r" 27send -- "rm index.html\r"
29after 100 28after 100
29send -- "exit\r"
30sleep 1
31
32send -- "firejail --dns=8.8.4.4 --dns=8.8.8.8 --dns=4.2.2.1\r"
33expect {
34 timeout {puts "TESTING ERROR 2.1\n";exit}
35 "Child process initialized"
36}
37sleep 1
38
39send -- "cat /etc/resolv.conf\r"
40expect {
41 timeout {puts "TESTING ERROR 2.2\n";exit}
42 "nameserver 8.8.4.4"
43}
44expect {
45 timeout {puts "TESTING ERROR 2.3\n";exit}
46 "nameserver 8.8.8.8"
47}
48expect {
49 timeout {puts "TESTING ERROR 2.4\n";exit}
50 "nameserver 4.2.2.1"
51}
52after 100
53
30puts "\nall done\n" 54puts "\nall done\n"
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}
110after 100 110after 100
111 111
112send -- "firejail --debug-check-filename --noprofile --private-home=\"bla&&bla\"\r"
113expect {
114 timeout {puts "TESTING ERROR 8.1\n";exit}
115 "Checking filename bla&&bla"
116}
117expect {
118 timeout {puts "TESTING ERROR 8.2\n";exit}
119 "Error:"
120}
121expect {
122 timeout {puts "TESTING ERROR 8.3\n";exit}
123 "is an invalid filename"
124}
125after 100
126
112send -- "firejail --debug-check-filename --noprofile --private-etc=\"bla&&bla\"\r" 127send -- "firejail --debug-check-filename --noprofile --private-etc=\"bla&&bla\"\r"
113expect { 128expect {
114 timeout {puts "TESTING ERROR 9.1\n";exit} 129 timeout {puts "TESTING ERROR 9.1\n";exit}
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
36send -- "ls -al /etc; echo done\r" 36
37send -- "file /etc/shadow\r"
37expect { 38expect {
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}
42after 100
43send -- "exit\r"
44sleep 1
45
46send -- "firejail --private-etc=shadow\r"
47expect {
48 timeout {puts "TESTING ERROR 8\n";exit}
49 "invalid file type"
50}
51after 100
52
53send -- "firejail --private-etc=\"bla;bla\"\r"
54expect {
55 timeout {puts "TESTING ERROR 9\n";exit}
56 "is an invalid filename"
41} 57}
58after 100
59
60send -- "firejail --private-etc=../bin/ls\r"
61expect {
62 timeout {puts "TESTING ERROR 10\n";exit}
63 "is an invalid filename"
64}
65after 100
66
67
68
69
42 70
43after 100 71after 100
44puts "\nall done\n" 72puts "\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
11send -- "touch ~/_firejail_test_file1\r" 11send -- "touch ~/_firejail_test_file1\r"
12after 100
12send -- "touch ~/_firejail_test_file2\r" 13send -- "touch ~/_firejail_test_file2\r"
14after 100
13send -- "mkdir ~/_firejail_test_dir1\r" 15send -- "mkdir ~/_firejail_test_dir1\r"
16after 100
14send -- "mkdir ~/_firejail_test_dir1/_firejail_test_dir2\r" 17send -- "mkdir ~/_firejail_test_dir1/_firejail_test_dir2\r"
18after 100
15send -- "touch ~/_firejail_test_dir1/_firejail_test_dir2/_firejail_test_file3\r" 19send -- "touch ~/_firejail_test_dir1/_firejail_test_dir2/_firejail_test_file3\r"
16after 100 20after 100
21send -- "ln -s /etc ~/_firejail_test_link1\r"
22after 100
23send -- "ln -s ~/_firejail_test_dir1 ~/_firejail_test_link2\r"
24after 100
17 25
18send -- "firejail --private-home=_firejail_test_file1,_firejail_test_file2,_firejail_test_dir1\r" 26send -- "firejail --private-home=_firejail_test_file1,_firejail_test_file2,_firejail_test_dir1\r"
19expect { 27expect {
@@ -37,8 +45,58 @@ expect {
37} 45}
38after 100 46after 100
39 47
40send -- "rm -f ~/_firejail_test_file*\r" 48send -- "exit\r"
41send -- "rm -fr ~/_firejail_test_dir*\r" 49sleep 1
50
51send -- "firejail --private-home=\"bla;bla\"\r"
52expect {
53 timeout {puts "TESTING ERROR 5\n";exit}
54 "is an invalid filename"
55}
56after 100
57
58send -- "firejail --private-home=/etc/shadow\r"
59expect {
60 timeout {puts "TESTING ERROR 6\n";exit}
61 "invalid file"
62}
63after 100
64
65send -- "firejail --private-home=/etc/passwd\r"
66expect {
67 timeout {puts "TESTING ERROR 7\n";exit}
68 "invalid file"
69}
70after 100
71
72send -- "firejail --private-home=../../etc/passwd\r"
73expect {
74 timeout {puts "TESTING ERROR 8\n";exit}
75 "invalid file"
76}
77after 100
78
79send -- "firejail --private-home=_firejail_test_link1\r"
80expect {
81 timeout {puts "TESTING ERROR 9\n";exit}
82 "to file or directory not owned by the user"
83}
84after 100
85
86send -- "firejail --private-home=_firejail_test_link2\r"
87expect {
88 timeout {puts "TESTING ERROR 10\n";exit}
89 "Child process initialized"
90}
91after 100
92send -- "file file ~/_firejail_test_link2\r"
93expect {
94 timeout {puts "TESTING ERROR 11\n";exit}
95 "broken symbolic link"
96}
97send -- "exit\r"
98
99send -- "rm -f ~/_firejail_test*\r"
42after 100 100after 100
43 101
44puts "\nall done\n" 102puts "\nall done\n"