1 |
commit: 14ebc8703efb69f1e2c600e447767aa5db600657 |
2 |
Author: Dominick Grift <dominick.grift <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue Oct 30 09:35:51 2012 +0000 |
4 |
Commit: Sven Vermeulen <sven.vermeulen <AT> siphos <DOT> be> |
5 |
CommitDate: Tue Oct 30 18:32:53 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-refpolicy.git;a=commit;h=14ebc870 |
7 |
|
8 |
Changes to the tripwire policy module |
9 |
|
10 |
Module clean up |
11 |
|
12 |
Signed-off-by: Dominick Grift <dominick.grift <AT> gmail.com> |
13 |
|
14 |
--- |
15 |
policy/modules/contrib/tripwire.fc | 1 - |
16 |
policy/modules/contrib/tripwire.if | 55 ++++++++++++++++------------------- |
17 |
policy/modules/contrib/tripwire.te | 47 ++++++++++++++++++------------ |
18 |
3 files changed, 53 insertions(+), 50 deletions(-) |
19 |
|
20 |
diff --git a/policy/modules/contrib/tripwire.fc b/policy/modules/contrib/tripwire.fc |
21 |
index 20978f1..a27298b 100644 |
22 |
--- a/policy/modules/contrib/tripwire.fc |
23 |
+++ b/policy/modules/contrib/tripwire.fc |
24 |
@@ -1,4 +1,3 @@ |
25 |
- |
26 |
/etc/tripwire(/.*)? gen_context(system_u:object_r:tripwire_etc_t,s0) |
27 |
|
28 |
/usr/sbin/siggen -- gen_context(system_u:object_r:siggen_exec_t,s0) |
29 |
|
30 |
diff --git a/policy/modules/contrib/tripwire.if b/policy/modules/contrib/tripwire.if |
31 |
index 27abd88..a3a4d91 100644 |
32 |
--- a/policy/modules/contrib/tripwire.if |
33 |
+++ b/policy/modules/contrib/tripwire.if |
34 |
@@ -1,17 +1,4 @@ |
35 |
-## <summary>Tripwire file integrity checker.</summary> |
36 |
-## <desc> |
37 |
-## <p> |
38 |
-## Tripwire file integrity checker. |
39 |
-## </p> |
40 |
-## <p> |
41 |
-## NOTE: Tripwire creates temp file in its current working directory. |
42 |
-## This policy does not allow write access to home directories, so |
43 |
-## users will need to either cd to a directory where they have write |
44 |
-## permission, or set the TEMPDIRECTORY variable in the tripwire config |
45 |
-## file. The latter is preferable, as then the file_type_auto_trans |
46 |
-## rules will kick in and label the files as private to tripwire. |
47 |
-## </p> |
48 |
-## </desc> |
49 |
+## <summary>File integrity checker.</summary> |
50 |
|
51 |
######################################## |
52 |
## <summary> |
53 |
@@ -28,13 +15,15 @@ interface(`tripwire_domtrans_tripwire',` |
54 |
type tripwire_t, tripwire_exec_t; |
55 |
') |
56 |
|
57 |
+ corecmd_search_bin($1) |
58 |
domtrans_pattern($1, tripwire_exec_t, tripwire_t) |
59 |
') |
60 |
|
61 |
######################################## |
62 |
## <summary> |
63 |
-## Execute tripwire in the tripwire domain, and |
64 |
-## allow the specified role the tripwire domain. |
65 |
+## Execute tripwire in the tripwire |
66 |
+## domain, and allow the specified |
67 |
+## role the tripwire domain. |
68 |
## </summary> |
69 |
## <param name="domain"> |
70 |
## <summary> |
71 |
@@ -50,11 +39,11 @@ interface(`tripwire_domtrans_tripwire',` |
72 |
# |
73 |
interface(`tripwire_run_tripwire',` |
74 |
gen_require(` |
75 |
- type tripwire_t; |
76 |
+ attribute_role tripwire_roles; |
77 |
') |
78 |
|
79 |
tripwire_domtrans_tripwire($1) |
80 |
- role $2 types tripwire_t; |
81 |
+ roleattribute $2 tripwire_roles; |
82 |
') |
83 |
|
84 |
######################################## |
85 |
@@ -72,13 +61,15 @@ interface(`tripwire_domtrans_twadmin',` |
86 |
type twadmin_t, twadmin_exec_t; |
87 |
') |
88 |
|
89 |
+ corecmd_search_bin($1) |
90 |
domtrans_pattern($1, twadmin_exec_t, twadmin_t) |
91 |
') |
92 |
|
93 |
######################################## |
94 |
## <summary> |
95 |
-## Execute twadmin in the twadmin domain, and |
96 |
-## allow the specified role the twadmin domain. |
97 |
+## Execute twadmin in the twadmin |
98 |
+## domain, and allow the specified |
99 |
+## role the twadmin domain. |
100 |
## </summary> |
101 |
## <param name="domain"> |
102 |
## <summary> |
103 |
@@ -94,11 +85,11 @@ interface(`tripwire_domtrans_twadmin',` |
104 |
# |
105 |
interface(`tripwire_run_twadmin',` |
106 |
gen_require(` |
107 |
- type twadmin_t; |
108 |
+ attribute_role twadmin_roles; |
109 |
') |
110 |
|
111 |
tripwire_domtrans_twadmin($1) |
112 |
- role $2 types twadmin_t; |
113 |
+ roleattribute $2 twadmin_roles; |
114 |
') |
115 |
|
116 |
######################################## |
117 |
@@ -116,13 +107,15 @@ interface(`tripwire_domtrans_twprint',` |
118 |
type twprint_t, twprint_exec_t; |
119 |
') |
120 |
|
121 |
+ corecmd_search_bin($1) |
122 |
domtrans_pattern($1, twprint_exec_t, twprint_t) |
123 |
') |
124 |
|
125 |
######################################## |
126 |
## <summary> |
127 |
-## Execute twprint in the twprint domain, and |
128 |
-## allow the specified role the twprint domain. |
129 |
+## Execute twprint in the twprint |
130 |
+## domain, and allow the specified |
131 |
+## role the twprint domain. |
132 |
## </summary> |
133 |
## <param name="domain"> |
134 |
## <summary> |
135 |
@@ -138,11 +131,11 @@ interface(`tripwire_domtrans_twprint',` |
136 |
# |
137 |
interface(`tripwire_run_twprint',` |
138 |
gen_require(` |
139 |
- type twprint_t; |
140 |
+ attribute_role twprint_roles; |
141 |
') |
142 |
|
143 |
tripwire_domtrans_twprint($1) |
144 |
- role $2 types twprint_t; |
145 |
+ roleattribute $2 twprint_roles; |
146 |
') |
147 |
|
148 |
######################################## |
149 |
@@ -160,13 +153,15 @@ interface(`tripwire_domtrans_siggen',` |
150 |
type siggen_t, siggen_exec_t; |
151 |
') |
152 |
|
153 |
+ corecmd_search_bin($1) |
154 |
domtrans_pattern($1, siggen_exec_t, siggen_t) |
155 |
') |
156 |
|
157 |
######################################## |
158 |
## <summary> |
159 |
-## Execute siggen in the siggen domain, and |
160 |
-## allow the specified role the siggen domain. |
161 |
+## Execute siggen in the siggen domain, |
162 |
+## and allow the specified role |
163 |
+## the siggen domain. |
164 |
## </summary> |
165 |
## <param name="domain"> |
166 |
## <summary> |
167 |
@@ -182,9 +177,9 @@ interface(`tripwire_domtrans_siggen',` |
168 |
# |
169 |
interface(`tripwire_run_siggen',` |
170 |
gen_require(` |
171 |
- type siggen_t; |
172 |
+ attribute_role siggen_roles; |
173 |
') |
174 |
|
175 |
tripwire_domtrans_siggen($1) |
176 |
- role $2 types siggen_t; |
177 |
+ roleattribute $2 siggen_roles; |
178 |
') |
179 |
|
180 |
diff --git a/policy/modules/contrib/tripwire.te b/policy/modules/contrib/tripwire.te |
181 |
index 2ae8b62..2e1110d 100644 |
182 |
--- a/policy/modules/contrib/tripwire.te |
183 |
+++ b/policy/modules/contrib/tripwire.te |
184 |
@@ -1,18 +1,24 @@ |
185 |
-policy_module(tripwire, 1.2.0) |
186 |
+policy_module(tripwire, 1.2.1) |
187 |
|
188 |
######################################## |
189 |
# |
190 |
# Declarations |
191 |
# |
192 |
|
193 |
+attribute_role siggen_roles; |
194 |
+attribute_role tripwire_roles; |
195 |
+attribute_role twadmin_roles; |
196 |
+attribute_role twprint_roles; |
197 |
+ |
198 |
type siggen_t; |
199 |
type siggen_exec_t; |
200 |
application_domain(siggen_t, siggen_exec_t) |
201 |
+role siggen_roles types siggen_t; |
202 |
|
203 |
type tripwire_t; |
204 |
type tripwire_exec_t; |
205 |
application_domain(tripwire_t, tripwire_exec_t) |
206 |
-role system_r types tripwire_t; |
207 |
+role tripwire_roles types tripwire_t; |
208 |
|
209 |
type tripwire_etc_t; |
210 |
files_config_file(tripwire_etc_t) |
211 |
@@ -29,24 +35,24 @@ files_type(tripwire_var_lib_t) |
212 |
type twadmin_t; |
213 |
type twadmin_exec_t; |
214 |
application_domain(twadmin_t, twadmin_exec_t) |
215 |
+role twadmin_roles types twadmin_t; |
216 |
|
217 |
type twprint_t; |
218 |
type twprint_exec_t; |
219 |
application_domain(twprint_t, twprint_exec_t) |
220 |
+role twprint_roles types twprint_t; |
221 |
|
222 |
######################################## |
223 |
# |
224 |
-# Tripwire local policy |
225 |
+# Local policy |
226 |
# |
227 |
|
228 |
allow tripwire_t self:capability { setgid setuid dac_override }; |
229 |
|
230 |
allow tripwire_t tripwire_etc_t:dir list_dir_perms; |
231 |
-read_files_pattern(tripwire_t, tripwire_etc_t, tripwire_etc_t) |
232 |
-read_lnk_files_pattern(tripwire_t, tripwire_etc_t, tripwire_etc_t) |
233 |
-files_search_etc(tripwire_t) |
234 |
+allow tripwire_t tripwire_etc_t:file read_file_perms; |
235 |
+allow tripwire_t tripwire_etc_t:lnk_file read_lnk_file_perms; |
236 |
|
237 |
-# Tripwire report files |
238 |
manage_dirs_pattern(tripwire_t, tripwire_report_t, tripwire_report_t) |
239 |
manage_files_pattern(tripwire_t, tripwire_report_t, tripwire_report_t) |
240 |
manage_lnk_files_pattern(tripwire_t, tripwire_report_t, tripwire_report_t) |
241 |
@@ -68,8 +74,8 @@ kernel_getattr_core_if(tripwire_t) |
242 |
kernel_getattr_message_if(tripwire_t) |
243 |
kernel_read_kernel_sysctls(tripwire_t) |
244 |
|
245 |
-corecmd_exec_shell(tripwire_t) |
246 |
corecmd_exec_bin(tripwire_t) |
247 |
+corecmd_exec_shell(tripwire_t) |
248 |
|
249 |
domain_use_interactive_fds(tripwire_t) |
250 |
|
251 |
@@ -91,12 +97,14 @@ optional_policy(` |
252 |
# Twadmin local policy |
253 |
# |
254 |
|
255 |
-manage_dirs_pattern(twadmin_t, tripwire_etc_t, tripwire_etc_t) |
256 |
-manage_files_pattern(twadmin_t, tripwire_etc_t, tripwire_etc_t) |
257 |
-manage_lnk_files_pattern(twadmin_t, tripwire_etc_t, tripwire_etc_t) |
258 |
+allow twadmin_t tripwire_etc_t:dir list_dir_perms; |
259 |
+allow twadmin_t tripwire_etc_t:file read_file_perms; |
260 |
+allow twadmin_t tripwire_etc_t:lnk_file read_lnk_file_perms; |
261 |
|
262 |
domain_use_interactive_fds(twadmin_t) |
263 |
|
264 |
+files_search_etc(twadmin_t) |
265 |
+ |
266 |
logging_send_syslog_msg(twadmin_t) |
267 |
|
268 |
miscfiles_read_localization(twadmin_t) |
269 |
@@ -109,20 +117,22 @@ userdom_use_user_terminals(twadmin_t) |
270 |
# |
271 |
|
272 |
allow twprint_t tripwire_etc_t:dir list_dir_perms; |
273 |
-read_files_pattern(twprint_t, tripwire_etc_t, tripwire_etc_t) |
274 |
-read_lnk_files_pattern(twprint_t, tripwire_etc_t, tripwire_etc_t) |
275 |
+allow twprint_t tripwire_etc_t:file read_file_perms; |
276 |
+allow twprint_t tripwire_etc_t:lnk_file read_lnk_file_perms; |
277 |
|
278 |
allow twprint_t tripwire_report_t:dir list_dir_perms; |
279 |
-read_files_pattern(twprint_t, tripwire_report_t, tripwire_report_t) |
280 |
-read_lnk_files_pattern(twprint_t, tripwire_report_t, tripwire_report_t) |
281 |
+allow twprint_t tripwire_report_t:file read_file_perms; |
282 |
+allow twprint_t tripwire_report_t:lnk_file read_lnk_file_perms; |
283 |
|
284 |
allow twprint_t tripwire_var_lib_t:dir list_dir_perms; |
285 |
-read_files_pattern(twprint_t, tripwire_var_lib_t, tripwire_var_lib_t) |
286 |
-read_lnk_files_pattern(twprint_t, tripwire_var_lib_t, tripwire_var_lib_t) |
287 |
-files_search_var_lib(twprint_t) |
288 |
+allow twprint_t tripwire_var_lib_t:file read_file_perms; |
289 |
+allow twprint_t tripwire_var_lib_t:lnk_file read_lnk_file_perms; |
290 |
|
291 |
domain_use_interactive_fds(twprint_t) |
292 |
|
293 |
+files_search_etc(twprint_t) |
294 |
+files_search_var_lib(twprint_t) |
295 |
+ |
296 |
logging_send_syslog_msg(twprint_t) |
297 |
|
298 |
miscfiles_read_localization(twprint_t) |
299 |
@@ -136,7 +146,6 @@ userdom_use_user_terminals(twprint_t) |
300 |
|
301 |
domain_use_interactive_fds(siggen_t) |
302 |
|
303 |
-# Need permission to read files |
304 |
files_read_all_files(siggen_t) |
305 |
|
306 |
logging_send_syslog_msg(siggen_t) |