2008-06-16 18:59:07 +00:00
|
|
|
## <summary>Libvirt virtualization API</summary>
|
|
|
|
|
2010-02-09 15:28:17 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Creates types and rules for a basic
|
|
|
|
## qemu process domain.
|
|
|
|
## </summary>
|
|
|
|
## <param name="prefix">
|
|
|
|
## <summary>
|
|
|
|
## Prefix for the domain.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
template(`virt_domain_template',`
|
|
|
|
gen_require(`
|
|
|
|
type virtd_t;
|
2010-09-15 20:19:38 +00:00
|
|
|
attribute virt_image_type, virt_domain;
|
2010-02-09 15:28:17 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
type $1_t, virt_domain;
|
|
|
|
domain_type($1_t)
|
2010-03-22 14:24:34 +00:00
|
|
|
domain_user_exemption_target($1_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
mls_rangetrans_target($1_t)
|
2010-02-09 15:28:17 +00:00
|
|
|
role system_r types $1_t;
|
|
|
|
|
2010-03-22 14:24:34 +00:00
|
|
|
type $1_devpts_t;
|
|
|
|
term_pty($1_devpts_t)
|
|
|
|
|
2010-02-09 15:28:17 +00:00
|
|
|
type $1_tmp_t;
|
|
|
|
files_tmp_file($1_tmp_t)
|
|
|
|
|
|
|
|
type $1_tmpfs_t;
|
|
|
|
files_tmpfs_file($1_tmpfs_t)
|
|
|
|
|
|
|
|
type $1_image_t, virt_image_type;
|
|
|
|
files_type($1_image_t)
|
|
|
|
dev_node($1_image_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
dev_associate_sysfs($1_image_t)
|
2010-02-09 15:28:17 +00:00
|
|
|
|
2010-09-15 20:09:15 +00:00
|
|
|
allow $1_t $1_devpts_t:chr_file { rw_chr_file_perms setattr_chr_file_perms };
|
2010-03-22 14:24:34 +00:00
|
|
|
term_create_pty($1_t, $1_devpts_t)
|
|
|
|
|
2010-02-09 15:28:17 +00:00
|
|
|
manage_dirs_pattern($1_t, $1_image_t, $1_image_t)
|
|
|
|
manage_files_pattern($1_t, $1_image_t, $1_image_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
manage_fifo_files_pattern($1_t, $1_image_t, $1_image_t)
|
2010-02-09 15:28:17 +00:00
|
|
|
read_lnk_files_pattern($1_t, $1_image_t, $1_image_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
rw_chr_files_pattern($1_t, $1_image_t, $1_image_t)
|
2010-02-09 15:28:17 +00:00
|
|
|
rw_blk_files_pattern($1_t, $1_image_t, $1_image_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
fs_hugetlbfs_filetrans($1_t, $1_image_t, file)
|
2010-02-09 15:28:17 +00:00
|
|
|
|
|
|
|
manage_dirs_pattern($1_t, $1_tmp_t, $1_tmp_t)
|
|
|
|
manage_files_pattern($1_t, $1_tmp_t, $1_tmp_t)
|
|
|
|
manage_lnk_files_pattern($1_t, $1_tmp_t, $1_tmp_t)
|
|
|
|
files_tmp_filetrans($1_t, $1_tmp_t, { file dir })
|
|
|
|
|
|
|
|
manage_dirs_pattern($1_t, $1_tmpfs_t, $1_tmpfs_t)
|
|
|
|
manage_files_pattern($1_t, $1_tmpfs_t, $1_tmpfs_t)
|
|
|
|
manage_lnk_files_pattern($1_t, $1_tmpfs_t, $1_tmpfs_t)
|
|
|
|
fs_tmpfs_filetrans($1_t, $1_tmpfs_t, { dir file lnk_file })
|
|
|
|
|
2010-03-22 14:24:34 +00:00
|
|
|
optional_policy(`
|
|
|
|
xserver_rw_shm($1_t)
|
|
|
|
')
|
2010-02-09 15:28:17 +00:00
|
|
|
')
|
|
|
|
|
2008-12-03 15:21:33 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Make the specified type usable as a virt image
|
|
|
|
## </summary>
|
|
|
|
## <param name="type">
|
|
|
|
## <summary>
|
|
|
|
## Type to be used as a virtual image
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_image',`
|
|
|
|
gen_require(`
|
|
|
|
attribute virt_image_type;
|
|
|
|
')
|
|
|
|
|
|
|
|
typeattribute $1 virt_image_type;
|
|
|
|
files_type($1)
|
|
|
|
|
|
|
|
# virt images can be assigned to blk devices
|
|
|
|
dev_node($1)
|
|
|
|
')
|
|
|
|
|
2008-06-16 18:59:07 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Execute a domain transition to run virt.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Signed-off-by: Dominick Grift <domg472@gmail.com>
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
2010-09-16 06:24:26 +00:00
|
|
|
## <summary>
|
2008-06-16 18:59:07 +00:00
|
|
|
## Domain allowed to transition.
|
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Signed-off-by: Dominick Grift <domg472@gmail.com>
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
2010-09-16 06:24:26 +00:00
|
|
|
## </summary>
|
2008-06-16 18:59:07 +00:00
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_domtrans',`
|
|
|
|
gen_require(`
|
|
|
|
type virtd_t, virtd_exec_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
domtrans_pattern($1, virtd_exec_t, virtd_t)
|
|
|
|
')
|
|
|
|
|
2008-12-03 15:21:33 +00:00
|
|
|
#######################################
|
|
|
|
## <summary>
|
|
|
|
## Connect to virt over an unix domain stream socket.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_stream_connect',`
|
|
|
|
gen_require(`
|
|
|
|
type virtd_t, virt_var_run_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
files_search_pids($1)
|
|
|
|
stream_connect_pattern($1, virt_var_run_t, virt_var_run_t, virtd_t)
|
|
|
|
')
|
|
|
|
|
2009-08-31 12:44:11 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Allow domain to attach to virt TUN devices
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_attach_tun_iface',`
|
|
|
|
gen_require(`
|
|
|
|
type virtd_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
allow $1 virtd_t:tun_socket relabelfrom;
|
|
|
|
allow $1 self:tun_socket relabelto;
|
|
|
|
')
|
|
|
|
|
2008-06-16 18:59:07 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Read virt config files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_read_config',`
|
|
|
|
gen_require(`
|
2010-09-15 20:19:38 +00:00
|
|
|
type virt_etc_t, virt_etc_rw_t;
|
2008-06-16 18:59:07 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
files_search_etc($1)
|
|
|
|
read_files_pattern($1, virt_etc_t, virt_etc_t)
|
|
|
|
read_files_pattern($1, virt_etc_rw_t, virt_etc_rw_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
read_lnk_files_pattern($1, virt_etc_rw_t, virt_etc_rw_t)
|
2008-06-16 18:59:07 +00:00
|
|
|
')
|
|
|
|
|
2008-12-03 15:21:33 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## manage virt config files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_manage_config',`
|
|
|
|
gen_require(`
|
2010-09-15 20:19:38 +00:00
|
|
|
type virt_etc_t, virt_etc_rw_t;
|
2008-12-03 15:21:33 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
files_search_etc($1)
|
|
|
|
manage_files_pattern($1, virt_etc_t, virt_etc_t)
|
|
|
|
manage_files_pattern($1, virt_etc_rw_t, virt_etc_rw_t)
|
2010-08-26 13:41:21 +00:00
|
|
|
manage_lnk_files_pattern($1, virt_etc_rw_t, virt_etc_rw_t)
|
2008-12-03 15:21:33 +00:00
|
|
|
')
|
|
|
|
|
2010-02-09 15:28:17 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Allow domain to manage virt image files
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
2010-08-05 13:03:19 +00:00
|
|
|
## Domain allowed access.
|
2010-02-09 15:28:17 +00:00
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_read_content',`
|
|
|
|
gen_require(`
|
|
|
|
type virt_content_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
virt_search_lib($1)
|
|
|
|
allow $1 virt_content_t:dir list_dir_perms;
|
|
|
|
list_dirs_pattern($1, virt_content_t, virt_content_t)
|
|
|
|
read_files_pattern($1, virt_content_t, virt_content_t)
|
|
|
|
read_lnk_files_pattern($1, virt_content_t, virt_content_t)
|
|
|
|
read_blk_files_pattern($1, virt_content_t, virt_content_t)
|
|
|
|
|
|
|
|
tunable_policy(`virt_use_nfs',`
|
|
|
|
fs_list_nfs($1)
|
|
|
|
fs_read_nfs_files($1)
|
|
|
|
fs_read_nfs_symlinks($1)
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`virt_use_samba',`
|
|
|
|
fs_list_cifs($1)
|
|
|
|
fs_read_cifs_files($1)
|
|
|
|
fs_read_cifs_symlinks($1)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Allow domain to write virt image files
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
2010-09-16 06:25:20 +00:00
|
|
|
## Domain allowed access.
|
2010-08-26 13:41:21 +00:00
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_write_content',`
|
|
|
|
gen_require(`
|
|
|
|
type virt_content_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
allow $1 virt_content_t:file write_file_perms;
|
|
|
|
')
|
|
|
|
|
2008-06-16 18:59:07 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Read virt PID files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_read_pid_files',`
|
|
|
|
gen_require(`
|
|
|
|
type virt_var_run_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
files_search_pids($1)
|
2010-02-09 15:28:17 +00:00
|
|
|
read_files_pattern($1, virt_var_run_t, virt_var_run_t)
|
2008-06-16 18:59:07 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Manage virt pid files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
2008-10-13 13:36:50 +00:00
|
|
|
interface(`virt_manage_pid_files',`
|
2008-06-16 18:59:07 +00:00
|
|
|
gen_require(`
|
|
|
|
type virt_var_run_t;
|
|
|
|
')
|
|
|
|
|
2010-02-09 15:28:17 +00:00
|
|
|
files_search_pids($1)
|
2009-06-26 14:40:13 +00:00
|
|
|
manage_files_pattern($1, virt_var_run_t, virt_var_run_t)
|
2008-06-16 18:59:07 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Search virt lib directories.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_search_lib',`
|
|
|
|
gen_require(`
|
|
|
|
type virt_var_lib_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
allow $1 virt_var_lib_t:dir search_dir_perms;
|
|
|
|
files_search_var_lib($1)
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Read virt lib files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_read_lib_files',`
|
|
|
|
gen_require(`
|
|
|
|
type virt_var_lib_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
files_search_var_lib($1)
|
2008-12-03 18:33:19 +00:00
|
|
|
read_files_pattern($1, virt_var_lib_t, virt_var_lib_t)
|
2010-03-22 14:24:34 +00:00
|
|
|
read_lnk_files_pattern($1, virt_var_lib_t, virt_var_lib_t)
|
2008-06-16 18:59:07 +00:00
|
|
|
')
|
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Dontaudit inherited read virt lib files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_dontaudit_read_lib_files',`
|
|
|
|
gen_require(`
|
|
|
|
type virt_var_lib_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
dontaudit $1 virt_var_lib_t:file read_inherited_file_perms;
|
|
|
|
')
|
|
|
|
|
2008-06-16 18:59:07 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Create, read, write, and delete
|
|
|
|
## virt lib files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_manage_lib_files',`
|
|
|
|
gen_require(`
|
|
|
|
type virt_var_lib_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
files_search_var_lib($1)
|
2008-12-03 18:33:19 +00:00
|
|
|
manage_files_pattern($1, virt_var_lib_t, virt_var_lib_t)
|
2008-06-16 18:59:07 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Allow the specified domain to read virt's log files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
## <rolecap/>
|
|
|
|
#
|
|
|
|
interface(`virt_read_log',`
|
|
|
|
gen_require(`
|
|
|
|
type virt_log_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
logging_search_logs($1)
|
2008-12-03 18:33:19 +00:00
|
|
|
read_files_pattern($1, virt_log_t, virt_log_t)
|
2008-06-16 18:59:07 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Allow the specified domain to append
|
|
|
|
## virt log files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Signed-off-by: Dominick Grift <domg472@gmail.com>
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
2010-09-16 06:24:26 +00:00
|
|
|
## <summary>
|
2010-08-05 13:03:19 +00:00
|
|
|
## Domain allowed access.
|
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Signed-off-by: Dominick Grift <domg472@gmail.com>
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
Whitespace, newline and tab fixes.
2010-09-16 06:24:26 +00:00
|
|
|
## </summary>
|
2008-06-16 18:59:07 +00:00
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_append_log',`
|
|
|
|
gen_require(`
|
2008-10-13 13:36:50 +00:00
|
|
|
type virt_log_t;
|
2008-06-16 18:59:07 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
logging_search_logs($1)
|
2008-12-03 18:33:19 +00:00
|
|
|
append_files_pattern($1, virt_log_t, virt_log_t)
|
2008-06-16 18:59:07 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Allow domain to manage virt log files
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
2010-08-05 13:03:19 +00:00
|
|
|
## Domain allowed access.
|
2008-06-16 18:59:07 +00:00
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_manage_log',`
|
|
|
|
gen_require(`
|
|
|
|
type virt_log_t;
|
|
|
|
')
|
|
|
|
|
2008-12-03 18:33:19 +00:00
|
|
|
manage_dirs_pattern($1, virt_log_t, virt_log_t)
|
|
|
|
manage_files_pattern($1, virt_log_t, virt_log_t)
|
|
|
|
manage_lnk_files_pattern($1, virt_log_t, virt_log_t)
|
2008-06-16 18:59:07 +00:00
|
|
|
')
|
|
|
|
|
2010-02-09 15:28:17 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Allow domain to read virt image files
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
2010-08-05 13:03:19 +00:00
|
|
|
## Domain allowed access.
|
2010-02-09 15:28:17 +00:00
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_read_images',`
|
|
|
|
gen_require(`
|
|
|
|
type virt_var_lib_t;
|
|
|
|
attribute virt_image_type;
|
|
|
|
')
|
|
|
|
|
|
|
|
virt_search_lib($1)
|
|
|
|
allow $1 virt_image_type:dir list_dir_perms;
|
|
|
|
list_dirs_pattern($1, virt_image_type, virt_image_type)
|
|
|
|
read_files_pattern($1, virt_image_type, virt_image_type)
|
|
|
|
read_lnk_files_pattern($1, virt_image_type, virt_image_type)
|
|
|
|
read_blk_files_pattern($1, virt_image_type, virt_image_type)
|
|
|
|
|
|
|
|
tunable_policy(`virt_use_nfs',`
|
|
|
|
fs_list_nfs($1)
|
|
|
|
fs_read_nfs_files($1)
|
|
|
|
fs_read_nfs_symlinks($1)
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`virt_use_samba',`
|
|
|
|
fs_list_cifs($1)
|
|
|
|
fs_read_cifs_files($1)
|
|
|
|
fs_read_cifs_symlinks($1)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
2010-08-26 19:29:37 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Allow domain to read virt blk image files
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_read_blk_images',`
|
|
|
|
gen_require(`
|
|
|
|
attribute virt_image_type;
|
|
|
|
')
|
|
|
|
|
|
|
|
read_blk_files_pattern($1, virt_image_type, virt_image_type)
|
|
|
|
')
|
|
|
|
|
2010-02-09 15:28:17 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Create, read, write, and delete
|
|
|
|
## svirt cache files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
2010-08-26 13:41:21 +00:00
|
|
|
interface(`virt_manage_cache',`
|
2010-02-09 15:28:17 +00:00
|
|
|
gen_require(`
|
2010-08-26 13:41:21 +00:00
|
|
|
type virt_cache_t;
|
2010-02-09 15:28:17 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
files_search_var($1)
|
2010-08-26 13:41:21 +00:00
|
|
|
manage_dirs_pattern($1, virt_cache_t, virt_cache_t)
|
|
|
|
manage_files_pattern($1, virt_cache_t, virt_cache_t)
|
|
|
|
manage_lnk_files_pattern($1, virt_cache_t, virt_cache_t)
|
2010-02-09 15:28:17 +00:00
|
|
|
')
|
|
|
|
|
2008-06-16 18:59:07 +00:00
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Allow domain to manage virt image files
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
2010-08-05 13:03:19 +00:00
|
|
|
## Domain allowed access.
|
2008-06-16 18:59:07 +00:00
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_manage_images',`
|
|
|
|
gen_require(`
|
2010-02-09 15:28:17 +00:00
|
|
|
type virt_var_lib_t;
|
|
|
|
attribute virt_image_type;
|
2008-06-16 18:59:07 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
virt_search_lib($1)
|
2010-02-09 15:28:17 +00:00
|
|
|
allow $1 virt_image_type:dir list_dir_perms;
|
|
|
|
manage_dirs_pattern($1, virt_image_type, virt_image_type)
|
|
|
|
manage_files_pattern($1, virt_image_type, virt_image_type)
|
|
|
|
read_lnk_files_pattern($1, virt_image_type, virt_image_type)
|
|
|
|
rw_blk_files_pattern($1, virt_image_type, virt_image_type)
|
2008-06-16 18:59:07 +00:00
|
|
|
|
|
|
|
tunable_policy(`virt_use_nfs',`
|
|
|
|
fs_manage_nfs_dirs($1)
|
|
|
|
fs_manage_nfs_files($1)
|
|
|
|
fs_read_nfs_symlinks($1)
|
|
|
|
')
|
|
|
|
|
|
|
|
tunable_policy(`virt_use_samba',`
|
2010-02-09 15:28:17 +00:00
|
|
|
fs_manage_cifs_files($1)
|
2008-06-16 18:59:07 +00:00
|
|
|
fs_manage_cifs_files($1)
|
|
|
|
fs_read_cifs_symlinks($1)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
2010-03-22 14:24:34 +00:00
|
|
|
## All of the rules required to administrate
|
2008-06-16 18:59:07 +00:00
|
|
|
## an virt environment
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
2008-12-03 15:51:53 +00:00
|
|
|
## <param name="role">
|
|
|
|
## <summary>
|
|
|
|
## Role allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
2008-06-16 18:59:07 +00:00
|
|
|
## <rolecap/>
|
|
|
|
#
|
|
|
|
interface(`virt_admin',`
|
|
|
|
gen_require(`
|
2008-12-03 15:21:33 +00:00
|
|
|
type virtd_t, virtd_initrc_exec_t;
|
2008-06-16 18:59:07 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
allow $1 virtd_t:process { ptrace signal_perms };
|
|
|
|
ps_process_pattern($1, virtd_t)
|
|
|
|
|
2008-12-03 15:21:33 +00:00
|
|
|
init_labeled_script_domtrans($1, virtd_initrc_exec_t)
|
|
|
|
domain_system_change_exemption($1)
|
|
|
|
role_transition $2 virtd_initrc_exec_t system_r;
|
|
|
|
allow $2 system_r;
|
|
|
|
|
2008-06-16 18:59:07 +00:00
|
|
|
virt_manage_pid_files($1)
|
|
|
|
|
|
|
|
virt_manage_lib_files($1)
|
|
|
|
|
|
|
|
virt_manage_log($1)
|
|
|
|
')
|
2010-08-26 13:41:21 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Execute qemu in the svirt domain, and
|
|
|
|
## allow the specified role the svirt domain.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
## <param name="role">
|
|
|
|
## <summary>
|
|
|
|
## The role to be allowed the sandbox domain.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
2010-09-15 19:59:34 +00:00
|
|
|
## <rolecap/>
|
2010-08-26 13:41:21 +00:00
|
|
|
#
|
|
|
|
interface(`virt_transition_svirt',`
|
|
|
|
gen_require(`
|
|
|
|
type svirt_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
allow $1 svirt_t:process transition;
|
|
|
|
role $2 types svirt_t;
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
ptchown_run(svirt_t, $2)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Do not audit attempts to write virt daemon unnamed pipes.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`virt_dontaudit_write_pipes',`
|
|
|
|
gen_require(`
|
|
|
|
type virtd_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
dontaudit $1 virtd_t:fifo_file write_fifo_file_perms;
|
|
|
|
')
|