aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLibravatar netblue30 <netblue30@yahoo.com>2015-10-28 12:25:32 -0400
committerLibravatar netblue30 <netblue30@yahoo.com>2015-10-28 12:25:32 -0400
commit9b6ef630190f1218a011e6acafd684c8d5c8e95d (patch)
tree044874c85c36aa50d416dbec3fbf8a3c32f79271 /test
parentprofile work (diff)
downloadfirejail-9b6ef630190f1218a011e6acafd684c8d5c8e95d.tar.gz
firejail-9b6ef630190f1218a011e6acafd684c8d5c8e95d.tar.zst
firejail-9b6ef630190f1218a011e6acafd684c8d5c8e95d.zip
protocol testing
Diffstat (limited to 'test')
-rwxr-xr-xtest/protocol.exp184
-rw-r--r--test/protocol1.profile1
-rw-r--r--test/protocol2.profile1
-rwxr-xr-xtest/test.sh3
4 files changed, 189 insertions, 0 deletions
diff --git a/test/protocol.exp b/test/protocol.exp
new file mode 100755
index 000000000..018f4cd9b
--- /dev/null
+++ b/test/protocol.exp
@@ -0,0 +1,184 @@
1#!/usr/bin/expect -f
2
3set timeout 10
4spawn $env(SHELL)
5match_max 100000
6
7send -- "firejail --noprofile --protocol=unix ../src/tools/syscall_test socket\r"
8expect {
9 timeout {puts "TESTING ERROR 1\n";exit}
10 "Child process initialized"
11}
12expect {
13 timeout {puts "TESTING ERROR 1.1\n";exit}
14 "socket AF_INET"
15}
16expect {
17 timeout {puts "TESTING ERROR 1.2\n";exit}
18 "Operation not supported"
19}
20expect {
21 timeout {puts "TESTING ERROR 1.3\n";exit}
22 "socket AF_INET6"
23}
24expect {
25 timeout {puts "TESTING ERROR 1.4\n";exit}
26 "Operation not supported"
27}
28expect {
29 timeout {puts "TESTING ERROR 1.5\n";exit}
30 "socket AF_NETLINK"
31}
32expect {
33 timeout {puts "TESTING ERROR 1.6\n";exit}
34 "Operation not supported"
35}
36expect {
37 timeout {puts "TESTING ERROR 1.7\n";exit}
38 "socket AF_UNIX"
39}
40expect {
41 timeout {puts "TESTING ERROR 1.8\n";exit}
42 "socket AF_PACKETX"
43}
44expect {
45 timeout {puts "TESTING ERROR 1.9\n";exit}
46 "Operation not supported"
47}
48sleep 1
49
50send -- "firejail --noprofile --protocol=inet6,packet ../src/tools/syscall_test socket\r"
51expect {
52 timeout {puts "TESTING ERROR 2\n";exit}
53 "Child process initialized"
54}
55expect {
56 timeout {puts "TESTING ERROR 2.1\n";exit}
57 "socket AF_INET"
58}
59expect {
60 timeout {puts "TESTING ERROR 2.2\n";exit}
61 "Operation not supported"
62}
63expect {
64 timeout {puts "TESTING ERROR 2.3\n";exit}
65 "socket AF_INET6"
66}
67expect {
68 timeout {puts "TESTING ERROR 2.4\n";exit}
69 "socket AF_NETLINK"
70}
71expect {
72 timeout {puts "TESTING ERROR 2.5\n";exit}
73 "Operation not supported"
74}
75expect {
76 timeout {puts "TESTING ERROR 2.6\n";exit}
77 "socket AF_UNIX"
78}
79expect {
80 timeout {puts "TESTING ERROR 2.7\n";exit}
81 "Operation not supported"
82}
83expect {
84 timeout {puts "TESTING ERROR 2.8\n";exit}
85 "socket AF_PACKETX"
86}
87expect {
88 timeout {puts "TESTING ERROR 2.9\n";exit}
89 "after socket"
90}
91sleep 1
92
93# profile testing
94send -- "firejail --profile=protocol1.profile ../src/tools/syscall_test socket\r"
95expect {
96 timeout {puts "TESTING ERROR 3\n";exit}
97 "Child process initialized"
98}
99expect {
100 timeout {puts "TESTING ERROR 3.1\n";exit}
101 "socket AF_INET"
102}
103expect {
104 timeout {puts "TESTING ERROR 3.2\n";exit}
105 "Operation not supported"
106}
107expect {
108 timeout {puts "TESTING ERROR 3.3\n";exit}
109 "socket AF_INET6"
110}
111expect {
112 timeout {puts "TESTING ERROR 3.4\n";exit}
113 "Operation not supported"
114}
115expect {
116 timeout {puts "TESTING ERROR 3.5\n";exit}
117 "socket AF_NETLINK"
118}
119expect {
120 timeout {puts "TESTING ERROR 3.6\n";exit}
121 "Operation not supported"
122}
123expect {
124 timeout {puts "TESTING ERROR 3.7\n";exit}
125 "socket AF_UNIX"
126}
127expect {
128 timeout {puts "TESTING ERROR 3.8\n";exit}
129 "socket AF_PACKETX"
130}
131expect {
132 timeout {puts "TESTING ERROR 3.9\n";exit}
133 "Operation not supported"
134}
135sleep 1
136
137send -- "firejail --profile=protocol2.profile ../src/tools/syscall_test socket\r"
138expect {
139 timeout {puts "TESTING ERROR 4\n";exit}
140 "Child process initialized"
141}
142expect {
143 timeout {puts "TESTING ERROR 4.1\n";exit}
144 "socket AF_INET"
145}
146expect {
147 timeout {puts "TESTING ERROR 4.2\n";exit}
148 "Operation not supported"
149}
150expect {
151 timeout {puts "TESTING ERROR 4.3\n";exit}
152 "socket AF_INET6"
153}
154expect {
155 timeout {puts "TESTING ERROR 4.4\n";exit}
156 "socket AF_NETLINK"
157}
158expect {
159 timeout {puts "TESTING ERROR 4.5\n";exit}
160 "Operation not supported"
161}
162expect {
163 timeout {puts "TESTING ERROR 4.6\n";exit}
164 "socket AF_UNIX"
165}
166expect {
167 timeout {puts "TESTING ERROR 4.7\n";exit}
168 "Operation not supported"
169}
170expect {
171 timeout {puts "TESTING ERROR 4.8\n";exit}
172 "socket AF_PACKETX"
173}
174expect {
175 timeout {puts "TESTING ERROR 4.9\n";exit}
176 "after socket"
177}
178sleep 1
179
180
181
182
183
184puts "\nall done\n"
diff --git a/test/protocol1.profile b/test/protocol1.profile
new file mode 100644
index 000000000..3e1ea2a29
--- /dev/null
+++ b/test/protocol1.profile
@@ -0,0 +1 @@
protocol unix
diff --git a/test/protocol2.profile b/test/protocol2.profile
new file mode 100644
index 000000000..b7eb4ab91
--- /dev/null
+++ b/test/protocol2.profile
@@ -0,0 +1 @@
protocol inet6,packet
diff --git a/test/test.sh b/test/test.sh
index 406ef92a3..8e673911e 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -12,6 +12,9 @@ done
12 12
13./fscheck.sh 13./fscheck.sh
14 14
15echo "TESTING: protocol"
16./protocol.exp
17
15echo "TESTING: invalid filename" 18echo "TESTING: invalid filename"
16./invalid_filename.exp 19./invalid_filename.exp
17 20