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
204
205
206
207
208
209
210
|
## <summary>QEMU machine emulator and virtualizer</summary>
########################################
## <summary>
## Execute a domain transition to run qemu.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`qemu_domtrans',`
gen_require(`
type qemu_t, qemu_exec_t;
')
domtrans_pattern($1, qemu_exec_t, qemu_t)
')
########################################
## <summary>
## Execute qemu in the qemu domain.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
## <param name="role">
## <summary>
## The role to allow the qemu domain.
## </summary>
## </param>
#
interface(`qemu_run',`
gen_require(`
type qemu_t;
')
qemu_domtrans($1)
role $2 types qemu_t;
')
########################################
## <summary>
## Allow the domain to read state files in /proc.
## </summary>
## <param name="domain">
## <summary>
## Domain to allow access.
## </summary>
## </param>
#
interface(`qemu_read_state',`
gen_require(`
type qemu_t;
')
read_files_pattern($1, qemu_t, qemu_t)
')
########################################
## <summary>
## Send a signal to qemu.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`qemu_signal',`
gen_require(`
type qemu_t;
')
allow $1 qemu_t:process signal;
')
########################################
## <summary>
## Send a sigill to qemu
## </summary>
## <param name="domain">
## <summary>
## Domain allowed access.
## </summary>
## </param>
#
interface(`qemu_kill',`
gen_require(`
type qemu_t;
')
allow $1 qemu_t:process sigkill;
')
########################################
## <summary>
## Execute a domain transition to run qemu unconfined.
## </summary>
## <param name="domain">
## <summary>
## Domain allowed to transition.
## </summary>
## </param>
#
interface(`qemu_domtrans_unconfined',`
gen_require(`
type qemu_unconfined_t, qemu_exec_t;
')
domtrans_pattern($1, qemu_exec_t, qemu_unconfined_t)
')
########################################
## <summary>
## Creates types and rules for a basic
## qemu process domain.
## </summary>
## <param name="prefix">
## <summary>
## Prefix for the domain.
## </summary>
## </param>
#
template(`qemu_domain_template',`
##############################
#
# Local Policy
#
type $1_t;
domain_type($1_t)
type $1_tmp_t;
files_tmp_file($1_tmp_t)
##############################
#
# Local Policy
#
allow $1_t self:capability { dac_read_search dac_override };
allow $1_t self:process { execstack execmem signal getsched };
allow $1_t self:fifo_file rw_file_perms;
allow $1_t self:shm create_shm_perms;
allow $1_t self:unix_stream_socket create_stream_socket_perms;
allow $1_t self:tcp_socket create_stream_socket_perms;
manage_dirs_pattern($1_t, $1_tmp_t, $1_tmp_t)
manage_files_pattern($1_t, $1_tmp_t, $1_tmp_t)
files_tmp_filetrans($1_t, $1_tmp_t, { file dir })
kernel_read_system_state($1_t)
corenet_all_recvfrom_unlabeled($1_t)
corenet_all_recvfrom_netlabel($1_t)
corenet_tcp_sendrecv_generic_if($1_t)
corenet_tcp_sendrecv_generic_node($1_t)
corenet_tcp_sendrecv_all_ports($1_t)
corenet_tcp_bind_generic_node($1_t)
corenet_tcp_bind_vnc_port($1_t)
corenet_rw_tun_tap_dev($1_t)
# dev_rw_kvm($1_t)
domain_use_interactive_fds($1_t)
files_read_etc_files($1_t)
files_read_usr_files($1_t)
files_read_var_files($1_t)
files_search_all($1_t)
fs_list_inotifyfs($1_t)
fs_rw_anon_inodefs_files($1_t)
fs_rw_tmpfs_files($1_t)
storage_raw_write_removable_device($1_t)
storage_raw_read_removable_device($1_t)
term_use_ptmx($1_t)
term_getattr_pty_fs($1_t)
term_use_generic_ptys($1_t)
miscfiles_read_localization($1_t)
sysnet_read_config($1_t)
userdom_use_user_terminals($1_t)
optional_policy(`
samba_domtrans_smbd($1_t)
')
optional_policy(`
virt_manage_images($1_t)
virt_read_config($1_t)
virt_read_lib_files($1_t)
')
optional_policy(`
xserver_stream_connect($1_t)
xserver_read_xdm_tmp_files($1_t)
xserver_read_xdm_pid($1_t)
# xserver_xdm_rw_shm($1_t)
')
')
|