Chris PeBenito eb4216
## <summary>Libvirt virtualization API</summary>
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Execute a domain transition to run virt.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Domain allowed to transition.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`virt_domtrans',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type virtd_t, virtd_exec_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	domtrans_pattern($1, virtd_exec_t, virtd_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Read virt config files.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain allowed access.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`virt_read_config',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type virt_etc_t;
Chris PeBenito eb4216
		type virt_etc_rw_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	files_search_etc($1)
Chris PeBenito eb4216
	read_files_pattern($1, virt_etc_t, virt_etc_t)
Chris PeBenito eb4216
	read_files_pattern($1, virt_etc_rw_t, virt_etc_rw_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Read virt PID files.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain allowed access.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`virt_read_pid_files',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type virt_var_run_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	files_search_pids($1)
Chris PeBenito eb4216
	allow $1 virt_var_run_t:file read_file_perms;
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Manage virt pid files.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain allowed access.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`virt_manage_pids_files',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type virt_var_run_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
         manage_files_pattern($1, virt_var_run_t, virt_var_run_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Search virt lib directories.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain allowed access.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`virt_search_lib',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type virt_var_lib_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	allow $1 virt_var_lib_t:dir search_dir_perms;
Chris PeBenito eb4216
	files_search_var_lib($1)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Read virt lib files.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain allowed access.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`virt_read_lib_files',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type virt_var_lib_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	files_search_var_lib($1)
Chris PeBenito eb4216
        read_files_pattern($1, virt_var_lib_t, virt_var_lib_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Create, read, write, and delete
Chris PeBenito eb4216
##	virt lib files.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain allowed access.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`virt_manage_lib_files',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type virt_var_lib_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	files_search_var_lib($1)
Chris PeBenito eb4216
        manage_files_pattern($1, virt_var_lib_t, virt_var_lib_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Allow the specified domain to read virt's log files.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain allowed access.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
## <rolecap/>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`virt_read_log',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type virt_log_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	logging_search_logs($1)
Chris PeBenito eb4216
        read_files_pattern($1, virt_log_t, virt_log_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Allow the specified domain to append
Chris PeBenito eb4216
##	virt log files.
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
## 	<summary>
Chris PeBenito eb4216
##	Domain allowed to transition.
Chris PeBenito eb4216
## 	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`virt_append_log',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type var_log_t, virt_log_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	logging_search_logs($1)
Chris PeBenito eb4216
        append_files_pattern($1, virt_log_t, virt_log_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Allow domain to manage virt log files
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain to not audit.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`virt_manage_log',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type virt_log_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
         manage_dirs_pattern($1, virt_log_t, virt_log_t)
Chris PeBenito eb4216
         manage_files_pattern($1, virt_log_t, virt_log_t)
Chris PeBenito eb4216
         manage_lnk_files_pattern($1, virt_log_t, virt_log_t)
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	Allow domain to manage virt image files
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain to not audit.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`virt_manage_images',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type virt_image_t, virt_var_lib_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	virt_search_lib($1)
Chris PeBenito eb4216
	allow $1 virt_image_t:dir list_dir_perms;
Chris PeBenito eb4216
	manage_dirs_pattern($1, virt_image_t, virt_image_t)
Chris PeBenito eb4216
	manage_files_pattern($1, virt_image_t, virt_image_t)
Chris PeBenito eb4216
	read_lnk_files_pattern($1, virt_image_t, virt_image_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	tunable_policy(`virt_use_nfs',`
Chris PeBenito eb4216
		fs_manage_nfs_dirs($1)
Chris PeBenito eb4216
		fs_manage_nfs_files($1)
Chris PeBenito eb4216
		fs_read_nfs_symlinks($1)
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	tunable_policy(`virt_use_samba',`
Chris PeBenito eb4216
		fs_manage_nfs_files($1)
Chris PeBenito eb4216
		fs_manage_cifs_files($1)
Chris PeBenito eb4216
		fs_read_cifs_symlinks($1)
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
')
Chris PeBenito eb4216
Chris PeBenito eb4216
########################################
Chris PeBenito eb4216
## <summary>
Chris PeBenito eb4216
##	All of the rules required to administrate 
Chris PeBenito eb4216
##	an virt environment
Chris PeBenito eb4216
## </summary>
Chris PeBenito eb4216
## <param name="domain">
Chris PeBenito eb4216
##	<summary>
Chris PeBenito eb4216
##	Domain allowed access.
Chris PeBenito eb4216
##	</summary>
Chris PeBenito eb4216
## </param>
Chris PeBenito eb4216
## <rolecap/>
Chris PeBenito eb4216
#
Chris PeBenito eb4216
interface(`virt_admin',`
Chris PeBenito eb4216
	gen_require(`
Chris PeBenito eb4216
		type virtd_t;
Chris PeBenito eb4216
	')
Chris PeBenito eb4216
Chris PeBenito eb4216
	allow $1 virtd_t:process { ptrace signal_perms };
Chris PeBenito eb4216
	ps_process_pattern($1, virtd_t)
Chris PeBenito eb4216
Chris PeBenito eb4216
	virt_manage_pid_files($1)
Chris PeBenito eb4216
Chris PeBenito eb4216
	virt_manage_lib_files($1)
Chris PeBenito eb4216
Chris PeBenito eb4216
	virt_manage_log($1)
Chris PeBenito eb4216
')