aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2017-08-21 08:51:08 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2017-08-21 08:51:08 -0400
commit495f1c5cdaeeadafcf150080545ae4848dc633ca (patch)
tree88f40d13cc2ecea7e03447431b39489a26fc2b01
parentcompile fixes (diff)
downloadfirejail-495f1c5cdaeeadafcf150080545ae4848dc633ca.tar.gz
firejail-495f1c5cdaeeadafcf150080545ae4848dc633ca.tar.zst
firejail-495f1c5cdaeeadafcf150080545ae4848dc633ca.zip
testing
-rwxr-xr-xtest/filters/debug.exp3
-rwxr-xr-xtest/filters/filters.sh10
-rwxr-xr-xtest/filters/memwrexe-32bin0 -> 6678 bytes
-rwxr-xr-xtest/filters/memwrexe-32.exp34
-rwxr-xr-xtest/filters/seccomp-debug-32.exp145
-rwxr-xr-xtest/filters/seccomp-debug.exp2
6 files changed, 190 insertions, 4 deletions
diff --git a/test/filters/debug.exp b/test/filters/debug.exp
index 493022c05..d37353378 100755
--- a/test/filters/debug.exp
+++ b/test/filters/debug.exp
@@ -38,7 +38,8 @@ after 100
38send -- "firejail --debug-protocols\r" 38send -- "firejail --debug-protocols\r"
39expect { 39expect {
40 timeout {puts "TESTING ERROR 4\n";exit} 40 timeout {puts "TESTING ERROR 4\n";exit}
41 "unix, inet, inet6, netlink, packet" 41 "unix, inet, inet6, netlink, packet" {puts "OK\n"}
42 "protocol not supported on this platform" {puts "OK\n"}
42} 43}
43after 100 44after 100
44 45
diff --git a/test/filters/filters.sh b/test/filters/filters.sh
index 3ebb61419..d59d9109b 100755
--- a/test/filters/filters.sh
+++ b/test/filters/filters.sh
@@ -18,8 +18,11 @@ export PATH="$PATH:/usr/lib/firejail"
18if [ "$(uname -m)" = "x86_64" ]; then 18if [ "$(uname -m)" = "x86_64" ]; then
19 echo "TESTING: memory-deny-write-execute (test/filters/memwrexe.exp)" 19 echo "TESTING: memory-deny-write-execute (test/filters/memwrexe.exp)"
20 ./memwrexe.exp 20 ./memwrexe.exp
21elif [ "$(uname -m)" = "i686" ]; then
22 echo "TESTING: memory-deny-write-execute (test/filters/memwrexe-32.exp)"
23 ./memwrexe-32.exp
21else 24else
22 echo "TESTING SKIP: memwrexe binary only running on x86_64." 25 echo "TESTING SKIP: memwrexe binary only running on x86_64 and i686."
23fi 26fi
24 27
25echo "TESTING: debug options (test/filters/debug.exp)" 28echo "TESTING: debug options (test/filters/debug.exp)"
@@ -57,8 +60,11 @@ echo "TESTING: seccomp bad empty (test/filters/seccomp-bad-empty.exp)"
57if [ "$(uname -m)" = "x86_64" ]; then 60if [ "$(uname -m)" = "x86_64" ]; then
58 echo "TESTING: seccomp debug (test/filters/seccomp-debug.exp)" 61 echo "TESTING: seccomp debug (test/filters/seccomp-debug.exp)"
59 ./seccomp-debug.exp 62 ./seccomp-debug.exp
63elif [ "$(uname -m)" = "i686" ]; then
64 echo "TESTING: seccomp debug (test/filters/seccomp-debug-32.exp)"
65 ./seccomp-debug-32.exp
60else 66else
61 echo "TESTING SKIP: protocol, running only on x86_64" 67 echo "TESTING SKIP: protocol, running only on x86_64 and i686"
62fi 68fi
63 69
64echo "TESTING: seccomp errno (test/filters/seccomp-errno.exp)" 70echo "TESTING: seccomp errno (test/filters/seccomp-errno.exp)"
diff --git a/test/filters/memwrexe-32 b/test/filters/memwrexe-32
new file mode 100755
index 000000000..70c98b796
--- /dev/null
+++ b/test/filters/memwrexe-32
Binary files differ
diff --git a/test/filters/memwrexe-32.exp b/test/filters/memwrexe-32.exp
new file mode 100755
index 000000000..af2159973
--- /dev/null
+++ b/test/filters/memwrexe-32.exp
@@ -0,0 +1,34 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2017 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --memory-deny-write-execute ./memwrexe-32 mmap\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "Child process initialized"
14}
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "mmap successful" {puts "TESTING ERROR 2\n";exit}
18 "Parent is shutting down"
19}
20after 100
21
22send -- "firejail --memory-deny-write-execute ./memwrexe-32 mprotect\r"
23expect {
24 timeout {puts "TESTING ERROR 10\n";exit}
25 "Child process initialized"
26}
27expect {
28 timeout {puts "TESTING ERROR 11\n";exit}
29 "mprotect successful" {puts "TESTING ERROR 12\n";exit}
30 "Parent is shutting down"
31}
32
33after 100
34puts "\nall done\n"
diff --git a/test/filters/seccomp-debug-32.exp b/test/filters/seccomp-debug-32.exp
new file mode 100755
index 000000000..6983758c3
--- /dev/null
+++ b/test/filters/seccomp-debug-32.exp
@@ -0,0 +1,145 @@
1#!/usr/bin/expect -f
2# This file is part of Firejail project
3# Copyright (C) 2014-2017 Firejail Authors
4# License GPL v2
5
6set timeout 10
7spawn $env(SHELL)
8match_max 100000
9
10send -- "firejail --debug sleep 1; echo done\r"
11expect {
12 timeout {puts "TESTING ERROR 0\n";exit}
13 "SECCOMP Filter"
14}
15expect {
16 timeout {puts "TESTING ERROR 1\n";exit}
17 "BLACKLIST"
18}
19expect {
20 timeout {puts "TESTING ERROR 2\n";exit}
21 "open_by_handle_at"
22}
23expect {
24 timeout {puts "TESTING ERROR 3\n";exit}
25 "Child process initialized"
26}
27expect {
28 timeout {puts "TESTING ERROR 4\n";exit}
29 "done"
30}
31after 100
32
33
34# i686 architecture
35send -- "firejail --debug sleep 1; echo done\r"
36expect {
37 timeout {puts "TESTING ERROR 5\n";exit}
38 "Child process initialized"
39}
40expect {
41 timeout {puts "TESTING ERROR 6\n";exit}
42 "Installing /run/firejail/mnt/seccomp seccomp filter"
43}
44expect {
45 timeout {puts "TESTING ERROR 7\n";exit}
46 "Installing /run/firejail/mnt/seccomp.amd64 seccomp filter"
47}
48expect {
49 timeout {puts "TESTING ERROR 9\n";exit}
50 "done"
51}
52after 100
53
54# i686 architecture - ignore seccomp
55send -- "firejail --debug --ignore=seccomp sleep 1; echo done\r"
56expect {
57 timeout {puts "TESTING ERROR 10\n";exit}
58 "Installing /run/firejail/mnt/seccomp seccomp filter" {puts "TESTING ERROR 11\n";exit}
59 "Installing /run/firejail/mnt/seccomp.amd64 seccomp filter" {puts "TESTING ERROR 12\n";exit}
60 "Child process initialized"
61}
62expect {
63 timeout {puts "TESTING ERROR 13\n";exit}
64 "Installing /run/firejail/mnt/seccomp seccomp filter" {puts "TESTING ERROR 14\n";exit}
65 "Installing /run/firejail/mnt/seccomp.amd64 seccomp filter" {puts "TESTING ERROR 15\n";exit}
66 "done"
67}
68after 100
69
70# i686 architecture - ignore protocol
71send -- "firejail --debug --ignore=protocol sleep 1; echo done\r"
72expect {
73 timeout {puts "TESTING ERROR 17\n";exit}
74 "Installing /run/firejail/mnt/seccomp.protocol seccomp filter" {puts "TESTING ERROR 18\n";exit}
75 "Child process initialized"
76}
77expect {
78 timeout {puts "TESTING ERROR 19\n";exit}
79 "Installing /run/firejail/mnt/seccomp.protocol seccomp filter" {puts "TESTING ERROR 20\n";exit}
80 "Installing /run/firejail/mnt/seccomp seccomp filter"
81}
82expect {
83 timeout {puts "TESTING ERROR 21\n";exit}
84 "Installing /run/firejail/mnt/seccomp.protocol seccomp filter" {puts "TESTING ERROR 22\n";exit}
85 "Installing /run/firejail/mnt/seccomp.amd64 seccomp filter"
86}
87expect {
88 timeout {puts "TESTING ERROR 23\n";exit}
89 "done"
90}
91after 100
92
93# memory-deny-write-execute
94send -- "firejail --debug --memory-deny-write-execute sleep 1; echo done\r"
95expect {
96 timeout {puts "TESTING ERROR 24\n";exit}
97 "Child process initialized"
98}
99expect {
100 timeout {puts "TESTING ERROR 25\n";exit}
101 "Installing /run/firejail/mnt/seccomp.mdwx seccomp filter"
102}
103expect {
104 timeout {puts "TESTING ERROR 26\n";exit}
105 "done"
106}
107
108
109# i686 architecture - seccomp.block-secondary
110send -- "firejail --debug --seccomp.block-secondary sleep 1; echo done\r"
111expect {
112 timeout {puts "TESTING ERROR 27\n";exit}
113 "Installing /run/firejail/mnt/seccomp.amd64 seccomp filter" {puts "TESTING ERROR 28\n";exit}
114 "Child process initialized"
115}
116expect {
117 timeout {puts "TESTING ERROR 29\n";exit}
118 "Installing /run/firejail/mnt/seccomp.amd64 seccomp filter" {puts "TESTING ERROR 30\n";exit}
119 "Installing /run/firejail/mnt/seccomp seccomp filter"
120}
121expect {
122 timeout {puts "TESTING ERROR 33\n";exit}
123 "done"
124}
125after 100
126
127# i686 architecture - seccomp.block-secondary, profile
128send -- "firejail --debug --profile=block-secondary.profile sleep 1; echo done\r"
129expect {
130 timeout {puts "TESTING ERROR 33\n";exit}
131 "Installing /run/firejail/mnt/seccomp.amd64 seccomp filter" {puts "TESTING ERROR 34\n";exit}
132 "Child process initialized"
133}
134expect {
135 timeout {puts "TESTING ERROR 35\n";exit}
136 "Installing /run/firejail/mnt/seccomp.amd64 seccomp filter" {puts "TESTING ERROR 35\n";exit}
137 "Installing /run/firejail/mnt/seccomp seccomp filter"
138}
139expect {
140 timeout {puts "TESTING ERROR 37\n";exit}
141 "done"
142}
143after 100
144
145puts "all done\n"
diff --git a/test/filters/seccomp-debug.exp b/test/filters/seccomp-debug.exp
index 7f03e45e8..7a4a13991 100755
--- a/test/filters/seccomp-debug.exp
+++ b/test/filters/seccomp-debug.exp
@@ -106,7 +106,7 @@ expect {
106} 106}
107expect { 107expect {
108 timeout {puts "TESTING ERROR 25\n";exit} 108 timeout {puts "TESTING ERROR 25\n";exit}
109 "Installing /run/firejail/mnt/seccomp.protocol seccomp filter" 109 "Installing /run/firejail/mnt/seccomp.mdwx seccomp filter"
110} 110}
111expect { 111expect {
112 timeout {puts "TESTING ERROR 26\n";exit} 112 timeout {puts "TESTING ERROR 26\n";exit}