|
Chris PeBenito |
8cffa7 |
## <summary>IRC client policy</summary>
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
#######################################
|
|
Chris PeBenito |
8cffa7 |
## <summary>
|
|
Chris PeBenito |
8cffa7 |
## The per user domain template for the irc module.
|
|
Chris PeBenito |
8cffa7 |
## </summary>
|
|
Chris PeBenito |
8cffa7 |
## <desc>
|
|
Chris PeBenito |
8cffa7 |
##
|
|
Chris PeBenito |
8cffa7 |
## This template creates a derived domains which are used
|
|
Chris PeBenito |
8cffa7 |
## for an irc client sessions.
|
|
Chris PeBenito |
8cffa7 |
##
|
|
Chris PeBenito |
8cffa7 |
##
|
|
Chris PeBenito |
8cffa7 |
## This template is invoked automatically for each user, and
|
|
Chris PeBenito |
8cffa7 |
## generally does not need to be invoked directly
|
|
Chris PeBenito |
8cffa7 |
## by policy writers.
|
|
Chris PeBenito |
8cffa7 |
##
|
|
Chris PeBenito |
8cffa7 |
## </desc>
|
|
Chris PeBenito |
8cffa7 |
## <param name="userdomain_prefix">
|
|
Chris PeBenito |
885b83 |
## <summary>
|
|
Chris PeBenito |
8cffa7 |
## The prefix of the user domain (e.g., user
|
|
Chris PeBenito |
8cffa7 |
## is the prefix for user_t).
|
|
Chris PeBenito |
885b83 |
## </summary>
|
|
Chris PeBenito |
8cffa7 |
## </param>
|
|
Chris PeBenito |
8cffa7 |
## <param name="user_domain">
|
|
Chris PeBenito |
885b83 |
## <summary>
|
|
Chris PeBenito |
8cffa7 |
## The type of the user domain.
|
|
Chris PeBenito |
885b83 |
## </summary>
|
|
Chris PeBenito |
8cffa7 |
## </param>
|
|
Chris PeBenito |
8cffa7 |
## <param name="user_role">
|
|
Chris PeBenito |
885b83 |
## <summary>
|
|
Chris PeBenito |
8cffa7 |
## The role associated with the user domain.
|
|
Chris PeBenito |
885b83 |
## </summary>
|
|
Chris PeBenito |
8cffa7 |
## </param>
|
|
Chris PeBenito |
8cffa7 |
#
|
|
Chris PeBenito |
8cffa7 |
template(`irc_per_userdomain_template',`
|
|
Chris PeBenito |
8cffa7 |
gen_require(`
|
|
Chris PeBenito |
8cffa7 |
type irc_exec_t;
|
|
Chris PeBenito |
8cffa7 |
')
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
########################################
|
|
Chris PeBenito |
8cffa7 |
#
|
|
Chris PeBenito |
8cffa7 |
# Declarations
|
|
Chris PeBenito |
8cffa7 |
#
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
type $1_irc_t;
|
|
Chris PeBenito |
8cffa7 |
domain_type($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
domain_entry_file($1_irc_t,irc_exec_t)
|
|
Chris PeBenito |
8cffa7 |
role $3 types $1_irc_t;
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
type $1_irc_exec_t;
|
|
Chris PeBenito |
103fe2 |
userdom_user_home_content($1,$1_irc_exec_t)
|
|
Chris PeBenito |
8cffa7 |
domain_entry_file($1_irc_t,$1_irc_exec_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
type $1_irc_home_t;
|
|
Chris PeBenito |
103fe2 |
userdom_user_home_content($1,$1_irc_home_t)
|
|
Chris PeBenito |
4ace0f |
|
|
Chris PeBenito |
4ace0f |
type $1_irc_tmp_t;
|
|
Chris PeBenito |
103fe2 |
userdom_user_home_content($1,$1_irc_tmp_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
########################################
|
|
Chris PeBenito |
8cffa7 |
#
|
|
Chris PeBenito |
8cffa7 |
# Local policy
|
|
Chris PeBenito |
8cffa7 |
#
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
allow $1_irc_t self:dir search;
|
|
Chris PeBenito |
8cffa7 |
allow $1_irc_t self:lnk_file read;
|
|
Chris PeBenito |
8cffa7 |
allow $1_irc_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
8cffa7 |
allow $1_irc_t self:tcp_socket create_socket_perms;
|
|
Chris PeBenito |
8cffa7 |
allow $1_irc_t self:udp_socket create_socket_perms;
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
allow $1_irc_t $1_irc_home_t:dir create_dir_perms;
|
|
Chris PeBenito |
8cffa7 |
allow $1_irc_t $1_irc_home_t:file create_file_perms;
|
|
Chris PeBenito |
8cffa7 |
allow $1_irc_t $1_irc_home_t:lnk_file create_lnk_perms;
|
|
Chris PeBenito |
103fe2 |
userdom_user_home_dir_filetrans($1,$1_irc_t,$1_irc_home_t,{ dir file lnk_file })
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
# access files under /tmp
|
|
Chris PeBenito |
4ace0f |
allow $1_irc_t $1_irc_tmp_t:dir create_dir_perms;
|
|
Chris PeBenito |
4ace0f |
allow $1_irc_t $1_irc_tmp_t:file create_file_perms;
|
|
Chris PeBenito |
4ace0f |
allow $1_irc_t $1_irc_tmp_t:lnk_file create_lnk_perms;
|
|
Chris PeBenito |
4ace0f |
allow $1_irc_t $1_irc_tmp_t:sock_file create_file_perms;
|
|
Chris PeBenito |
4ace0f |
allow $1_irc_t $1_irc_tmp_t:fifo_file create_file_perms;
|
|
Chris PeBenito |
103fe2 |
files_tmp_filetrans($1_irc_t,$1_irc_tmp_t,{ file dir lnk_file sock_file fifo_file })
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
# Transition from the user domain to the derived domain.
|
|
Chris PeBenito |
8cffa7 |
domain_auto_trans($2,irc_exec_t,$1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
allow $2 $1_irc_t:fd use;
|
|
Chris PeBenito |
8cffa7 |
allow $1_irc_t $2:fd use;
|
|
Chris PeBenito |
8cffa7 |
allow $1_irc_t $2:fifo_file rw_file_perms;
|
|
Chris PeBenito |
8cffa7 |
allow $1_irc_t $2:process sigchld;
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
allow $2 $1_irc_t:process signal;
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
allow $2 $1_irc_exec_t:file { relabelfrom relabelto create_file_perms };
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
# allow ps to show irc
|
|
Chris PeBenito |
8cffa7 |
allow $2 $1_irc_t:dir { search getattr read };
|
|
Chris PeBenito |
8cffa7 |
allow $2 $1_irc_t:{ file lnk_file } { read getattr };
|
|
Chris PeBenito |
8cffa7 |
allow $2 $1_irc_t:process getattr;
|
|
Chris PeBenito |
8cffa7 |
# We need to suppress this denial because procps tries to access
|
|
Chris PeBenito |
8cffa7 |
# /proc/pid/environ and this now triggers a ptrace check in recent kernels
|
|
Chris PeBenito |
8cffa7 |
# (2.4 and 2.6). Might want to change procps to not do this, or only if
|
|
Chris PeBenito |
8cffa7 |
# running in a privileged domain.
|
|
Chris PeBenito |
8cffa7 |
dontaudit $2 $1_irc_t:process ptrace;
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
kernel_read_proc_symlinks($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
corenet_non_ipsec_sendrecv($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
corenet_tcp_sendrecv_generic_if($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
corenet_udp_sendrecv_generic_if($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
corenet_tcp_sendrecv_all_nodes($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
corenet_udp_sendrecv_all_nodes($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
corenet_tcp_sendrecv_all_ports($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
corenet_udp_sendrecv_all_ports($1_irc_t)
|
|
Chris PeBenito |
c0d8c4 |
corenet_sendrecv_ircd_client_packets($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
# cjp: this seems excessive:
|
|
Chris PeBenito |
8cffa7 |
corenet_tcp_connect_all_ports($1_irc_t)
|
|
Chris PeBenito |
c0d8c4 |
corenet_sendrecv_all_client_packets($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
15722e |
domain_use_interactive_fds($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
files_dontaudit_search_pids($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
files_search_var($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
files_read_etc_files($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
files_read_usr_files($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
fs_getattr_xattr_fs($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
fs_search_auto_mountpoints($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
term_use_controlling_term($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
term_list_ptys($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
# allow utmp access
|
|
Chris PeBenito |
68228b |
init_read_utmp($1_irc_t)
|
|
Chris PeBenito |
68228b |
init_dontaudit_lock_utmp($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
libs_use_ld_so($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
libs_use_shared_libs($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
miscfiles_read_localization($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
# Inherit and use descriptors from newrole.
|
|
Chris PeBenito |
15722e |
seutil_use_newrole_fds($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
sysnet_read_config($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
# Write to the user domain tty.
|
|
Chris PeBenito |
8cffa7 |
userdom_use_user_terminals($1,$1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
tunable_policy(`use_nfs_home_dirs',`
|
|
Chris PeBenito |
8cffa7 |
fs_manage_nfs_dirs($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
fs_manage_nfs_files($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
fs_manage_nfs_symlinks($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
')
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
tunable_policy(`use_samba_home_dirs',`
|
|
Chris PeBenito |
8cffa7 |
fs_manage_cifs_dirs($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
fs_manage_cifs_files($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
fs_manage_cifs_symlinks($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
')
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
bb7170 |
optional_policy(`
|
|
Chris PeBenito |
8cffa7 |
nis_use_ypbind($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
')
|
|
Chris PeBenito |
8cffa7 |
|
|
Chris PeBenito |
8cffa7 |
ifdef(`TODO',`
|
|
Chris PeBenito |
bb7170 |
optional_policy(`
|
|
Chris PeBenito |
8cffa7 |
allow $1_irc_t ircd_t:tcp_socket { connectto recvfrom };
|
|
Chris PeBenito |
8cffa7 |
allow ircd_t $1_irc_t:tcp_socket { acceptfrom recvfrom };
|
|
Chris PeBenito |
8cffa7 |
kernel_tcp_recvfrom($1_irc_t)
|
|
Chris PeBenito |
8cffa7 |
kernel_tcp_recvfrom(ircd_t)
|
|
Chris PeBenito |
8cffa7 |
')
|
|
Chris PeBenito |
8cffa7 |
')
|
|
Chris PeBenito |
8cffa7 |
')
|