]> git.ipfire.org Git - people/stevee/selinux-policy.git/blame - policy/modules/system/xen.te
patch from dan Tue, 05 Sep 2006 17:06:06 -0400
[people/stevee/selinux-policy.git] / policy / modules / system / xen.te
CommitLineData
a3cf80d8 1
75beb950 2policy_module(xen,1.0.10)
a3cf80d8
CP
3
4########################################
5#
6# Declarations
7#
8
9# console ptys
10type xen_devpts_t;
11term_pty(xen_devpts_t);
12files_type(xen_devpts_t);
13
522b59bb
CP
14# Xen Image files
15type xen_image_t; # customizable
16files_type(xen_image_t)
17
a3cf80d8
CP
18type xend_t;
19type xend_exec_t;
20domain_type(xend_t)
21init_daemon_domain(xend_t, xend_exec_t)
22
23# var/lib files
24type xend_var_lib_t;
25files_type(xend_var_lib_t)
cdc86ee5
CP
26# for mounting an NFS store
27files_mountpoint(xend_var_lib_t)
a3cf80d8
CP
28
29# log files
30type xend_var_log_t;
31logging_log_file(xend_var_log_t)
32
33# pid files
34type xend_var_run_t;
35files_pid_file(xend_var_run_t)
36
37type xenstored_t;
38type xenstored_exec_t;
39domain_type(xenstored_t)
40domain_entry_file(xenstored_t,xenstored_exec_t)
41role system_r types xenstored_t;
42
43# var/lib files
44type xenstored_var_lib_t;
45files_type(xenstored_var_lib_t)
46
47# pid files
48type xenstored_var_run_t;
49files_pid_file(xenstored_var_run_t)
50
51type xenconsoled_t;
52type xenconsoled_exec_t;
53domain_type(xenconsoled_t)
54domain_entry_file(xenconsoled_t,xenconsoled_exec_t)
55role system_r types xenconsoled_t;
56
57# pid files
58type xenconsoled_var_run_t;
59files_pid_file(xenconsoled_var_run_t)
60
e9935943
CP
61type xm_t;
62type xm_exec_t;
63domain_type(xm_t)
64init_daemon_domain(xm_t, xm_exec_t)
65
a3cf80d8
CP
66########################################
67#
68# xend local policy
69#
70
123a990b 71allow xend_t self:capability { dac_override ipc_lock net_admin setuid sys_nice sys_tty_config net_raw };
a5e2133b 72dontaudit xend_t self:capability { sys_ptrace };
a3cf80d8 73allow xend_t self:process { signal sigkill };
a5e2133b 74dontaudit xend_t self:process ptrace;
a3cf80d8
CP
75# internal communication is often done using fifo and unix sockets.
76allow xend_t self:fifo_file rw_file_perms;
77allow xend_t self:unix_stream_socket create_stream_socket_perms;
78allow xend_t self:unix_dgram_socket create_socket_perms;
79allow xend_t self:netlink_route_socket r_netlink_socket_perms;
80allow xend_t self:tcp_socket create_stream_socket_perms;
81allow xend_t self:packet_socket create_socket_perms;
82
522b59bb 83allow xend_t xen_image_t:dir r_dir_perms;
a5e2133b 84allow xend_t xen_image_t:file rw_file_perms;
522b59bb 85
a3cf80d8
CP
86# pid file
87allow xend_t xend_var_run_t:file manage_file_perms;
88allow xend_t xend_var_run_t:sock_file manage_file_perms;
87eb5c84 89allow xend_t xend_var_run_t:dir { setattr rw_dir_perms };
a3cf80d8
CP
90files_pid_filetrans(xend_t,xend_var_run_t, { file sock_file })
91
92# log files
93allow xend_t xend_var_log_t:file create_file_perms;
94allow xend_t xend_var_log_t:sock_file create_file_perms;
95allow xend_t xend_var_log_t:dir { rw_dir_perms setattr };
96logging_log_filetrans(xend_t,xend_var_log_t,{ sock_file file dir })
97
98# var/lib files for xend
99allow xend_t xend_var_lib_t:file create_file_perms;
100allow xend_t xend_var_lib_t:sock_file create_file_perms;
522b59bb 101allow xend_t xend_var_lib_t:fifo_file create_file_perms;
a3cf80d8 102allow xend_t xend_var_lib_t:dir create_dir_perms;
522b59bb 103files_var_lib_filetrans(xend_t,xend_var_lib_t,{ file dir })
a3cf80d8
CP
104
105# transition to store
106domain_auto_trans(xend_t, xenstored_exec_t, xenstored_t)
107allow xenstored_t xend_t:fd use;
108allow xenstored_t xend_t:process sigchld;
109allow xenstored_t xend_t:fifo_file write;
110
111# transition to console
112domain_auto_trans(xend_t, xenconsoled_exec_t, xenconsoled_t)
113allow xenconsoled_t xend_t:fd use;
114
115kernel_read_kernel_sysctls(xend_t)
116kernel_read_system_state(xend_t)
117kernel_write_xen_state(xend_t)
118kernel_read_xen_state(xend_t)
119kernel_rw_net_sysctls(xend_t)
120kernel_read_network_state(xend_t)
121
122corecmd_exec_sbin(xend_t)
123corecmd_exec_bin(xend_t)
124corecmd_exec_shell(xend_t)
125
35a4b349 126corenet_non_ipsec_sendrecv(xend_t)
a3cf80d8
CP
127corenet_tcp_sendrecv_all_if(xend_t)
128corenet_tcp_sendrecv_all_nodes(xend_t)
129corenet_tcp_sendrecv_all_ports(xend_t)
522b59bb 130corenet_tcp_bind_all_nodes(xend_t)
a3cf80d8
CP
131corenet_tcp_bind_xen_port(xend_t)
132corenet_tcp_bind_soundd_port(xend_t)
a5e2133b 133corenet_tcp_bind_generic_port(xend_t)
75beb950 134corenet_tcp_bind_vnc_port(xend_t)
35a4b349
CP
135corenet_sendrecv_xen_server_packets(xend_t)
136corenet_sendrecv_soundd_server_packets(xend_t)
a5e2133b 137corenet_rw_tun_tap_dev(xend_t)
a3cf80d8
CP
138
139dev_read_urand(xend_t)
140dev_manage_xen(xend_t)
141dev_filetrans_xen(xend_t)
142dev_rw_sysfs(xend_t)
143
144domain_read_all_domains_state(xend_t)
145domain_dontaudit_read_all_domains_state(xend_t)
a5e2133b 146domain_dontaudit_ptrace_all_domains(xend_t)
a3cf80d8
CP
147
148files_read_etc_files(xend_t)
cdc86ee5 149files_read_kernel_symbol_table(xend_t)
0e1c461e 150files_read_kernel_img(xend_t)
522b59bb
CP
151files_manage_etc_runtime_files(xend_t)
152files_etc_filetrans_etc_runtime(xend_t,file)
a5e2133b 153files_read_usr_files(xend_t)
a3cf80d8
CP
154
155storage_raw_read_fixed_disk(xend_t)
156
a5e2133b
CP
157term_getattr_all_user_ptys(xend_t)
158term_use_generic_ptys(xend_t)
159term_use_ptmx(xend_t)
160term_getattr_pty_fs(xend_t)
a3cf80d8
CP
161
162init_use_fds(xend_t)
a5e2133b 163init_use_script_ptys(xend_t)
a3cf80d8
CP
164
165libs_use_ld_so(xend_t)
166libs_use_shared_libs(xend_t)
167
168logging_send_syslog_msg(xend_t)
169
170miscfiles_read_localization(xend_t)
171
172sysnet_domtrans_dhcpc(xend_t)
173sysnet_signal_dhcpc(xend_t)
174sysnet_domtrans_ifconfig(xend_t)
175sysnet_dns_name_resolve(xend_t)
176sysnet_delete_dhcpc_pid(xend_t)
177sysnet_read_dhcpc_pid(xend_t)
178
75beb950
CP
179userdom_dontaudit_search_sysadm_home_dirs(xend_t)
180
a3cf80d8
CP
181xen_stream_connect_xenstore(xend_t)
182
123a990b
CP
183netutils_domtrans(xend_t)
184
87eb5c84 185optional_policy(`
46551033 186 consoletype_exec(xend_t)
87eb5c84
CP
187')
188
a3cf80d8
CP
189########################################
190#
191# Xen console local policy
192#
193
194allow xenconsoled_t self:capability { dac_override fsetid ipc_lock };
195allow xenconsoled_t self:unix_stream_socket create_stream_socket_perms;
196allow xenconsoled_t self:fifo_file { read write };
197
198allow xenconsoled_t xen_devpts_t:chr_file rw_term_perms;
199
200# pid file
201allow xenconsoled_t xenconsoled_var_run_t:file manage_file_perms;
202allow xenconsoled_t xenconsoled_var_run_t:sock_file manage_file_perms;
203allow xenconsoled_t xenconsoled_var_run_t:dir rw_dir_perms;
204files_pid_filetrans(xenconsoled_t,xenconsoled_var_run_t, { file sock_file })
205
206kernel_read_kernel_sysctls(xenconsoled_t)
207kernel_write_xen_state(xenconsoled_t)
208kernel_read_xen_state(xenconsoled_t)
209
a5e2133b
CP
210domain_dontaudit_ptrace_all_domains(xenconsoled_t)
211
a3cf80d8 212term_create_pty(xenconsoled_t,xen_devpts_t);
a5e2133b 213term_use_generic_ptys(xenconsoled_t)
87eb5c84 214term_use_console(xenconsoled_t)
a3cf80d8
CP
215
216init_use_fds(xenconsoled_t)
a5e2133b 217init_use_script_ptys(xenconsoled_t)
a3cf80d8
CP
218
219libs_use_ld_so(xenconsoled_t)
220libs_use_shared_libs(xenconsoled_t)
221
222miscfiles_read_localization(xenconsoled_t)
223
224xen_append_log(xenconsoled_t)
225xen_stream_connect_xenstore(xenconsoled_t)
226
227########################################
228#
229# Xen store local policy
230#
231
232allow xenstored_t self:capability { dac_override mknod ipc_lock };
233allow xenstored_t self:unix_stream_socket create_stream_socket_perms;
87eb5c84 234allow xenstored_t self:unix_dgram_socket create_socket_perms;
a3cf80d8
CP
235
236# pid file
237allow xenstored_t xenstored_var_run_t:file manage_file_perms;
238allow xenstored_t xenstored_var_run_t:sock_file manage_file_perms;
239allow xenstored_t xenstored_var_run_t:dir rw_dir_perms;
240files_pid_filetrans(xenstored_t,xenstored_var_run_t, { file sock_file })
241
242# var/lib files for xenstored
243allow xenstored_t xenstored_var_lib_t:file create_file_perms;
244allow xenstored_t xenstored_var_lib_t:sock_file create_file_perms;
245allow xenstored_t xenstored_var_lib_t:dir create_dir_perms;
246files_var_lib_filetrans(xenstored_t,xenstored_var_lib_t,{ file dir sock_file })
247
248kernel_write_xen_state(xenstored_t)
249kernel_read_xen_state(xenstored_t)
250
251dev_create_generic_dirs(xenstored_t)
252dev_manage_xen(xenconsoled_t)
253dev_filetrans_xen(xenstored_t)
cdc86ee5 254dev_rw_xen(xenstored_t)
a3cf80d8 255
a5e2133b
CP
256term_use_generic_ptys(xenstored_t)
257term_use_console(xenconsoled_t)
a3cf80d8
CP
258
259init_use_fds(xenstored_t)
a5e2133b 260init_use_script_ptys(xenstored_t)
a3cf80d8
CP
261
262libs_use_ld_so(xenstored_t)
263libs_use_shared_libs(xenstored_t)
264
87eb5c84
CP
265logging_send_syslog_msg(xenstored_t)
266
a3cf80d8
CP
267miscfiles_read_localization(xenstored_t)
268
269xen_append_log(xenstored_t)
e9935943
CP
270
271########################################
272#
273# xm local policy
274#
275
123a990b
CP
276allow xm_t self:capability { dac_override ipc_lock sys_tty_config };
277
e9935943
CP
278# internal communication is often done using fifo and unix sockets.
279allow xm_t self:fifo_file { read write };
280allow xm_t self:unix_stream_socket create_stream_socket_perms;
281
522b59bb
CP
282allow xm_t xend_var_lib_t:dir rw_dir_perms;
283allow xm_t xend_var_lib_t:fifo_file create_file_perms;
284allow xm_t xend_var_lib_t:file create_file_perms;
285files_search_var_lib(xm_t)
286
123a990b
CP
287allow xm_t xen_image_t:dir rw_dir_perms;
288allow xm_t xen_image_t:file r_file_perms;
289
e9935943
CP
290kernel_read_system_state(xm_t)
291kernel_read_kernel_sysctls(xm_t)
292kernel_read_xen_state(xm_t)
293kernel_write_xen_state(xm_t)
294
295corecmd_exec_bin(xm_t)
296corecmd_exec_sbin(xm_t)
297
298dev_read_urand(xm_t)
299
522b59bb
CP
300files_read_etc_runtime_files(xm_t)
301files_read_usr_files(xm_t)
302files_list_mnt(xm_t)
e9935943
CP
303# Some common macros (you might be able to remove some)
304files_read_etc_files(xm_t)
305
306term_use_all_terms(xm_t)
307
522b59bb 308init_rw_script_stream_sockets(xm_t)
123a990b 309init_use_fds(xm_t)
522b59bb 310
e9935943
CP
311libs_use_ld_so(xm_t)
312libs_use_shared_libs(xm_t)
313
314miscfiles_read_localization(xm_t)
315
316xen_append_log(xm_t)
317xen_stream_connect(xm_t)
318xen_stream_connect_xenstore(xm_t)