Gentoo Archives: gentoo-commits

From: Sven Vermeulen <sven.vermeulen@××××××.be>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-refpolicy:master commit in: policy/modules/contrib/
Date: Tue, 02 Oct 2012 18:22:56
Message-Id: 1349200974.d19c2a5dc791e022562c83830830abe673930b78.SwifT@gentoo
1 commit: d19c2a5dc791e022562c83830830abe673930b78
2 Author: Dominick Grift <dominick.grift <AT> gmail <DOT> com>
3 AuthorDate: Sat Sep 29 08:30:50 2012 +0000
4 Commit: Sven Vermeulen <sven.vermeulen <AT> siphos <DOT> be>
5 CommitDate: Tue Oct 2 18:02:54 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-refpolicy.git;a=commit;h=d19c2a5d
7
8 Changes to the dnsmasq policy module and relevant dependencies
9
10 Ported from Fedora with changes.
11
12 Signed-off-by: Dominick Grift <dominick.grift <AT> gmail.com>
13
14 ---
15 policy/modules/contrib/dnsmasq.fc | 13 +++++++------
16 policy/modules/contrib/dnsmasq.if | 28 ++++++++++++++++------------
17 policy/modules/contrib/dnsmasq.te | 32 ++++++++++++++++++++++----------
18 policy/modules/contrib/virt.if | 36 ++++++++++++++++++++++++++++++++++++
19 policy/modules/contrib/virt.te | 2 +-
20 5 files changed, 82 insertions(+), 29 deletions(-)
21
22 diff --git a/policy/modules/contrib/dnsmasq.fc b/policy/modules/contrib/dnsmasq.fc
23 index b886676..1840808 100644
24 --- a/policy/modules/contrib/dnsmasq.fc
25 +++ b/policy/modules/contrib/dnsmasq.fc
26 @@ -1,12 +1,13 @@
27 -/etc/dnsmasq\.conf -- gen_context(system_u:object_r:dnsmasq_etc_t, s0)
28 +/etc/dnsmasq\.conf -- gen_context(system_u:object_r:dnsmasq_etc_t,s0)
29 +
30 /etc/rc\.d/init\.d/dnsmasq -- gen_context(system_u:object_r:dnsmasq_initrc_exec_t,s0)
31
32 -/usr/sbin/dnsmasq -- gen_context(system_u:object_r:dnsmasq_exec_t,s0)
33 +/usr/sbin/dnsmasq -- gen_context(system_u:object_r:dnsmasq_exec_t,s0)
34
35 /var/lib/misc/dnsmasq\.leases -- gen_context(system_u:object_r:dnsmasq_lease_t,s0)
36 -/var/lib/dnsmasq(/.*)? gen_context(system_u:object_r:dnsmasq_lease_t,s0)
37 +/var/lib/dnsmasq(/.*)? gen_context(system_u:object_r:dnsmasq_lease_t,s0)
38
39 -/var/log/dnsmasq\.log gen_context(system_u:object_r:dnsmasq_var_log_t,s0)
40 +/var/log/dnsmasq.* -- gen_context(system_u:object_r:dnsmasq_var_log_t,s0)
41
42 -/var/run/dnsmasq\.pid -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
43 -/var/run/libvirt/network(/.*)? gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
44 +/var/run/dnsmasq\.pid -- gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
45 +/var/run/libvirt/network(/.*)? gen_context(system_u:object_r:dnsmasq_var_run_t,s0)
46
47 diff --git a/policy/modules/contrib/dnsmasq.if b/policy/modules/contrib/dnsmasq.if
48 index 9bd812b..8da726e 100644
49 --- a/policy/modules/contrib/dnsmasq.if
50 +++ b/policy/modules/contrib/dnsmasq.if
51 @@ -1,4 +1,4 @@
52 -## <summary>dnsmasq DNS forwarder and DHCP server</summary>
53 +## <summary>DNS forwarder and DHCP server.</summary>
54
55 ########################################
56 ## <summary>
57 @@ -22,7 +22,8 @@ interface(`dnsmasq_domtrans',`
58
59 ########################################
60 ## <summary>
61 -## Execute the dnsmasq init script in the init script domain.
62 +## Execute the dnsmasq init script in
63 +## the init script domain.
64 ## </summary>
65 ## <param name="domain">
66 ## <summary>
67 @@ -41,7 +42,7 @@ interface(`dnsmasq_initrc_domtrans',`
68
69 ########################################
70 ## <summary>
71 -## Send dnsmasq a signal
72 +## Send generic signals to dnsmasq.
73 ## </summary>
74 ## <param name="domain">
75 ## <summary>
76 @@ -60,7 +61,7 @@ interface(`dnsmasq_signal',`
77
78 ########################################
79 ## <summary>
80 -## Send dnsmasq a signull
81 +## Send null signals to dnsmasq.
82 ## </summary>
83 ## <param name="domain">
84 ## <summary>
85 @@ -79,7 +80,7 @@ interface(`dnsmasq_signull',`
86
87 ########################################
88 ## <summary>
89 -## Send dnsmasq a kill signal.
90 +## Send kill signals to dnsmasq.
91 ## </summary>
92 ## <param name="domain">
93 ## <summary>
94 @@ -117,7 +118,7 @@ interface(`dnsmasq_read_config',`
95
96 ########################################
97 ## <summary>
98 -## Write to dnsmasq config files.
99 +## Write dnsmasq config files.
100 ## </summary>
101 ## <param name="domain">
102 ## <summary>
103 @@ -136,7 +137,7 @@ interface(`dnsmasq_write_config',`
104
105 ########################################
106 ## <summary>
107 -## Delete dnsmasq pid files
108 +## Delete dnsmasq pid files.
109 ## </summary>
110 ## <param name="domain">
111 ## <summary>
112 @@ -155,7 +156,7 @@ interface(`dnsmasq_delete_pid_files',`
113
114 ########################################
115 ## <summary>
116 -## Read dnsmasq pid files
117 +## Read dnsmasq pid files.
118 ## </summary>
119 ## <param name="domain">
120 ## <summary>
121 @@ -174,8 +175,8 @@ interface(`dnsmasq_read_pid_files',`
122
123 ########################################
124 ## <summary>
125 -## All of the rules required to administrate
126 -## an dnsmasq environment
127 +## All of the rules required to
128 +## administrate an dnsmasq environment.
129 ## </summary>
130 ## <param name="domain">
131 ## <summary>
132 @@ -184,7 +185,7 @@ interface(`dnsmasq_read_pid_files',`
133 ## </param>
134 ## <param name="role">
135 ## <summary>
136 -## The role to be allowed to manage the dnsmasq domain.
137 +## Role allowed access.
138 ## </summary>
139 ## </param>
140 ## <rolecap/>
141 @@ -192,7 +193,7 @@ interface(`dnsmasq_read_pid_files',`
142 interface(`dnsmasq_admin',`
143 gen_require(`
144 type dnsmasq_t, dnsmasq_lease_t, dnsmasq_var_run_t;
145 - type dnsmasq_initrc_exec_t;
146 + type dnsmasq_initrc_exec_t, dnsmasq_var_log_t;
147 ')
148
149 allow $1 dnsmasq_t:process { ptrace signal_perms };
150 @@ -206,6 +207,9 @@ interface(`dnsmasq_admin',`
151 files_list_var_lib($1)
152 admin_pattern($1, dnsmasq_lease_t)
153
154 + logging_seearch_logs($1)
155 + admin_pattern($1, dnsmasq_var_log_t)
156 +
157 files_list_pids($1)
158 admin_pattern($1, dnsmasq_var_run_t)
159 ')
160
161 diff --git a/policy/modules/contrib/dnsmasq.te b/policy/modules/contrib/dnsmasq.te
162 index fdaeeba..aef646e 100644
163 --- a/policy/modules/contrib/dnsmasq.te
164 +++ b/policy/modules/contrib/dnsmasq.te
165 @@ -1,4 +1,4 @@
166 -policy_module(dnsmasq, 1.9.0)
167 +policy_module(dnsmasq, 1.9.1)
168
169 ########################################
170 #
171 @@ -33,26 +33,28 @@ allow dnsmasq_t self:capability { chown dac_override net_admin setgid setuid net
172 dontaudit dnsmasq_t self:capability sys_tty_config;
173 allow dnsmasq_t self:process { getcap setcap signal_perms };
174 allow dnsmasq_t self:fifo_file rw_fifo_file_perms;
175 -allow dnsmasq_t self:netlink_route_socket { bind create nlmsg_read read write };
176 -allow dnsmasq_t self:tcp_socket create_stream_socket_perms;
177 -allow dnsmasq_t self:udp_socket create_socket_perms;
178 +allow dnsmasq_t self:tcp_socket { accept listen };
179 allow dnsmasq_t self:packet_socket create_socket_perms;
180 allow dnsmasq_t self:rawip_socket create_socket_perms;
181
182 read_files_pattern(dnsmasq_t, dnsmasq_etc_t, dnsmasq_etc_t)
183
184 -# dhcp leases
185 manage_files_pattern(dnsmasq_t, dnsmasq_lease_t, dnsmasq_lease_t)
186 files_var_lib_filetrans(dnsmasq_t, dnsmasq_lease_t, file)
187
188 -manage_files_pattern(dnsmasq_t, dnsmasq_var_log_t, dnsmasq_var_log_t)
189 +allow dnsmasq_t dnsmasq_var_log_t:file append_file_perms;
190 +allow dnsmasq_t dnsmasq_var_log_t:file create_file_perms;
191 +allow dnsmasq_t dnsmasq_var_log_t:file setattr_file_perms;
192 logging_log_filetrans(dnsmasq_t, dnsmasq_var_log_t, file)
193
194 +manage_dirs_pattern(dnsmasq_t, dnsmasq_var_run_t, dnsmasq_var_run_t)
195 manage_files_pattern(dnsmasq_t, dnsmasq_var_run_t, dnsmasq_var_run_t)
196 -files_pid_filetrans(dnsmasq_t, dnsmasq_var_run_t, file)
197 +files_pid_filetrans(dnsmasq_t, dnsmasq_var_run_t, { dir file })
198
199 kernel_read_kernel_sysctls(dnsmasq_t)
200 +kernel_read_network_state(dnsmasq_t)
201 kernel_read_system_state(dnsmasq_t)
202 +kernel_request_load_module(dnsmasq_t)
203
204 corenet_all_recvfrom_unlabeled(dnsmasq_t)
205 corenet_all_recvfrom_netlabel(dnsmasq_t)
206 @@ -66,17 +68,17 @@ corenet_tcp_sendrecv_all_ports(dnsmasq_t)
207 corenet_udp_sendrecv_all_ports(dnsmasq_t)
208 corenet_tcp_bind_generic_node(dnsmasq_t)
209 corenet_udp_bind_generic_node(dnsmasq_t)
210 -corenet_tcp_bind_dns_port(dnsmasq_t)
211 -corenet_udp_bind_all_ports(dnsmasq_t)
212 +
213 corenet_sendrecv_dns_server_packets(dnsmasq_t)
214 +corenet_tcp_bind_dns_port(dnsmasq_t)
215 corenet_sendrecv_dhcpd_server_packets(dnsmasq_t)
216 +corenet_udp_bind_all_ports(dnsmasq_t)
217
218 dev_read_sysfs(dnsmasq_t)
219 dev_read_urand(dnsmasq_t)
220
221 domain_use_interactive_fds(dnsmasq_t)
222
223 -files_read_etc_files(dnsmasq_t)
224 files_read_etc_runtime_files(dnsmasq_t)
225
226 fs_getattr_all_fs(dnsmasq_t)
227 @@ -96,10 +98,19 @@ optional_policy(`
228 ')
229
230 optional_policy(`
231 + dbus_connect_system_bus(dnsmasq_t)
232 dbus_system_bus_client(dnsmasq_t)
233 ')
234
235 optional_policy(`
236 + networkmanager_read_pid_files(dnsmasq_t)
237 +')
238 +
239 +optional_policy(`
240 + ppp_read_pid_files(dnsmasq_t)
241 +')
242 +
243 +optional_policy(`
244 seutil_sigchld_newrole(dnsmasq_t)
245 ')
246
247 @@ -114,4 +125,5 @@ optional_policy(`
248 optional_policy(`
249 virt_manage_lib_files(dnsmasq_t)
250 virt_read_pid_files(dnsmasq_t)
251 + virt_pid_filetrans(dnsmasq_t, dnsmasq_var_run_t, { dir file })
252 ')
253
254 diff --git a/policy/modules/contrib/virt.if b/policy/modules/contrib/virt.if
255 index d50f826..8879895 100644
256 --- a/policy/modules/contrib/virt.if
257 +++ b/policy/modules/contrib/virt.if
258 @@ -348,6 +348,42 @@ interface(`virt_manage_lib_files',`
259
260 ########################################
261 ## <summary>
262 +## Create objects in virt pid
263 +## directories with a private type.
264 +## </summary>
265 +## <param name="domain">
266 +## <summary>
267 +## Domain allowed access.
268 +## </summary>
269 +## </param>
270 +## <param name="private type">
271 +## <summary>
272 +## The type of the object to be created.
273 +## </summary>
274 +## </param>
275 +## <param name="object">
276 +## <summary>
277 +## The object class of the object being created.
278 +## </summary>
279 +## </param>
280 +## <param name="name" optional="true">
281 +## <summary>
282 +## The name of the object being created.
283 +## </summary>
284 +## </param>
285 +## <infoflow type="write" weight="10"/>
286 +#
287 +interface(`virt_pid_filetrans',`
288 + gen_require(`
289 + type virt_var_run_t;
290 + ')
291 +
292 + files_search_pids($1)
293 + filetrans_pattern($1, virt_var_run_t, $2, $3, $4)
294 +')
295 +
296 +########################################
297 +## <summary>
298 ## Allow the specified domain to read virt's log files.
299 ## </summary>
300 ## <param name="domain">
301
302 diff --git a/policy/modules/contrib/virt.te b/policy/modules/contrib/virt.te
303 index 53428f9..a3aa08e 100644
304 --- a/policy/modules/contrib/virt.te
305 +++ b/policy/modules/contrib/virt.te
306 @@ -1,4 +1,4 @@
307 -policy_module(virt, 1.5.2)
308 +policy_module(virt, 1.5.3)
309
310 ########################################
311 #