---
virt.fc | 4 ++++
virt.te | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+)
diff --git a/virt.fc b/virt.fc
index b38007b..7bc2d3c 100644
--- a/virt.fc
+++ b/virt.fc
@@ -27,6 +27,7 @@ HOME_DIR/VirtualMachines/isos(/.*)? gen_context(system_u:object_r:virt_content_t
/usr/sbin/fence_virtd -- gen_context(system_u:object_r:virsh_exec_t,s0)
/usr/sbin/libvirt-qmf -- gen_context(system_u:object_r:virt_qmf_exec_t,s0)
/usr/sbin/libvirtd -- gen_context(system_u:object_r:virtd_exec_t,s0)
+/usr/sbin/virtlockd -- gen_context(system_u:object_r:virtlockd_exec_t,s0)
/var/cache/libvirt(/.*)? gen_context(system_u:object_r:virt_cache_t,s0-mls_systemhigh)
@@ -35,6 +36,7 @@ HOME_DIR/VirtualMachines/isos(/.*)? gen_context(system_u:object_r:virt_content_t
/var/lib/libvirt/images(/.*)? gen_context(system_u:object_r:virt_image_t,s0)
/var/lib/libvirt/isos(/.*)? gen_context(system_u:object_r:virt_content_t,s0)
/var/lib/libvirt/qemu(/.*)? gen_context(system_u:object_r:svirt_var_run_t,s0-mls_systemhigh)
+/var/lib/libvirt/lockd(/.*)? gen_context(system_u:object_r:virtlockd_var_lib_t,s0)
/var/log/log(/.*)? gen_context(system_u:object_r:virt_log_t,s0)
/var/log/libvirt(/.*)? gen_context(system_u:object_r:virt_log_t,s0)
@@ -48,5 +50,7 @@ HOME_DIR/VirtualMachines/isos(/.*)? gen_context(system_u:object_r:virt_content_t
/var/run/libvirt/lxc(/.*)? gen_context(system_u:object_r:virtd_lxc_var_run_t,s0)
/var/run/libvirt-sandbox(/.*)? gen_context(system_u:object_r:virtd_lxc_var_run_t,s0)
/var/run/libvirt/qemu(/.*)? gen_context(system_u:object_r:svirt_var_run_t,s0-mls_systemhigh)
+/var/run/libvirt/virtlockd-sock gen_context(system_u:object_r:virtlockd_run_t,s0)
/var/run/user/[^/]*/libguestfs(/.*)? gen_context(system_u:object_r:virt_home_t,s0)
/var/run/vdsm(/.*)? gen_context(system_u:object_r:virt_var_run_t,s0)
+/var/run/virtlockd.pid gen_context(system_u:object_r:virtlockd_run_t,s0)
diff --git a/virt.te b/virt.te
index f8a59e4..c6ec8bc 100644
--- a/virt.te
+++ b/virt.te
@@ -190,6 +190,24 @@ type virsh_t;
type virsh_exec_t;
init_system_domain(virsh_t, virsh_exec_t)
+type virtlockd_t;
+type virtlockd_exec_t;
+init_daemon_domain(virtlockd_t, virtlockd_exec_t)
+
+type virtlockd_run_t;
+files_pid_file(virtlockd_run_t)
+
+type virtlockd_var_lib_t;
+files_mountpoint(virtlockd_var_lib_t)
+
+ifdef(`enable_mcs',`
+ init_ranged_daemon_domain(virtlockd_t, virtlockd_exec_t, s0 - mcs_systemhigh)
+')
+
+ifdef(`enable_mls',`
+ init_ranged_daemon_domain(virtlockd_t, virtlockd_exec_t, s0 - mls_systemhigh)
+')
+
########################################
#
# Common virt domain local policy
@@ -221,6 +239,7 @@ manage_lnk_files_pattern(virt_domain, svirt_var_run_t, svirt_var_run_t)
files_pid_filetrans(virt_domain, svirt_var_run_t, { dir file })
stream_connect_pattern(virt_domain, svirt_var_run_t, svirt_var_run_t, virtd_t)
+stream_connect_pattern(virt_domain, virt_var_run_t, virtlockd_run_t, virtlockd_t)
dontaudit virt_domain virt_tmpfs_type:file { read write };
@@ -522,6 +541,7 @@ filetrans_pattern(virtd_t, virt_var_run_t, virtd_lxc_var_run_t, dir, "lxc")
stream_connect_pattern(virtd_t, virtd_lxc_var_run_t, virtd_lxc_var_run_t, virtd_lxc_t)
stream_connect_pattern(virtd_t, svirt_var_run_t, svirt_var_run_t, virt_domain)
+stream_connect_pattern(virtd_t, virt_var_run_t, virtlockd_run_t, virtlockd_t)
can_exec(virtd_t, virt_tmp_t)
@@ -1239,3 +1259,42 @@ manage_files_pattern(virt_leaseshelper_t, virt_var_run_t, virt_var_run_t)
files_pid_filetrans(virt_leaseshelper_t, virt_var_run_t, file)
kernel_dontaudit_read_system_state(virt_leaseshelper_t)
+
+########################################
+#
+# Virtlockd local policy
+#
+
+allow virtlockd_t self:capability dac_override;
+allow virtlockd_t self:fifo_file { read write };
+
+allow virtlockd_t virt_image_type:file rw_file_perms;
+
+read_files_pattern(virtlockd_t, virt_etc_t, virt_etc_t)
+read_lnk_files_pattern(virtlockd_t, virt_etc_t, virt_etc_t)
+
+append_files_pattern(virtlockd_t, virt_log_t, virt_log_t)
+create_files_pattern(virtlockd_t, virt_log_t, virt_log_t)
+logging_log_filetrans(virtlockd_t, virt_log_t, { file dir })
+
+list_dirs_pattern(virtlockd_t, virt_var_lib_t, virt_var_lib_t)
+list_dirs_pattern(virtlockd_t, virt_image_type, virt_image_type)
+
+manage_dirs_pattern(virtlockd_t, { virt_var_lib_t virtlockd_var_lib_t }, virtlockd_var_lib_t)
+manage_files_pattern(virtlockd_t, { virt_var_lib_t virtlockd_var_lib_t }, virtlockd_var_lib_t)
+filetrans_pattern(virtlockd_t, virt_var_lib_t, virtlockd_var_lib_t, { dir file })
+
+manage_dirs_pattern(virtlockd_t, virt_var_run_t, virtlockd_run_t)
+manage_files_pattern(virtlockd_t, virt_var_run_t, virtlockd_run_t)
+manage_sock_files_pattern(virtlockd_t, virt_var_run_t, virtlockd_run_t)
+filetrans_pattern(virtlockd_t, virt_var_run_t, virtlockd_run_t, { dir file sock_file })
+files_pid_filetrans(virtlockd_t, virtlockd_run_t, file)
+
+can_exec(virtlockd_t, virtlockd_exec_t)
+
+ps_process_pattern(virtlockd_t, virtd_t)
+
+files_read_etc_files(virtlockd_t)
+files_list_var_lib(virtlockd_t)
+
+miscfiles_read_localization(virtlockd_t)
--
2.4.6
This is needed for the host side guest agent socket for qemu.
type=AVC msg=audit(1441210375.086:110241): avc: denied { create } for
pid=25153 comm="libvirtd"
scontext=system_u:system_r:virtd_t:s0-s0:c0.c1023
tcontext=system_u:system_r:svirt_t:s0:c110,c185
tclass=unix_stream_socket permissive=0
---
virt.te | 1 +
1 file changed, 1 insertion(+)
diff --git a/virt.te b/virt.te
index c6ec8bc..6187ef1 100644
--- a/virt.te
+++ b/virt.te
@@ -451,6 +451,7 @@ allow virtd_t self:netlink_kobject_uevent_socket create_socket_perms;
allow virtd_t self:netlink_route_socket nlmsg_write;
allow virtd_t virt_domain:process { getattr getsched setsched transition signal signull sigkill };
+allow virtd_t virt_domain:unix_stream_socket create_stream_socket_perms;
dontaudit virtd_t virt_domain:process { siginh noatsecure rlimitinh };
allow virtd_t svirt_lxc_domain:unix_stream_socket { create_stream_socket_perms connectto };
--
2.4.6