diff options
Diffstat (limited to 'test/utils/firemon-caps.exp')
-rwxr-xr-x | test/utils/firemon-caps.exp | 130 |
1 files changed, 130 insertions, 0 deletions
diff --git a/test/utils/firemon-caps.exp b/test/utils/firemon-caps.exp new file mode 100755 index 000000000..76aa13725 --- /dev/null +++ b/test/utils/firemon-caps.exp | |||
@@ -0,0 +1,130 @@ | |||
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 | |||
6 | set timeout 10 | ||
7 | spawn $env(SHELL) | ||
8 | match_max 100000 | ||
9 | |||
10 | send -- "firejail --name=bingo1 --noprofile --caps\r" | ||
11 | expect { | ||
12 | timeout {puts "TESTING ERROR 0\n";exit} | ||
13 | "Child process initialized" | ||
14 | } | ||
15 | sleep 1 | ||
16 | |||
17 | spawn $env(SHELL) | ||
18 | send -- "firejail --name=bingo2 --noprofile\r" | ||
19 | expect { | ||
20 | timeout {puts "TESTING ERROR 1\n";exit} | ||
21 | "Child process initialized" | ||
22 | } | ||
23 | sleep 1 | ||
24 | |||
25 | spawn $env(SHELL) | ||
26 | send -- "firejail --name=bingo3 --noprofile --caps.drop=all\r" | ||
27 | expect { | ||
28 | timeout {puts "TESTING ERROR 2\n";exit} | ||
29 | "Child process initialized" | ||
30 | } | ||
31 | sleep 1 | ||
32 | |||
33 | spawn $env(SHELL) | ||
34 | send -- "firejail --noprofile --name=bingo4 --caps.drop=chown,kill\r" | ||
35 | expect { | ||
36 | timeout {puts "TESTING ERROR 3\n";exit} | ||
37 | "Child process initialized" | ||
38 | } | ||
39 | sleep 1 | ||
40 | |||
41 | spawn $env(SHELL) | ||
42 | send -- "firejail --noprofile --name=bingo5 --caps.keep=chown,kill\r" | ||
43 | expect { | ||
44 | timeout {puts "TESTING ERROR 4\n";exit} | ||
45 | "Child process initialized" | ||
46 | } | ||
47 | sleep 1 | ||
48 | |||
49 | spawn $env(SHELL) | ||
50 | send -- "firejail --name=bingo6 --profile=caps1.profile\r" | ||
51 | expect { | ||
52 | timeout {puts "TESTING ERROR 5\n";exit} | ||
53 | "Child process initialized" | ||
54 | } | ||
55 | sleep 1 | ||
56 | |||
57 | spawn $env(SHELL) | ||
58 | send -- "firejail --name=bingo7 --profile=caps2.profile\r" | ||
59 | expect { | ||
60 | timeout {puts "TESTING ERROR 0\n";exit} | ||
61 | "Child process initialized" | ||
62 | } | ||
63 | sleep 1 | ||
64 | |||
65 | spawn $env(SHELL) | ||
66 | send -- "firemon --caps\r" | ||
67 | expect { | ||
68 | timeout {puts "TESTING ERROR 8.1\n";exit} | ||
69 | "need to be root" {puts "TESTING SKIP: /proc mounted as hidepid\n"; exit} | ||
70 | "bingo1" | ||
71 | } | ||
72 | expect { | ||
73 | timeout {puts "TESTING ERROR 8.2\n";exit} | ||
74 | "31cffff" | ||
75 | } | ||
76 | expect { | ||
77 | timeout {puts "TESTING ERROR 8.3\n";exit} | ||
78 | "bingo2" | ||
79 | } | ||
80 | expect { | ||
81 | timeout {puts "TESTING ERROR 8.4\n";exit} | ||
82 | "fffffff" | ||
83 | } | ||
84 | expect { | ||
85 | timeout {puts "TESTING ERROR 8.5\n";exit} | ||
86 | "bingo3" | ||
87 | } | ||
88 | expect { | ||
89 | timeout {puts "TESTING ERROR 8.6\n";exit} | ||
90 | "000000000000" | ||
91 | } | ||
92 | |||
93 | expect { | ||
94 | timeout {puts "TESTING ERROR 8.7\n";exit} | ||
95 | "bingo4" | ||
96 | } | ||
97 | expect { | ||
98 | timeout {puts "TESTING ERROR 8.8\n";exit} | ||
99 | "ffffffde" | ||
100 | } | ||
101 | expect { | ||
102 | timeout {puts "TESTING ERROR 8.9\n";exit} | ||
103 | "bingo5" | ||
104 | } | ||
105 | expect { | ||
106 | timeout {puts "TESTING ERROR 8.10\n";exit} | ||
107 | "0000000000000021" | ||
108 | } | ||
109 | |||
110 | expect { | ||
111 | timeout {puts "TESTING ERROR 8.11\n";exit} | ||
112 | "bingo6" | ||
113 | } | ||
114 | expect { | ||
115 | timeout {puts "TESTING ERROR 8.12\n";exit} | ||
116 | "ffffffde" | ||
117 | } | ||
118 | expect { | ||
119 | timeout {puts "TESTING ERROR 8.13\n";exit} | ||
120 | "bingo7" | ||
121 | } | ||
122 | expect { | ||
123 | timeout {puts "TESTING ERROR 8.14\n";exit} | ||
124 | "0000000000000021" | ||
125 | } | ||
126 | |||
127 | after 100 | ||
128 | |||
129 | puts "all done\n" | ||
130 | |||