[refpolicy] [PATCH v3] virt: Add policy for virtlockd the Virtual machine lock manager

Dominick Grift dac.override at gmail.com
Sat Sep 5 15:30:15 UTC 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

On Sat, Sep 05, 2015 at 10:43:34PM +0800, Jason Zaman wrote:
> ---
>  virt.fc |  4 ++++
>  virt.te | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  2 files changed, 60 insertions(+)

Merged, thanks

> 
> diff --git a/virt.fc b/virt.fc
> index b38007b..ea197d0 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	-s	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 f512ddc..83ad4a2 100644
> --- a/virt.te
> +++ b/virt.te
> @@ -198,6 +198,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_type(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
> @@ -229,6 +247,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 };
>  
> @@ -534,6 +553,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)
>  
> @@ -1258,3 +1278,39 @@ 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 rw_fifo_file_perms;
> +
> +allow virtlockd_t virt_image_type:dir list_dir_perms;
> +allow virtlockd_t virt_image_type:file rw_file_perms;
> +
> +create_files_pattern(virtlockd_t, virt_log_t, virt_log_t)
> +
> +list_dirs_pattern(virtlockd_t, virt_var_lib_t, virt_var_lib_t)
> +
> +manage_dirs_pattern(virtlockd_t, { virt_var_lib_t virtlockd_var_lib_t }, virtlockd_var_lib_t)
> +manage_files_pattern(virtlockd_t, virtlockd_var_lib_t, virtlockd_var_lib_t)
> +filetrans_pattern(virtlockd_t, virt_var_lib_t, virtlockd_var_lib_t, dir)
> +
> +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, 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)
> +
> +virt_append_log(virtlockd_t)
> +virt_read_config(virtlockd_t)
> -- 
> 2.4.6
> 
> _______________________________________________
> refpolicy mailing list
> refpolicy at oss.tresys.com
> http://oss.tresys.com/mailman/listinfo/refpolicy

- -- 
02DFF788
4D30 903A 1CF3 B756 FB48  1514 3148 83A2 02DF F788
http://keys.gnupg.net/pks/lookup?op=vindex&search=0x314883A202DFF788
Dominick Grift
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQGcBAEBCgAGBQJV6wqCAAoJENAR6kfG5xmcAvQMAIhh4mKXxzhEh9VP9DVr4TIo
2Hhaahkq1DT0x2huJkS0Ng6sykUz3Fr87UsOCmIO6h1rHRGSPglwaiL8pG2owQkt
y2yu97oF2mMxhRzIipVot3qZxO9jQwuvLLpHFjfr0uwnJYWJ+YQZpq3uoFqhVBzv
R7RGDQj9CBkajPB4EZ+/04PFTcTtWpedJCYc0LQMtBdvs0zBWLPIk88gfLo7sWFr
eeZA8jsg6dtCT16AjB47jI4ydDpwD0vNqjSffEeIXSPM4D7KuZ+HkrEtI4MWCdkX
ivH6hDzIcVrNswoyjYw7Eu7uEBOZ/6at3GEnx/siU5hK/NK68LCST6PfUFr0Djh+
exA0/4ZqwKOPpL/wWbdGf2svIlyFXGAgqPeAR2JQE/EWoe8qOJto8Gaw9LiErTdy
JSg9NVoK2ZaFyR+pyijcmDE2MPwX9sARTCTm7GToio0ejYmrTKShMuRV8dxENdBQ
ZJ316kmy1Cc+qDjcS/U+l5cCv3JKUgtcMmiNp6/i4A==
=2o0p
-----END PGP SIGNATURE-----


More information about the refpolicy mailing list