diff options
-rwxr-xr-x | test/filters/filters.sh | 7 | ||||
-rwxr-xr-x | test/filters/seccomp-join.exp | 159 |
2 files changed, 166 insertions, 0 deletions
diff --git a/test/filters/filters.sh b/test/filters/filters.sh index 917aa93b6..259045e77 100755 --- a/test/filters/filters.sh +++ b/test/filters/filters.sh | |||
@@ -113,3 +113,10 @@ if [ "$(uname -m)" = "x86_64" ]; then | |||
113 | else | 113 | else |
114 | echo "TESTING SKIP: seccomp dual, not running on x86_64" | 114 | echo "TESTING SKIP: seccomp dual, not running on x86_64" |
115 | fi | 115 | fi |
116 | |||
117 | if [ "$(uname -m)" = "x86_64" ]; then | ||
118 | echo "TESTING: seccomp join (test/filters/seccomp-join.exp)" | ||
119 | ./seccomp-join.exp | ||
120 | else | ||
121 | echo "TESTING SKIP: seccomp join test implemented only for x86_64" | ||
122 | fi | ||
diff --git a/test/filters/seccomp-join.exp b/test/filters/seccomp-join.exp new file mode 100755 index 000000000..7a869b85f --- /dev/null +++ b/test/filters/seccomp-join.exp | |||
@@ -0,0 +1,159 @@ | |||
1 | #!/usr/bin/expect -f | ||
2 | # This file is part of Firejail project | ||
3 | # Copyright (C) 2014-2018 Firejail Authors | ||
4 | # License GPL v2 | ||
5 | |||
6 | set timeout 10 | ||
7 | match_max 100000 | ||
8 | spawn $env(SHELL) | ||
9 | set id1 $spawn_id | ||
10 | spawn $env(SHELL) | ||
11 | set id2 $spawn_id | ||
12 | |||
13 | send -- "stty -echo\r" | ||
14 | after 100 | ||
15 | |||
16 | # | ||
17 | # regular run | ||
18 | # | ||
19 | set spawn_id $id1 | ||
20 | send -- "firejail --name=jointesting --debug\r" | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 0\n";exit} | ||
23 | "Installing /run/firejail/mnt/seccomp seccomp filter" | ||
24 | } | ||
25 | expect { | ||
26 | timeout {puts "TESTING ERROR 1\n";exit} | ||
27 | "Installing /run/firejail/mnt/seccomp.32 seccomp filter" | ||
28 | } | ||
29 | expect { | ||
30 | timeout {puts "TESTING ERROR 2\n";exit} | ||
31 | "Installing /run/firejail/mnt/seccomp.protocol seccomp filter" | ||
32 | } | ||
33 | sleep 1 | ||
34 | |||
35 | set spawn_id $id2 | ||
36 | |||
37 | send -- "firejail --debug --join=jointesting\r" | ||
38 | expect { | ||
39 | timeout {puts "TESTING ERROR 3\n";exit} | ||
40 | "Installing /run/firejail/mnt/seccomp seccomp filter" | ||
41 | } | ||
42 | expect { | ||
43 | timeout {puts "TESTING ERROR 4\n";exit} | ||
44 | "Installing /run/firejail/mnt/seccomp.32 seccomp filter" | ||
45 | } | ||
46 | expect { | ||
47 | timeout {puts "TESTING ERROR 5\n";exit} | ||
48 | "Installing /run/firejail/mnt/seccomp.protocol seccomp filter" | ||
49 | } | ||
50 | sleep 1 | ||
51 | |||
52 | send -- "exit\r" | ||
53 | after 100 | ||
54 | set spawn_id $id1 | ||
55 | send -- "exit\r" | ||
56 | after 100 | ||
57 | |||
58 | |||
59 | |||
60 | # | ||
61 | # block secondary | ||
62 | # | ||
63 | set spawn_id $id1 | ||
64 | send -- "firejail --name=jointesting --seccomp.block-secondary --debug\r" | ||
65 | expect { | ||
66 | timeout {puts "TESTING ERROR 10\n";exit} | ||
67 | "Installing /run/firejail/mnt/seccomp seccomp filter" | ||
68 | } | ||
69 | expect { | ||
70 | timeout {puts "TESTING ERROR 11\n";exit} | ||
71 | "Installing /run/firejail/mnt/seccomp.32 seccomp filter" {puts "TESTING ERROR 12\n";exit} | ||
72 | "Installing /run/firejail/mnt/seccomp.block_secondary seccomp filter" | ||
73 | } | ||
74 | expect { | ||
75 | timeout {puts "TESTING ERROR 13\n";exit} | ||
76 | "Installing /run/firejail/mnt/seccomp.protocol seccomp filter" | ||
77 | } | ||
78 | sleep 1 | ||
79 | |||
80 | set spawn_id $id2 | ||
81 | send -- "firejail --debug --join=jointesting\r" | ||
82 | expect { | ||
83 | timeout {puts "TESTING ERROR 14\n";exit} | ||
84 | "Installing /run/firejail/mnt/seccomp seccomp filter" | ||
85 | } | ||
86 | expect { | ||
87 | timeout {puts "TESTING ERROR 15\n";exit} | ||
88 | "Installing /run/firejail/mnt/seccomp.block_secondary seccomp filter" | ||
89 | } | ||
90 | expect { | ||
91 | timeout {puts "TESTING ERROR 16\n";exit} | ||
92 | "Installing /run/firejail/mnt/seccomp.protocol seccomp filter" | ||
93 | } | ||
94 | sleep 1 | ||
95 | |||
96 | send -- "exit\r" | ||
97 | after 100 | ||
98 | set spawn_id $id1 | ||
99 | send -- "exit\r" | ||
100 | after 100 | ||
101 | |||
102 | # | ||
103 | # protocol | ||
104 | # | ||
105 | set spawn_id $id1 | ||
106 | send -- "firejail --name=jointesting --noprofile --protocol=inet --debug\r" | ||
107 | expect { | ||
108 | timeout {puts "TESTING ERROR 22\n";exit} | ||
109 | "Installing /run/firejail/mnt/seccomp.protocol seccomp filter" | ||
110 | } | ||
111 | sleep 1 | ||
112 | |||
113 | set spawn_id $id2 | ||
114 | |||
115 | send -- "firejail --debug --join=jointesting\r" | ||
116 | expect { | ||
117 | timeout {puts "TESTING ERROR 23\n";exit} | ||
118 | "Installing /run/firejail/mnt/seccomp seccomp filter" {puts "TESTING ERROR 24\n";exit} | ||
119 | "Installing /run/firejail/mnt/seccomp.32 seccomp filter" {puts "TESTING ERROR 25\n";exit} | ||
120 | "Installing /run/firejail/mnt/seccomp.protocol seccomp filter" | ||
121 | } | ||
122 | sleep 1 | ||
123 | |||
124 | send -- "exit\r" | ||
125 | after 100 | ||
126 | set spawn_id $id1 | ||
127 | send -- "exit\r" | ||
128 | after 100 | ||
129 | |||
130 | # | ||
131 | # memory deny write execute | ||
132 | # | ||
133 | set spawn_id $id1 | ||
134 | send -- "firejail --name=jointesting --noprofile --memory-deny-write-execute --debug\r" | ||
135 | expect { | ||
136 | timeout {puts "TESTING ERROR 32\n";exit} | ||
137 | "Installing /run/firejail/mnt/seccomp.mdwx seccomp filter" | ||
138 | } | ||
139 | sleep 1 | ||
140 | |||
141 | set spawn_id $id2 | ||
142 | |||
143 | send -- "firejail --debug --join=jointesting\r" | ||
144 | expect { | ||
145 | timeout {puts "TESTING ERROR 33\n";exit} | ||
146 | "Installing /run/firejail/mnt/seccomp seccomp filter" {puts "TESTING ERROR 34\n";exit} | ||
147 | "Installing /run/firejail/mnt/seccomp.32 seccomp filter" {puts "TESTING ERROR 35\n";exit} | ||
148 | "Installing /run/firejail/mnt/seccomp.protocol seccomp filter" {puts "TESTING ERROR 36\n";exit} | ||
149 | "Installing /run/firejail/mnt/seccomp.mdwx seccomp filter" | ||
150 | } | ||
151 | sleep 1 | ||
152 | |||
153 | send -- "exit\r" | ||
154 | after 100 | ||
155 | set spawn_id $id1 | ||
156 | send -- "exit\r" | ||
157 | after 100 | ||
158 | |||
159 | puts "all done\n" | ||