2006-02-16 21:33:18 +00:00
|
|
|
## <summary>Policy for UML</summary>
|
|
|
|
|
|
|
|
#######################################
|
|
|
|
## <summary>
|
2006-09-06 22:07:25 +00:00
|
|
|
## The per role template for the uml module.
|
2006-02-16 21:33:18 +00:00
|
|
|
## </summary>
|
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## This template creates a derived domains which are used
|
|
|
|
## for uml program.
|
|
|
|
## </p>
|
|
|
|
## <p>
|
|
|
|
## This template is invoked automatically for each user, and
|
|
|
|
## generally does not need to be invoked directly
|
|
|
|
## by policy writers.
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
|
|
|
## <param name="userdomain_prefix">
|
|
|
|
## <summary>
|
|
|
|
## The prefix of the user domain (e.g., user
|
|
|
|
## is the prefix for user_t).
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
## <param name="user_domain">
|
|
|
|
## <summary>
|
|
|
|
## The type of the user domain.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
## <param name="user_role">
|
|
|
|
## <summary>
|
|
|
|
## The role associated with the user domain.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
2006-09-06 22:07:25 +00:00
|
|
|
template(`uml_per_role_template',`
|
2007-02-16 23:01:42 +00:00
|
|
|
gen_require(`
|
|
|
|
type uml_ro_t, uml_exec_t;
|
|
|
|
')
|
|
|
|
|
2006-02-16 21:33:18 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
2007-06-13 13:54:56 +00:00
|
|
|
|
2006-02-16 21:33:18 +00:00
|
|
|
type $1_uml_t;
|
|
|
|
type $1_uml_exec_t;
|
2008-07-23 21:38:39 +00:00
|
|
|
application_domain($1_uml_t, $1_uml_exec_t)
|
2007-07-19 18:57:48 +00:00
|
|
|
role $3 types $1_uml_t;
|
2006-02-16 21:33:18 +00:00
|
|
|
|
|
|
|
type $1_uml_ro_t;
|
|
|
|
files_type($1_uml_ro_t)
|
|
|
|
|
|
|
|
type $1_uml_rw_t;
|
|
|
|
files_type($1_uml_rw_t)
|
|
|
|
|
|
|
|
type $1_uml_tmp_t;
|
|
|
|
files_tmp_file($1_uml_tmp_t)
|
|
|
|
|
|
|
|
type $1_uml_tmpfs_t;
|
|
|
|
files_tmpfs_file($1_uml_tmpfs_t)
|
|
|
|
|
|
|
|
type $1_uml_devpts_t;
|
|
|
|
term_pty($1_uml_devpts_t)
|
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Local policy
|
|
|
|
#
|
2006-12-12 20:08:08 +00:00
|
|
|
|
|
|
|
allow $1_uml_t self:fifo_file rw_fifo_file_perms;
|
2006-05-29 18:25:58 +00:00
|
|
|
allow $1_uml_t self:process { signal_perms ptrace };
|
2006-02-16 21:33:18 +00:00
|
|
|
allow $1_uml_t self:unix_stream_socket create_stream_socket_perms;
|
|
|
|
allow $1_uml_t self:unix_dgram_socket create_socket_perms;
|
|
|
|
# Use the network.
|
|
|
|
allow $1_uml_t self:tcp_socket create_stream_socket_perms;
|
|
|
|
allow $1_uml_t self:udp_socket create_socket_perms;
|
|
|
|
|
|
|
|
allow $1_uml_t $2:process sigchld;
|
|
|
|
allow $1_uml_t $2:fifo_file { ioctl read write getattr lock append };
|
|
|
|
|
|
|
|
# allow the UML thing to happen
|
|
|
|
allow $1_uml_t $1_uml_devpts_t:chr_file { rw_file_perms setattr };
|
|
|
|
term_create_pty($1_uml_t,$1_uml_devpts_t)
|
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern($1_uml_t, $1_uml_tmp_t, $1_uml_tmp_t)
|
|
|
|
manage_files_pattern($1_uml_t, $1_uml_tmp_t, $1_uml_tmp_t)
|
2006-02-21 18:40:44 +00:00
|
|
|
files_tmp_filetrans($1_uml_t, $1_uml_tmp_t, { file dir })
|
2006-02-16 21:33:18 +00:00
|
|
|
can_exec($1_uml_t, $1_uml_tmp_t)
|
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_files_pattern($1_uml_t, $1_uml_tmpfs_t, $1_uml_tmpfs_t)
|
|
|
|
manage_lnk_files_pattern($1_uml_t, $1_uml_tmpfs_t, $1_uml_tmpfs_t)
|
|
|
|
manage_fifo_files_pattern($1_uml_t, $1_uml_tmpfs_t, $1_uml_tmpfs_t)
|
|
|
|
manage_sock_files_pattern($1_uml_t, $1_uml_tmpfs_t, $1_uml_tmpfs_t)
|
|
|
|
fs_tmpfs_filetrans($1_uml_t, $1_uml_tmpfs_t, { file lnk_file sock_file fifo_file })
|
2006-02-16 21:33:18 +00:00
|
|
|
can_exec($1_uml_t, $1_uml_tmpfs_t)
|
|
|
|
|
|
|
|
# access config files
|
2006-12-12 20:08:08 +00:00
|
|
|
allow $1_uml_t { $1_uml_ro_t uml_ro_t }:dir list_dir_perms;
|
2008-07-23 21:38:39 +00:00
|
|
|
read_files_pattern($1_uml_t, { $1_uml_ro_t uml_ro_t }, { $1_uml_ro_t uml_ro_t })
|
|
|
|
read_lnk_files_pattern($1_uml_t, { $1_uml_ro_t uml_ro_t }, { $1_uml_ro_t uml_ro_t })
|
2006-12-12 20:08:08 +00:00
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern($1_uml_t, $1_uml_rw_t, $1_uml_rw_t)
|
|
|
|
manage_files_pattern($1_uml_t, $1_uml_rw_t, $1_uml_rw_t)
|
|
|
|
manage_lnk_files_pattern($1_uml_t, $1_uml_rw_t, $1_uml_rw_t)
|
|
|
|
manage_fifo_files_pattern($1_uml_t, $1_uml_rw_t, $1_uml_rw_t)
|
|
|
|
manage_sock_files_pattern($1_uml_t, $1_uml_rw_t, $1_uml_rw_t)
|
|
|
|
userdom_user_home_dir_filetrans($1, $1_uml_t, $1_uml_rw_t, { file lnk_file sock_file fifo_file })
|
2006-02-16 21:33:18 +00:00
|
|
|
|
2006-12-12 20:08:08 +00:00
|
|
|
allow $2 uml_ro_t:dir list_dir_perms;
|
2008-07-23 21:38:39 +00:00
|
|
|
read_files_pattern($2,uml_ro_t, uml_ro_t)
|
|
|
|
read_lnk_files_pattern($2,uml_ro_t, uml_ro_t)
|
|
|
|
|
|
|
|
manage_dirs_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
|
|
|
|
manage_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
|
|
|
|
manage_lnk_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
|
|
|
|
manage_fifo_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
|
|
|
|
manage_sock_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
|
|
|
|
relabel_dirs_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
|
|
|
|
relabel_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
|
|
|
|
relabel_lnk_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
|
|
|
|
relabel_fifo_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
|
|
|
|
relabel_sock_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t }, { $1_uml_ro_t $1_uml_rw_t })
|
|
|
|
|
|
|
|
manage_dirs_pattern($2, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t }, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t })
|
|
|
|
manage_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t }, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t })
|
|
|
|
relabel_dirs_pattern($2, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t }, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t })
|
|
|
|
relabel_files_pattern($2, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t }, { $1_uml_ro_t $1_uml_rw_t $1_uml_exec_t })
|
2006-02-16 21:33:18 +00:00
|
|
|
|
|
|
|
# allow ps, ptrace, signal
|
2006-12-12 20:08:08 +00:00
|
|
|
ps_process_pattern($2,$1_uml_t)
|
|
|
|
allow $2 $1_uml_t:process { ptrace signal_perms };
|
2006-02-16 21:33:18 +00:00
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern($2, $1_uml_tmp_t, $1_uml_tmp_t)
|
|
|
|
manage_files_pattern($2, $1_uml_tmp_t, $1_uml_tmp_t)
|
|
|
|
manage_lnk_files_pattern($2, $1_uml_tmp_t, $1_uml_tmp_t)
|
|
|
|
manage_sock_files_pattern($2, $1_uml_tmp_t, $1_uml_tmp_t)
|
2006-02-16 21:33:18 +00:00
|
|
|
|
|
|
|
# Transition from the user domain to this domain.
|
|
|
|
domain_auto_trans($2, { uml_exec_t $1_uml_exec_t }, $1_uml_t)
|
|
|
|
can_exec($1_uml_t, { uml_exec_t $1_uml_exec_t })
|
|
|
|
|
|
|
|
# for mconsole
|
|
|
|
allow { $2 $1_uml_t } $1_uml_t:unix_dgram_socket sendto;
|
|
|
|
allow $1_uml_t $2:unix_dgram_socket sendto;
|
|
|
|
|
|
|
|
kernel_read_system_state($1_uml_t)
|
|
|
|
# for SKAS - need something better
|
|
|
|
kernel_write_proc_files($1_uml_t)
|
|
|
|
|
|
|
|
# for xterm
|
|
|
|
corecmd_exec_bin($1_uml_t)
|
|
|
|
|
2007-06-27 15:23:21 +00:00
|
|
|
corenet_all_recvfrom_unlabeled($1_uml_t)
|
|
|
|
corenet_all_recvfrom_netlabel($1_uml_t)
|
2006-02-16 21:33:18 +00:00
|
|
|
corenet_tcp_sendrecv_generic_if($1_uml_t)
|
|
|
|
corenet_udp_sendrecv_generic_if($1_uml_t)
|
|
|
|
corenet_tcp_sendrecv_all_nodes($1_uml_t)
|
|
|
|
corenet_udp_sendrecv_all_nodes($1_uml_t)
|
|
|
|
corenet_tcp_sendrecv_all_ports($1_uml_t)
|
|
|
|
corenet_udp_sendrecv_all_ports($1_uml_t)
|
|
|
|
corenet_tcp_connect_all_ports($1_uml_t)
|
2006-05-29 18:25:58 +00:00
|
|
|
corenet_sendrecv_all_client_packets($1_uml_t)
|
2006-02-16 21:33:18 +00:00
|
|
|
corenet_rw_tun_tap_dev($1_uml_t)
|
|
|
|
|
2006-02-20 21:33:25 +00:00
|
|
|
domain_use_interactive_fds($1_uml_t)
|
2006-02-16 21:33:18 +00:00
|
|
|
|
|
|
|
# for xterm
|
|
|
|
files_read_etc_files($1_uml_t)
|
|
|
|
files_dontaudit_read_etc_runtime_files($1_uml_t)
|
|
|
|
# putting uml data under /var is usual...
|
|
|
|
files_search_var($1_uml_t)
|
|
|
|
|
|
|
|
fs_getattr_xattr_fs($1_uml_t)
|
|
|
|
|
|
|
|
init_read_utmp($1_uml_t)
|
|
|
|
init_dontaudit_write_utmp($1_uml_t)
|
|
|
|
|
|
|
|
# for xterm
|
|
|
|
libs_use_ld_so($1_uml_t)
|
|
|
|
libs_use_shared_libs($1_uml_t)
|
|
|
|
libs_exec_lib_files($1_uml_t)
|
|
|
|
|
|
|
|
# Inherit and use descriptors from newrole.
|
2006-02-20 21:33:25 +00:00
|
|
|
seutil_use_newrole_fds($1_uml_t)
|
2006-02-16 21:33:18 +00:00
|
|
|
|
|
|
|
# Use the network.
|
|
|
|
sysnet_read_config($1_uml_t)
|
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
userdom_use_user_terminals($1, $1_uml_t)
|
2006-02-16 21:33:18 +00:00
|
|
|
|
2006-03-24 16:13:54 +00:00
|
|
|
optional_policy(`
|
2006-02-16 21:33:18 +00:00
|
|
|
nis_use_ypbind($1_uml_t)
|
|
|
|
')
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Set attributes on uml utility socket files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`uml_setattr_util_sockets',`
|
|
|
|
gen_require(`
|
|
|
|
type uml_switch_var_run_t;
|
|
|
|
')
|
|
|
|
|
|
|
|
allow $1 uml_switch_var_run_t:sock_file setattr;
|
|
|
|
')
|
|
|
|
|
|
|
|
########################################
|
|
|
|
## <summary>
|
|
|
|
## Manage uml utility files.
|
|
|
|
## </summary>
|
|
|
|
## <param name="domain">
|
|
|
|
## <summary>
|
|
|
|
## Domain allowed access.
|
|
|
|
## </summary>
|
|
|
|
## </param>
|
|
|
|
#
|
|
|
|
interface(`uml_manage_util_files',`
|
|
|
|
gen_require(`
|
|
|
|
type uml_switch_var_run_t;
|
|
|
|
')
|
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_files_pattern($1, uml_switch_var_run_t, uml_switch_var_run_t)
|
|
|
|
manage_lnk_files_pattern($1, uml_switch_var_run_t, uml_switch_var_run_t)
|
2006-02-16 21:33:18 +00:00
|
|
|
')
|