diff options
-rwxr-xr-x | test/filters/caps-join.exp | 96 | ||||
-rwxr-xr-x | test/filters/filters.sh | 3 |
2 files changed, 99 insertions, 0 deletions
diff --git a/test/filters/caps-join.exp b/test/filters/caps-join.exp new file mode 100755 index 000000000..2e29ef763 --- /dev/null +++ b/test/filters/caps-join.exp | |||
@@ -0,0 +1,96 @@ | |||
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\r" | ||
21 | expect { | ||
22 | timeout {puts "TESTING ERROR 0\n";exit} | ||
23 | "Child process initialized" | ||
24 | } | ||
25 | sleep 1 | ||
26 | |||
27 | set spawn_id $id2 | ||
28 | |||
29 | send -- "firejail --join=jointesting cat /proc/self/status\r" | ||
30 | expect { | ||
31 | timeout {puts "TESTING ERROR 1\n";exit} | ||
32 | "CapBnd: 0000000000000000" | ||
33 | } | ||
34 | sleep 1 | ||
35 | |||
36 | set spawn_id $id1 | ||
37 | send -- "exit\r" | ||
38 | after 100 | ||
39 | |||
40 | # | ||
41 | # no caps | ||
42 | # | ||
43 | set spawn_id $id1 | ||
44 | send -- "firejail --name=jointesting --noprofile\r" | ||
45 | expect { | ||
46 | timeout {puts "TESTING ERROR 10\n";exit} | ||
47 | "Child process initialized" | ||
48 | } | ||
49 | sleep 1 | ||
50 | |||
51 | set spawn_id $id2 | ||
52 | |||
53 | send -- "firejail --join=jointesting cat /proc/self/status\r" | ||
54 | expect { | ||
55 | timeout {puts "TESTING ERROR 11\n";exit} | ||
56 | "CapBnd:" | ||
57 | } | ||
58 | expect { | ||
59 | timeout {puts "TESTING ERROR 12\n";exit} | ||
60 | "fffffffff" | ||
61 | } | ||
62 | expect { | ||
63 | timeout {puts "TESTING ERROR 13\n";exit} | ||
64 | "CapAmb:" | ||
65 | } | ||
66 | sleep 1 | ||
67 | |||
68 | set spawn_id $id1 | ||
69 | send -- "exit\r" | ||
70 | after 100 | ||
71 | |||
72 | # | ||
73 | # no caps | ||
74 | # | ||
75 | set spawn_id $id1 | ||
76 | send -- "firejail --name=jointesting --noprofile --caps.keep=chown,fowner\r" | ||
77 | expect { | ||
78 | timeout {puts "TESTING ERROR20\n";exit} | ||
79 | "Child process initialized" | ||
80 | } | ||
81 | sleep 1 | ||
82 | |||
83 | set spawn_id $id2 | ||
84 | |||
85 | send -- "firejail --join=jointesting cat /proc/self/status\r" | ||
86 | expect { | ||
87 | timeout {puts "TESTING ERROR 21\n";exit} | ||
88 | "CapBnd: 0000000000000009" | ||
89 | } | ||
90 | sleep 1 | ||
91 | |||
92 | set spawn_id $id1 | ||
93 | send -- "exit\r" | ||
94 | after 100 | ||
95 | |||
96 | puts "all done\n" | ||
diff --git a/test/filters/filters.sh b/test/filters/filters.sh index 259045e77..33f205e05 100755 --- a/test/filters/filters.sh +++ b/test/filters/filters.sh | |||
@@ -52,6 +52,9 @@ fi | |||
52 | echo "TESTING: capabilities print (test/filters/caps-print.exp)" | 52 | echo "TESTING: capabilities print (test/filters/caps-print.exp)" |
53 | ./caps-print.exp | 53 | ./caps-print.exp |
54 | 54 | ||
55 | echo "TESTING: capabilities join (test/filters/caps-join.exp)" | ||
56 | ./caps-join.exp | ||
57 | |||
55 | rm -f seccomp-test-file | 58 | rm -f seccomp-test-file |
56 | if [ "$(uname -m)" = "x86_64" ]; then | 59 | if [ "$(uname -m)" = "x86_64" ]; then |
57 | echo "TESTING: fseccomp (test/filters/fseccomp.exp)" | 60 | echo "TESTING: fseccomp (test/filters/fseccomp.exp)" |