|
Chris PeBenito |
5b6ddb |
## <summary>Policy for UML</summary>
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
#######################################
|
|
Chris PeBenito |
5b6ddb |
## <summary>
|
|
Chris PeBenito |
bbcd3c |
## The per role template for the uml module.
|
|
Chris PeBenito |
5b6ddb |
## </summary>
|
|
Chris PeBenito |
5b6ddb |
## <desc>
|
|
Chris PeBenito |
5b6ddb |
##
|
|
Chris PeBenito |
5b6ddb |
## This template creates a derived domains which are used
|
|
Chris PeBenito |
5b6ddb |
## for uml program.
|
|
Chris PeBenito |
5b6ddb |
##
|
|
Chris PeBenito |
5b6ddb |
##
|
|
Chris PeBenito |
5b6ddb |
## This template is invoked automatically for each user, and
|
|
Chris PeBenito |
5b6ddb |
## generally does not need to be invoked directly
|
|
Chris PeBenito |
5b6ddb |
## by policy writers.
|
|
Chris PeBenito |
5b6ddb |
##
|
|
Chris PeBenito |
5b6ddb |
## </desc>
|
|
Chris PeBenito |
5b6ddb |
## <param name="userdomain_prefix">
|
|
Chris PeBenito |
5b6ddb |
## <summary>
|
|
Chris PeBenito |
5b6ddb |
## The prefix of the user domain (e.g., user
|
|
Chris PeBenito |
5b6ddb |
## is the prefix for user_t).
|
|
Chris PeBenito |
5b6ddb |
## </summary>
|
|
Chris PeBenito |
5b6ddb |
## </param>
|
|
Chris PeBenito |
5b6ddb |
## <param name="user_domain">
|
|
Chris PeBenito |
5b6ddb |
## <summary>
|
|
Chris PeBenito |
5b6ddb |
## The type of the user domain.
|
|
Chris PeBenito |
5b6ddb |
## </summary>
|
|
Chris PeBenito |
5b6ddb |
## </param>
|
|
Chris PeBenito |
5b6ddb |
## <param name="user_role">
|
|
Chris PeBenito |
5b6ddb |
## <summary>
|
|
Chris PeBenito |
5b6ddb |
## The role associated with the user domain.
|
|
Chris PeBenito |
5b6ddb |
## </summary>
|
|
Chris PeBenito |
5b6ddb |
## </param>
|
|
Chris PeBenito |
5b6ddb |
#
|
|
Chris PeBenito |
bbcd3c |
template(`uml_per_role_template',`
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
6b19be |
gen_require(`
|
|
Chris PeBenito |
6b19be |
type uml_ro_t, uml_exec_t;
|
|
Chris PeBenito |
6b19be |
')
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
5b6ddb |
########################################
|
|
Chris PeBenito |
5b6ddb |
#
|
|
Chris PeBenito |
5b6ddb |
# Declarations
|
|
Chris PeBenito |
5b6ddb |
#
|
|
Chris PeBenito |
5b6ddb |
type $1_uml_t;
|
|
Chris PeBenito |
5b6ddb |
domain_type($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
role $3 types $1_uml_t;
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
type $1_uml_exec_t;
|
|
Chris PeBenito |
5b6ddb |
domain_entry_file($1_uml_t,$1_uml_exec_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
type $1_uml_ro_t;
|
|
Chris PeBenito |
5b6ddb |
files_type($1_uml_ro_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
type $1_uml_rw_t;
|
|
Chris PeBenito |
5b6ddb |
files_type($1_uml_rw_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
type $1_uml_tmp_t;
|
|
Chris PeBenito |
5b6ddb |
files_tmp_file($1_uml_tmp_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
type $1_uml_tmpfs_t;
|
|
Chris PeBenito |
5b6ddb |
files_tmpfs_file($1_uml_tmpfs_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
type $1_uml_devpts_t;
|
|
Chris PeBenito |
5b6ddb |
term_pty($1_uml_devpts_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
########################################
|
|
Chris PeBenito |
5b6ddb |
#
|
|
Chris PeBenito |
5b6ddb |
# Local policy
|
|
Chris PeBenito |
5b6ddb |
#
|
|
Chris PeBenito |
c0868a |
|
|
Chris PeBenito |
c0868a |
allow $1_uml_t self:fifo_file rw_fifo_file_perms;
|
|
Chris PeBenito |
c0d8c4 |
allow $1_uml_t self:process { signal_perms ptrace };
|
|
Chris PeBenito |
5b6ddb |
allow $1_uml_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
5b6ddb |
allow $1_uml_t self:unix_dgram_socket create_socket_perms;
|
|
Chris PeBenito |
5b6ddb |
# Use the network.
|
|
Chris PeBenito |
5b6ddb |
allow $1_uml_t self:tcp_socket create_stream_socket_perms;
|
|
Chris PeBenito |
5b6ddb |
allow $1_uml_t self:udp_socket create_socket_perms;
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
allow $1_uml_t $2:process sigchld;
|
|
Chris PeBenito |
5b6ddb |
allow $1_uml_t $2:fifo_file { ioctl read write getattr lock append };
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
# allow the UML thing to happen
|
|
Chris PeBenito |
5b6ddb |
allow $1_uml_t $1_uml_devpts_t:chr_file { rw_file_perms setattr };
|
|
Chris PeBenito |
5b6ddb |
term_create_pty($1_uml_t,$1_uml_devpts_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
c0868a |
manage_dirs_pattern($1_uml_t,$1_uml_tmp_t,$1_uml_tmp_t)
|
|
Chris PeBenito |
c0868a |
manage_files_pattern($1_uml_t,$1_uml_tmp_t,$1_uml_tmp_t)
|
|
Chris PeBenito |
103fe2 |
files_tmp_filetrans($1_uml_t, $1_uml_tmp_t, { file dir })
|
|
Chris PeBenito |
5b6ddb |
can_exec($1_uml_t, $1_uml_tmp_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
c0868a |
manage_files_pattern($1_uml_t,$1_uml_tmpfs_t,$1_uml_tmpfs_t)
|
|
Chris PeBenito |
c0868a |
manage_lnk_files_pattern($1_uml_t,$1_uml_tmpfs_t,$1_uml_tmpfs_t)
|
|
Chris PeBenito |
c0868a |
manage_fifo_files_pattern($1_uml_t,$1_uml_tmpfs_t,$1_uml_tmpfs_t)
|
|
Chris PeBenito |
c0868a |
manage_sock_files_pattern($1_uml_t,$1_uml_tmpfs_t,$1_uml_tmpfs_t)
|
|
Chris PeBenito |
c0868a |
fs_tmpfs_filetrans($1_uml_t,$1_uml_tmpfs_t,{ file lnk_file sock_file fifo_file })
|
|
Chris PeBenito |
5b6ddb |
can_exec($1_uml_t, $1_uml_tmpfs_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
# access config files
|
|
Chris PeBenito |
c0868a |
allow $1_uml_t { $1_uml_ro_t uml_ro_t }:dir list_dir_perms;
|
|
Chris PeBenito |
c0868a |
read_files_pattern($1_uml_t,{ $1_uml_ro_t uml_ro_t },{ $1_uml_ro_t uml_ro_t })
|
|
Chris PeBenito |
c0868a |
read_lnk_files_pattern($1_uml_t,{ $1_uml_ro_t uml_ro_t },{ $1_uml_ro_t uml_ro_t })
|
|
Chris PeBenito |
c0868a |
|
|
Chris PeBenito |
c0868a |
manage_dirs_pattern($1_uml_t,$1_uml_rw_t,$1_uml_rw_t)
|
|
Chris PeBenito |
c0868a |
manage_files_pattern($1_uml_t,$1_uml_rw_t,$1_uml_rw_t)
|
|
Chris PeBenito |
c0868a |
manage_lnk_files_pattern($1_uml_t,$1_uml_rw_t,$1_uml_rw_t)
|
|
Chris PeBenito |
c0868a |
manage_fifo_files_pattern($1_uml_t,$1_uml_rw_t,$1_uml_rw_t)
|
|
Chris PeBenito |
c0868a |
manage_sock_files_pattern($1_uml_t,$1_uml_rw_t,$1_uml_rw_t)
|
|
Chris PeBenito |
103fe2 |
userdom_user_home_dir_filetrans($1,$1_uml_t,$1_uml_rw_t,{ file lnk_file sock_file fifo_file })
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
c0868a |
allow $2 uml_ro_t:dir list_dir_perms;
|
|
Chris PeBenito |
c0868a |
read_files_pattern($2,uml_ro_t,uml_ro_t)
|
|
Chris PeBenito |
c0868a |
read_lnk_files_pattern($2,uml_ro_t,uml_ro_t)
|
|
Chris PeBenito |
c0868a |
|
|
Chris PeBenito |
c0868a |
manage_dirs_pattern($2,{ $1_uml_ro_t $1_uml_rw_t },{ $1_uml_ro_t $1_uml_rw_t })
|
|
Chris PeBenito |
c0868a |
manage_files_pattern($2,{ $1_uml_ro_t $1_uml_rw_t },{ $1_uml_ro_t $1_uml_rw_t })
|
|
Chris PeBenito |
c0868a |
manage_lnk_files_pattern($2,{ $1_uml_ro_t $1_uml_rw_t },{ $1_uml_ro_t $1_uml_rw_t })
|
|
Chris PeBenito |
c0868a |
manage_fifo_files_pattern($2,{ $1_uml_ro_t $1_uml_rw_t },{ $1_uml_ro_t $1_uml_rw_t })
|
|
Chris PeBenito |
c0868a |
manage_sock_files_pattern($2,{ $1_uml_ro_t $1_uml_rw_t },{ $1_uml_ro_t $1_uml_rw_t })
|
|
Chris PeBenito |
c0868a |
relabel_dirs_pattern($2,{ $1_uml_ro_t $1_uml_rw_t },{ $1_uml_ro_t $1_uml_rw_t })
|
|
Chris PeBenito |
c0868a |
relabel_files_pattern($2,{ $1_uml_ro_t $1_uml_rw_t },{ $1_uml_ro_t $1_uml_rw_t })
|
|
Chris PeBenito |
c0868a |
relabel_lnk_files_pattern($2,{ $1_uml_ro_t $1_uml_rw_t },{ $1_uml_ro_t $1_uml_rw_t })
|
|
Chris PeBenito |
c0868a |
relabel_fifo_files_pattern($2,{ $1_uml_ro_t $1_uml_rw_t },{ $1_uml_ro_t $1_uml_rw_t })
|
|
Chris PeBenito |
c0868a |
relabel_sock_files_pattern($2,{ $1_uml_ro_t $1_uml_rw_t },{ $1_uml_ro_t $1_uml_rw_t })
|
|
Chris PeBenito |
c0868a |
|
|
Chris PeBenito |
c0868a |
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 })
|
|
Chris PeBenito |
c0868a |
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 })
|
|
Chris PeBenito |
c0868a |
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 })
|
|
Chris PeBenito |
c0868a |
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 })
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
# allow ps, ptrace, signal
|
|
Chris PeBenito |
c0868a |
ps_process_pattern($2,$1_uml_t)
|
|
Chris PeBenito |
c0868a |
allow $2 $1_uml_t:process { ptrace signal_perms };
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
c0868a |
manage_dirs_pattern($2,$1_uml_tmp_t,$1_uml_tmp_t)
|
|
Chris PeBenito |
c0868a |
manage_files_pattern($2,$1_uml_tmp_t,$1_uml_tmp_t)
|
|
Chris PeBenito |
c0868a |
manage_lnk_files_pattern($2,$1_uml_tmp_t,$1_uml_tmp_t)
|
|
Chris PeBenito |
c0868a |
manage_sock_files_pattern($2,$1_uml_tmp_t,$1_uml_tmp_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
# Transition from the user domain to this domain.
|
|
Chris PeBenito |
5b6ddb |
domain_auto_trans($2, { uml_exec_t $1_uml_exec_t }, $1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
can_exec($1_uml_t, { uml_exec_t $1_uml_exec_t })
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
# for mconsole
|
|
Chris PeBenito |
5b6ddb |
allow { $2 $1_uml_t } $1_uml_t:unix_dgram_socket sendto;
|
|
Chris PeBenito |
5b6ddb |
allow $1_uml_t $2:unix_dgram_socket sendto;
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
kernel_read_system_state($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
# for SKAS - need something better
|
|
Chris PeBenito |
5b6ddb |
kernel_write_proc_files($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
# for xterm
|
|
Chris PeBenito |
5b6ddb |
corecmd_exec_bin($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
corecmd_exec_sbin($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
c0d8c4 |
corenet_non_ipsec_sendrecv($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
corenet_tcp_sendrecv_generic_if($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
corenet_udp_sendrecv_generic_if($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
corenet_tcp_sendrecv_all_nodes($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
corenet_udp_sendrecv_all_nodes($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
corenet_tcp_sendrecv_all_ports($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
corenet_udp_sendrecv_all_ports($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
corenet_tcp_connect_all_ports($1_uml_t)
|
|
Chris PeBenito |
c0d8c4 |
corenet_sendrecv_all_client_packets($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
corenet_rw_tun_tap_dev($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
15722e |
domain_use_interactive_fds($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
# for xterm
|
|
Chris PeBenito |
5b6ddb |
files_read_etc_files($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
files_dontaudit_read_etc_runtime_files($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
# putting uml data under /var is usual...
|
|
Chris PeBenito |
5b6ddb |
files_search_var($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
fs_getattr_xattr_fs($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
init_read_utmp($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
init_dontaudit_write_utmp($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
# for xterm
|
|
Chris PeBenito |
5b6ddb |
libs_use_ld_so($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
libs_use_shared_libs($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
libs_exec_lib_files($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
# Inherit and use descriptors from newrole.
|
|
Chris PeBenito |
15722e |
seutil_use_newrole_fds($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
# Use the network.
|
|
Chris PeBenito |
5b6ddb |
sysnet_read_config($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
userdom_use_user_terminals($1,$1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
bb7170 |
optional_policy(`
|
|
Chris PeBenito |
5b6ddb |
nis_use_ypbind($1_uml_t)
|
|
Chris PeBenito |
5b6ddb |
')
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
ifdef(`TODO',`
|
|
Chris PeBenito |
5b6ddb |
# for X
|
|
Chris PeBenito |
bb7170 |
optional_policy(`
|
|
Chris PeBenito |
5b6ddb |
ifelse($1, sysadm,`
|
|
Chris PeBenito |
5b6ddb |
',`
|
|
Chris PeBenito |
bb7170 |
optional_policy(`
|
|
Chris PeBenito |
5b6ddb |
allow $1_uml_t xdm_xserver_tmp_t:dir search;
|
|
Chris PeBenito |
5b6ddb |
')
|
|
Chris PeBenito |
5b6ddb |
allow $1_uml_t $1_xserver_tmp_t:sock_file write;
|
|
Chris PeBenito |
5b6ddb |
allow $1_uml_t $1_xserver_t:unix_stream_socket connectto;
|
|
Chris PeBenito |
5b6ddb |
')
|
|
Chris PeBenito |
5b6ddb |
')
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
bb7170 |
optional_policy(`
|
|
Chris PeBenito |
5b6ddb |
# for uml_net
|
|
Chris PeBenito |
5b6ddb |
domain_auto_trans($1_uml_t, uml_net_exec_t, uml_net_t)
|
|
Chris PeBenito |
5b6ddb |
allow uml_net_t $1_uml_t:unix_stream_socket { read write };
|
|
Chris PeBenito |
5b6ddb |
allow uml_net_t $1_uml_t:unix_dgram_socket { read write };
|
|
Chris PeBenito |
5b6ddb |
dontaudit uml_net_t privfd:fd use;
|
|
Chris PeBenito |
5b6ddb |
can_access_pty(uml_net_t, $1_uml)
|
|
Chris PeBenito |
5b6ddb |
dontaudit uml_net_t $1_uml_rw_t:dir { getattr search };
|
|
Chris PeBenito |
5b6ddb |
')
|
|
Chris PeBenito |
5b6ddb |
#TODO
|
|
Chris PeBenito |
bb7170 |
optional_policy(`
|
|
Chris PeBenito |
5b6ddb |
allow $1_uml_t $1_xauth_home_t:file { getattr read };
|
|
Chris PeBenito |
5b6ddb |
')
|
|
Chris PeBenito |
5b6ddb |
')
|
|
Chris PeBenito |
5b6ddb |
')
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
########################################
|
|
Chris PeBenito |
5b6ddb |
## <summary>
|
|
Chris PeBenito |
5b6ddb |
## Set attributes on uml utility socket files.
|
|
Chris PeBenito |
5b6ddb |
## </summary>
|
|
Chris PeBenito |
5b6ddb |
## <param name="domain">
|
|
Chris PeBenito |
5b6ddb |
## <summary>
|
|
Chris PeBenito |
5b6ddb |
## Domain allowed access.
|
|
Chris PeBenito |
5b6ddb |
## </summary>
|
|
Chris PeBenito |
5b6ddb |
## </param>
|
|
Chris PeBenito |
5b6ddb |
#
|
|
Chris PeBenito |
5b6ddb |
interface(`uml_setattr_util_sockets',`
|
|
Chris PeBenito |
5b6ddb |
gen_require(`
|
|
Chris PeBenito |
5b6ddb |
type uml_switch_var_run_t;
|
|
Chris PeBenito |
5b6ddb |
')
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
allow $1 uml_switch_var_run_t:sock_file setattr;
|
|
Chris PeBenito |
5b6ddb |
')
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
5b6ddb |
########################################
|
|
Chris PeBenito |
5b6ddb |
## <summary>
|
|
Chris PeBenito |
5b6ddb |
## Manage uml utility files.
|
|
Chris PeBenito |
5b6ddb |
## </summary>
|
|
Chris PeBenito |
5b6ddb |
## <param name="domain">
|
|
Chris PeBenito |
5b6ddb |
## <summary>
|
|
Chris PeBenito |
5b6ddb |
## Domain allowed access.
|
|
Chris PeBenito |
5b6ddb |
## </summary>
|
|
Chris PeBenito |
5b6ddb |
## </param>
|
|
Chris PeBenito |
5b6ddb |
#
|
|
Chris PeBenito |
5b6ddb |
interface(`uml_manage_util_files',`
|
|
Chris PeBenito |
5b6ddb |
gen_require(`
|
|
Chris PeBenito |
5b6ddb |
type uml_switch_var_run_t;
|
|
Chris PeBenito |
5b6ddb |
')
|
|
Chris PeBenito |
5b6ddb |
|
|
Chris PeBenito |
c0868a |
manage_files_pattern($1,uml_switch_var_run_t,uml_switch_var_run_t)
|
|
Chris PeBenito |
c0868a |
manage_lnk_files_pattern($1,uml_switch_var_run_t,uml_switch_var_run_t)
|
|
Chris PeBenito |
5b6ddb |
')
|