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