summaryrefslogtreecommitdiff
path: root/policy/modules/services/virt.te
blob: a51755ee429d5df4fdcca78c33e2336b0e07d079 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203

policy_module(virt, 1.2.0)

########################################
#
# Declarations
#

## <desc>
## <p>
## Allow virt to manage nfs files
## </p>
## </desc>
gen_tunable(virt_use_nfs, false)

## <desc>
## <p>
## Allow virt to manage cifs files
## </p>
## </desc>
gen_tunable(virt_use_samba, false)

attribute virt_image_type;

type virt_etc_t;
files_config_file(virt_etc_t)

type virt_etc_rw_t;
files_type(virt_etc_rw_t)

# virt Image files
type virt_image_t, virt_image_type; # customizable
virt_image(virt_image_t)

type virt_log_t;
logging_log_file(virt_log_t)

type virt_var_run_t;
files_pid_file(virt_var_run_t)

type virt_var_lib_t;
files_type(virt_var_lib_t)

type virtd_t;
type virtd_exec_t;
init_daemon_domain(virtd_t, virtd_exec_t)

type virtd_initrc_exec_t;
init_script_file(virtd_initrc_exec_t)

########################################
#
# virtd local policy
#

allow virtd_t self:capability { dac_override kill net_admin setgid sys_nice sys_ptrace };
allow virtd_t self:process { getsched sigkill signal execmem };
allow virtd_t self:fifo_file rw_file_perms;
allow virtd_t self:unix_stream_socket create_stream_socket_perms;
allow virtd_t self:tcp_socket create_stream_socket_perms;
allow virtd_t self:tun_socket create;

read_files_pattern(virtd_t, virt_etc_t, virt_etc_t)
read_lnk_files_pattern(virtd_t, virt_etc_t, virt_etc_t)

manage_dirs_pattern(virtd_t, virt_etc_rw_t, virt_etc_rw_t)
manage_files_pattern(virtd_t, virt_etc_rw_t, virt_etc_rw_t)
manage_lnk_files_pattern(virtd_t, virt_etc_rw_t, virt_etc_rw_t)
filetrans_pattern(virtd_t, virt_etc_t, virt_etc_rw_t, dir)

manage_files_pattern(virtd_t, virt_image_type, virt_image_type)

manage_dirs_pattern(virtd_t, virt_log_t, virt_log_t)
manage_files_pattern(virtd_t, virt_log_t, virt_log_t)
logging_log_filetrans(virtd_t, virt_log_t, { file dir })

manage_dirs_pattern(virtd_t, virt_var_lib_t, virt_var_lib_t)
manage_files_pattern(virtd_t, virt_var_lib_t, virt_var_lib_t)
files_var_lib_filetrans(virtd_t, virt_var_lib_t, { file dir })

manage_dirs_pattern(virtd_t, virt_var_run_t, virt_var_run_t)
manage_files_pattern(virtd_t, virt_var_run_t, virt_var_run_t)
manage_sock_files_pattern(virtd_t, virt_var_run_t, virt_var_run_t)
files_pid_filetrans(virtd_t, virt_var_run_t, { file dir })

kernel_read_system_state(virtd_t)
kernel_read_network_state(virtd_t)
kernel_rw_net_sysctls(virtd_t)
kernel_load_module(virtd_t)

corecmd_exec_bin(virtd_t)
corecmd_exec_shell(virtd_t)

corenet_all_recvfrom_unlabeled(virtd_t)
corenet_all_recvfrom_netlabel(virtd_t)
corenet_tcp_sendrecv_generic_if(virtd_t)
corenet_tcp_sendrecv_generic_node(virtd_t)
corenet_tcp_sendrecv_all_ports(virtd_t)
corenet_tcp_bind_generic_node(virtd_t)
#corenet_tcp_bind_virt_port(virtd_t)
corenet_tcp_bind_vnc_port(virtd_t)
corenet_tcp_connect_vnc_port(virtd_t)
corenet_tcp_connect_soundd_port(virtd_t)
corenet_rw_tun_tap_dev(virtd_t)

dev_read_sysfs(virtd_t)
dev_read_rand(virtd_t)

# Init script handling
domain_use_interactive_fds(virtd_t)

files_read_usr_files(virtd_t)
files_read_etc_files(virtd_t)
files_read_etc_runtime_files(virtd_t)
files_search_all(virtd_t)
files_list_kernel_modules(virtd_t)

fs_list_auto_mountpoints(virtd_t)

storage_raw_write_removable_device(virtd_t)
storage_raw_read_removable_device(virtd_t)

term_getattr_pty_fs(virtd_t)
term_use_ptmx(virtd_t)

auth_use_nsswitch(virtd_t)

miscfiles_read_localization(virtd_t)
miscfiles_read_certs(virtd_t)

logging_send_syslog_msg(virtd_t)

userdom_read_all_users_state(virtd_t)

tunable_policy(`virt_use_nfs',`
	fs_manage_nfs_dirs(virtd_t)
	fs_manage_nfs_files(virtd_t)
	fs_read_nfs_symlinks(virtd_t)
')

tunable_policy(`virt_use_samba',`
	fs_manage_nfs_files(virtd_t)
	fs_manage_cifs_files(virtd_t)
	fs_read_cifs_symlinks(virtd_t)
')

optional_policy(`
	brctl_domtrans(virtd_t)
')

optional_policy(`
	dbus_system_bus_client(virtd_t)

	optional_policy(`
		avahi_dbus_chat(virtd_t)
	')

	optional_policy(`
		consolekit_dbus_chat(virtd_t)
	')

	optional_policy(`
		hal_dbus_chat(virtd_t)
	')
')

optional_policy(`
	dnsmasq_domtrans(virtd_t)
	dnsmasq_signal(virtd_t)
	dnsmasq_kill(virtd_t)
')

optional_policy(`
	iptables_domtrans(virtd_t)
')

#optional_policy(`
#	polkit_domtrans_auth(virtd_t)
#	polkit_domtrans_resolve(virtd_t)
#')

optional_policy(`
	qemu_domtrans(virtd_t)
	qemu_read_state(virtd_t)
	qemu_signal(virtd_t)
	qemu_kill(virtd_t)
')

optional_policy(`
	sasl_connect(virtd_t)
')

optional_policy(`
	kernel_read_xen_state(virtd_t)
	kernel_write_xen_state(virtd_t)

	xen_stream_connect(virtd_t)
	xen_stream_connect_xenstore(virtd_t)
')

optional_policy(`
	unconfined_domain(virtd_t)
')