|
Chris PeBenito |
17de1b |
## <summary>Secure shell client and server policy.</summary>
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
#######################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Basic SSH client template.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <desc>
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
## This template creates a derived domains which are used
|
|
Chris PeBenito |
17de1b |
## for ssh client sessions. A derived
|
|
Chris PeBenito |
17de1b |
## type is also created to protect the user ssh keys.
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
## This template was added for NX.
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
## </desc>
|
|
Chris PeBenito |
17de1b |
## <param name="userdomain_prefix">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The prefix of the domain (e.g., user
|
|
Chris PeBenito |
17de1b |
## is the prefix for user_t).
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
## <param name="user_domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The type of the domain.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
## <param name="user_role">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The role associated with the user domain.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
template(`ssh_basic_client_template',`
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
attribute ssh_server;
|
|
Chris PeBenito |
17de1b |
type ssh_exec_t, sshd_key_t;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
ifdef(`strict_policy',`
|
|
Chris PeBenito |
17de1b |
type sshd_tmp_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
##############################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Declarations
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
type $1_ssh_t;
|
|
Chris PeBenito |
17de1b |
domain_type($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
domain_entry_file($1_ssh_t,ssh_exec_t)
|
|
Chris PeBenito |
17de1b |
role $3 types $1_ssh_t;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
type $1_home_ssh_t;
|
|
Chris PeBenito |
17de1b |
files_type($1_home_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
##############################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Client local policy
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t self:capability { setuid setgid dac_override dac_read_search };
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t self:fd use;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t self:unix_dgram_socket { create_socket_perms sendto };
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t self:unix_stream_socket { create_stream_socket_perms connectto };
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t self:shm create_shm_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t self:sem create_sem_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t self:msgq create_msgq_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t self:msg { send receive };
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t self:tcp_socket create_socket_perms;
|
|
Chris PeBenito |
465510 |
allow $1_ssh_t self:netlink_route_socket r_netlink_socket_perms;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# for rsync
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $2:unix_stream_socket rw_socket_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $2:unix_stream_socket connectto;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Read the ssh key file.
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t sshd_key_t:file r_file_perms;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Transition from the domain to the derived domain.
|
|
Chris PeBenito |
17de1b |
domain_auto_trans($2, ssh_exec_t, $1_ssh_t)
|
|
Chris PeBenito |
17de1b |
allow $2 $1_ssh_t:fd use;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $2:fd use;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $2:fifo_file rw_file_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $2:process sigchld;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# inheriting stream sockets is needed for "ssh host command" as no pty
|
|
Chris PeBenito |
17de1b |
# is allocated
|
|
Chris PeBenito |
17de1b |
# cjp: should probably fix target to be an attribute for ssh servers
|
|
Chris PeBenito |
17de1b |
# or "regular" (not special like sshd_extern_t) servers
|
|
Chris PeBenito |
17de1b |
allow $2 ssh_server:unix_stream_socket rw_stream_socket_perms;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# allow ps to show ssh
|
|
Chris PeBenito |
17de1b |
allow $2 $1_ssh_t:dir { search getattr read };
|
|
Chris PeBenito |
17de1b |
allow $2 $1_ssh_t:{ file lnk_file } { read getattr };
|
|
Chris PeBenito |
17de1b |
allow $2 $1_ssh_t:process getattr;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# user can manage the keys and config
|
|
Chris PeBenito |
17de1b |
allow $2 $1_home_ssh_t:dir rw_dir_perms;
|
|
Chris PeBenito |
17de1b |
allow $2 $1_home_ssh_t:file create_file_perms;
|
|
Chris PeBenito |
17de1b |
allow $2 $1_home_ssh_t:lnk_file create_lnk_perms;
|
|
Chris PeBenito |
17de1b |
allow $2 $1_home_ssh_t:sock_file create_file_perms;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# ssh client can manage the keys and config
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $1_home_ssh_t:dir r_dir_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $1_home_ssh_t:file create_file_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $1_home_ssh_t:lnk_file { getattr read };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# ssh servers can read the user keys and config
|
|
Chris PeBenito |
17de1b |
allow ssh_server $1_home_ssh_t:dir r_dir_perms;
|
|
Chris PeBenito |
17de1b |
allow ssh_server $1_home_ssh_t:lnk_file r_file_perms;
|
|
Chris PeBenito |
17de1b |
allow ssh_server $1_home_ssh_t:file r_file_perms;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
kernel_read_kernel_sysctls($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
corenet_non_ipsec_sendrecv($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_if($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_nodes($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_ports($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_connect_ssh_port($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
corenet_sendrecv_ssh_client_packets($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
dev_read_urand($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
fs_getattr_all_fs($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
fs_search_auto_mountpoints($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# run helper programs - needed eg for x11-ssh-askpass
|
|
Chris PeBenito |
17de1b |
corecmd_exec_shell($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
corecmd_exec_bin($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
corecmd_list_sbin($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
corecmd_read_sbin_symlinks($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
domain_use_interactive_fds($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
files_list_home($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
files_read_usr_files($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
files_read_etc_runtime_files($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
files_read_etc_files($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
files_read_var_files($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
libs_use_ld_so($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
libs_use_shared_libs($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
logging_send_syslog_msg($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
logging_read_generic_logs($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
miscfiles_read_localization($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
seutil_read_config($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
sysnet_read_config($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
sysnet_dns_name_resolve($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
ifdef(`strict_policy',`
|
|
Chris PeBenito |
17de1b |
# Access the ssh temporary files.
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t sshd_tmp_t:dir create_dir_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t sshd_tmp_t:file create_file_perms;
|
|
Chris PeBenito |
17de1b |
files_tmp_filetrans($1_ssh_t, sshd_tmp_t, { file dir })
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
tunable_policy(`read_default_t',`
|
|
Chris PeBenito |
17de1b |
files_list_default($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
files_read_default_files($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
files_read_default_symlinks($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
files_read_default_sockets($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
files_read_default_pipes($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
kerberos_use($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
nis_use_ypbind($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
nscd_socket_use($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
#######################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The per user domain template for the ssh module.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <desc>
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
## This template creates a derived domains which are used
|
|
Chris PeBenito |
17de1b |
## for ssh client sessions and user ssh agents. A derived
|
|
Chris PeBenito |
17de1b |
## type is also created to protect the user ssh keys.
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
## This template is invoked automatically for each user, and
|
|
Chris PeBenito |
17de1b |
## generally does not need to be invoked directly
|
|
Chris PeBenito |
17de1b |
## by policy writers.
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
## </desc>
|
|
Chris PeBenito |
17de1b |
## <param name="userdomain_prefix">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The prefix of the user domain (e.g., user
|
|
Chris PeBenito |
17de1b |
## is the prefix for user_t).
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
## <param name="user_domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The type of the user domain.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
## <param name="user_role">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The role associated with the user domain.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
template(`ssh_per_userdomain_template',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type ssh_agent_exec_t, ssh_keysign_exec_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
##############################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Declarations
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
ssh_basic_client_template($1,$2,$3)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
userdom_user_home_content($1,$1_home_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
type $1_ssh_agent_t;
|
|
Chris PeBenito |
17de1b |
domain_type($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
domain_entry_file($1_ssh_agent_t,ssh_agent_exec_t)
|
|
Chris PeBenito |
17de1b |
role $3 types $1_ssh_agent_t;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
528811 |
type $1_ssh_agent_tmp_t;
|
|
Chris PeBenito |
528811 |
files_tmp_file($1_ssh_agent_tmp_t)
|
|
Chris PeBenito |
528811 |
|
|
Chris PeBenito |
17de1b |
type $1_ssh_keysign_t;
|
|
Chris PeBenito |
17de1b |
domain_type($1_ssh_keysign_t)
|
|
Chris PeBenito |
17de1b |
domain_entry_file($1_ssh_keysign_t,ssh_keysign_exec_t)
|
|
Chris PeBenito |
17de1b |
role $3 types $1_ssh_keysign_t;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
type $1_ssh_tmpfs_t;
|
|
Chris PeBenito |
17de1b |
files_tmpfs_file($1_ssh_tmpfs_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
##############################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Client local policy
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $1_ssh_tmpfs_t:dir rw_dir_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $1_ssh_tmpfs_t:file manage_file_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $1_ssh_tmpfs_t:lnk_file create_lnk_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $1_ssh_tmpfs_t:sock_file manage_file_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $1_ssh_tmpfs_t:fifo_file manage_file_perms;
|
|
Chris PeBenito |
17de1b |
fs_tmpfs_filetrans($1_ssh_t,$1_ssh_tmpfs_t,{ dir file lnk_file sock_file fifo_file })
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $1_home_ssh_t:dir manage_dir_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $1_home_ssh_t:sock_file manage_file_perms;
|
|
Chris PeBenito |
17de1b |
userdom_user_home_dir_filetrans($1,$1_ssh_t,$1_home_ssh_t,{ dir sock_file })
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
528811 |
# Allow the ssh program to communicate with ssh-agent.
|
|
Chris PeBenito |
81aa67 |
allow $1_ssh_t $1_ssh_agent_t:unix_stream_socket connectto;
|
|
Chris PeBenito |
81aa67 |
allow $1_ssh_t $1_ssh_agent_tmp_t:sock_file write;
|
|
Chris PeBenito |
81aa67 |
allow $1_ssh_t $1_ssh_agent_tmp_t:dir search;
|
|
Chris PeBenito |
81aa67 |
|
|
Chris PeBenito |
528811 |
allow $1_ssh_t sshd_t:unix_stream_socket connectto;
|
|
Chris PeBenito |
528811 |
|
|
Chris PeBenito |
17de1b |
userdom_use_unpriv_users_fds($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
userdom_dontaudit_list_user_home_dirs($1,$1_ssh_t)
|
|
Chris PeBenito |
17de1b |
userdom_search_user_home_dirs($1,$1_ssh_t)
|
|
Chris PeBenito |
17de1b |
# Write to the user domain tty.
|
|
Chris PeBenito |
17de1b |
userdom_use_user_terminals($1,$1_ssh_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
528811 |
tunable_policy(`allow_ssh_keysign',`
|
|
Chris PeBenito |
528811 |
domain_auto_trans($1_ssh_t, ssh_keysign_exec_t, $1_ssh_keysign_t)
|
|
Chris PeBenito |
528811 |
allow $1_ssh_keysign_t $1_ssh_t:fd use;
|
|
Chris PeBenito |
528811 |
allow $1_ssh_keysign_t $1_ssh_t:process sigchld;
|
|
Chris PeBenito |
528811 |
allow $1_ssh_keysign_t $1_ssh_t:fifo_file rw_file_perms;
|
|
Chris PeBenito |
528811 |
')
|
|
Chris PeBenito |
528811 |
|
|
Chris PeBenito |
17de1b |
tunable_policy(`use_nfs_home_dirs',`
|
|
Chris PeBenito |
17de1b |
fs_manage_nfs_dirs($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
fs_manage_nfs_files($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
tunable_policy(`use_samba_home_dirs',`
|
|
Chris PeBenito |
17de1b |
fs_manage_cifs_dirs($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
fs_manage_cifs_files($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# for port forwarding
|
|
Chris PeBenito |
17de1b |
tunable_policy(`user_tcp_server',`
|
|
Chris PeBenito |
17de1b |
corenet_tcp_bind_ssh_port($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
xserver_user_client_template($1,$1_ssh_t,$1_ssh_tmpfs_t)
|
|
Chris PeBenito |
17de1b |
xserver_domtrans_user_xauth($1,$1_ssh_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
ifdef(`TODO',`
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_t $1_tmp_t:dir r_dir_perms;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# for /bin/sh used to execute xauth
|
|
Chris PeBenito |
17de1b |
dontaudit $1_ssh_t proc_t:{ lnk_file file } { getattr read };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
#allow ssh to access keys stored on removable media
|
|
Chris PeBenito |
17de1b |
# Should we have a boolean around this?
|
|
Chris PeBenito |
17de1b |
files_search_mnt($1_ssh_t)
|
|
Chris PeBenito |
17de1b |
r_dir_file($1_ssh_t, removable_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
') dnl endif TODO
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
##############################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# $1_ssh_agent_t local policy
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_agent_t self:process setrlimit;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_agent_t self:capability setgid;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_agent_t { $1_ssh_agent_t $2 }:process signull;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
81aa67 |
allow $1_ssh_agent_t self:unix_stream_socket { create_stream_socket_perms connectto };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
528811 |
allow $1_ssh_agent_t $1_ssh_agent_tmp_t:dir manage_dir_perms;
|
|
Chris PeBenito |
528811 |
allow $1_ssh_agent_t $1_ssh_agent_tmp_t:sock_file manage_file_perms;
|
|
Chris PeBenito |
528811 |
files_tmp_filetrans($1_ssh_agent_t,$1_ssh_agent_tmp_t,{ dir sock_file })
|
|
Chris PeBenito |
528811 |
|
|
Chris PeBenito |
17de1b |
# for ssh-add
|
|
Chris PeBenito |
17de1b |
allow $2 $1_ssh_agent_t:unix_stream_socket connectto;
|
|
Chris PeBenito |
81aa67 |
allow $2 $1_ssh_agent_tmp_t:sock_file write;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Allow the user shell to signal the ssh program.
|
|
Chris PeBenito |
17de1b |
allow $2 $1_ssh_agent_t:process signal;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
528811 |
# allow ps to show ssh
|
|
Chris PeBenito |
528811 |
allow $2 $1_ssh_agent_t:dir { search getattr read };
|
|
Chris PeBenito |
528811 |
allow $2 $1_ssh_agent_t:{ file lnk_file } { read getattr };
|
|
Chris PeBenito |
528811 |
allow $2 $1_ssh_agent_t:process getattr;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
domain_auto_trans($2, ssh_agent_exec_t, $1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
allow $2 $1_ssh_agent_t:fd use;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_agent_t $2:fd use;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_agent_t $2:fifo_file rw_file_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_ssh_agent_t $2:process sigchld;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
kernel_read_kernel_sysctls($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
dev_read_urand($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
dev_read_rand($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
fs_search_auto_mountpoints($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# transition back to normal privs upon exec
|
|
Chris PeBenito |
17de1b |
corecmd_shell_domtrans($1_ssh_agent_t,$1_t)
|
|
Chris PeBenito |
17de1b |
corecmd_bin_domtrans($1_ssh_agent_t, $1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
domain_use_interactive_fds($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
files_read_etc_files($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
files_read_etc_runtime_files($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
files_search_home($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
libs_read_lib_files($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
libs_use_ld_so($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
libs_use_shared_libs($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
logging_send_syslog_msg($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
miscfiles_read_localization($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
seutil_dontaudit_read_config($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Write to the user domain tty.
|
|
Chris PeBenito |
17de1b |
userdom_use_user_terminals($1,$1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
528811 |
# for the transition back to normal privs upon exec
|
|
Chris PeBenito |
528811 |
userdom_user_home_domtrans($1,$1_ssh_agent_t,$2)
|
|
Chris PeBenito |
528811 |
allow $2 $1_ssh_agent_t:fd use;
|
|
Chris PeBenito |
528811 |
allow $2 $1_ssh_agent_t:fifo_file rw_file_perms;
|
|
Chris PeBenito |
528811 |
allow $2 $1_ssh_agent_t:process sigchld;
|
|
Chris PeBenito |
528811 |
|
|
Chris PeBenito |
17de1b |
tunable_policy(`use_nfs_home_dirs',`
|
|
Chris PeBenito |
17de1b |
fs_manage_nfs_files($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# transition back to normal privs upon exec
|
|
Chris PeBenito |
17de1b |
fs_nfs_domtrans($1_ssh_agent_t, $1_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
tunable_policy(`use_samba_home_dirs',`
|
|
Chris PeBenito |
17de1b |
fs_manage_cifs_files($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# transition back to normal privs upon exec
|
|
Chris PeBenito |
17de1b |
fs_cifs_domtrans($1_ssh_agent_t, $1_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
nis_use_ypbind($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
ifdef(`TODO',`
|
|
Chris PeBenito |
17de1b |
ifdef(`xdm.te',`
|
|
Chris PeBenito |
17de1b |
can_pipe_xdm($1_ssh_agent_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
dontaudit $1_ssh_agent_t proc_t:{ lnk_file file } { getattr read };
|
|
Chris PeBenito |
17de1b |
') dnl endif TODO
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
##############################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# $1_ssh_keysign_t local policy
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
528811 |
tunable_policy(`allow_ssh_keysign',`
|
|
Chris PeBenito |
528811 |
allow $1_ssh_keysign_t self:capability { setgid setuid };
|
|
Chris PeBenito |
528811 |
allow $1_ssh_keysign_t self:unix_stream_socket create_socket_perms;
|
|
Chris PeBenito |
528811 |
|
|
Chris PeBenito |
528811 |
allow $1_ssh_keysign_t sshd_key_t:file { getattr read };
|
|
Chris PeBenito |
528811 |
|
|
Chris PeBenito |
528811 |
dev_read_urand($1_ssh_keysign_t)
|
|
Chris PeBenito |
528811 |
|
|
Chris PeBenito |
528811 |
files_read_etc_files($1_ssh_keysign_t)
|
|
Chris PeBenito |
528811 |
|
|
Chris PeBenito |
528811 |
libs_use_ld_so($1_ssh_keysign_t)
|
|
Chris PeBenito |
528811 |
libs_use_shared_libs($1_ssh_keysign_t)
|
|
Chris PeBenito |
528811 |
')
|
|
Chris PeBenito |
528811 |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
528811 |
tunable_policy(`allow_ssh_keysign',`
|
|
Chris PeBenito |
528811 |
nscd_socket_use($1_ssh_keysign_t)
|
|
Chris PeBenito |
528811 |
')
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
#######################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The template to define a ssh server.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <desc>
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
## This template creates a domains to be used for
|
|
Chris PeBenito |
17de1b |
## creating a ssh server. This is typically done
|
|
Chris PeBenito |
17de1b |
## to have multiple ssh servers of different sensitivities,
|
|
Chris PeBenito |
17de1b |
## such as for an internal network-facing ssh server, and
|
|
Chris PeBenito |
17de1b |
## a external network-facing ssh server.
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
## </desc>
|
|
Chris PeBenito |
17de1b |
## <param name="userdomain_prefix">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The prefix of the server domain (e.g., sshd
|
|
Chris PeBenito |
17de1b |
## is the prefix for sshd_t).
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
template(`ssh_server_template', `
|
|
Chris PeBenito |
17de1b |
type $1_t, ssh_server;
|
|
Chris PeBenito |
4b3b46 |
auth_login_pgm_domain($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
type $1_devpts_t;
|
|
Chris PeBenito |
17de1b |
term_login_pty($1_devpts_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
type $1_var_run_t;
|
|
Chris PeBenito |
17de1b |
files_pid_file($1_var_run_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1_t self:capability { kill sys_chroot sys_resource chown dac_override fowner fsetid setgid setuid sys_tty_config };
|
|
Chris PeBenito |
17de1b |
allow $1_t self:fifo_file rw_file_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_t self:process { signal setsched setrlimit setexec };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1_t self:tcp_socket { listen accept create connect ioctl read getattr write setattr append bind getopt setopt shutdown };
|
|
Chris PeBenito |
17de1b |
allow $1_t self:udp_socket { connect create ioctl read getattr write setattr append bind getopt setopt shutdown };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1_t $1_devpts_t:chr_file { rw_file_perms setattr getattr relabelfrom };
|
|
Chris PeBenito |
17de1b |
term_create_pty($1_t,$1_devpts_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1_t $1_var_run_t:file create_file_perms;
|
|
Chris PeBenito |
17de1b |
files_pid_filetrans($1_t,$1_var_run_t,file)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
can_exec($1_t, sshd_exec_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Access key files
|
|
Chris PeBenito |
17de1b |
allow $1_t sshd_key_t:file { getattr read };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
kernel_read_kernel_sysctls($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_if($1_t)
|
|
Chris PeBenito |
17de1b |
corenet_udp_sendrecv_all_if($1_t)
|
|
Chris PeBenito |
17de1b |
corenet_raw_sendrecv_all_if($1_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_nodes($1_t)
|
|
Chris PeBenito |
17de1b |
corenet_udp_sendrecv_all_nodes($1_t)
|
|
Chris PeBenito |
17de1b |
corenet_raw_sendrecv_all_nodes($1_t)
|
|
Chris PeBenito |
17de1b |
corenet_udp_sendrecv_all_ports($1_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_sendrecv_all_ports($1_t)
|
|
Chris PeBenito |
17de1b |
corenet_non_ipsec_sendrecv($1_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_bind_all_nodes($1_t)
|
|
Chris PeBenito |
17de1b |
corenet_udp_bind_all_nodes($1_t)
|
|
Chris PeBenito |
17de1b |
corenet_tcp_connect_all_ports($1_t)
|
|
Chris PeBenito |
17de1b |
corenet_sendrecv_ssh_server_packets($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
fs_dontaudit_getattr_all_fs($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
auth_rw_login_records($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
corecmd_read_bin_symlinks($1_t)
|
|
Chris PeBenito |
17de1b |
corecmd_getattr_bin_files($1_t)
|
|
Chris PeBenito |
17de1b |
# for sshd subsystems, such as sftp-server.
|
|
Chris PeBenito |
17de1b |
corecmd_getattr_bin_files($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
domain_interactive_fd($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
files_read_etc_files($1_t)
|
|
Chris PeBenito |
17de1b |
files_read_etc_runtime_files($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
libs_use_ld_so($1_t)
|
|
Chris PeBenito |
17de1b |
libs_use_shared_libs($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
logging_search_logs($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
miscfiles_read_localization($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
sysnet_read_config($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
userdom_dontaudit_relabelfrom_unpriv_users_ptys($1_t)
|
|
Chris PeBenito |
17de1b |
userdom_search_all_users_home_content($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Allow checking users mail at login
|
|
Chris PeBenito |
17de1b |
mta_getattr_spool($1_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
tunable_policy(`use_nfs_home_dirs',`
|
|
Chris PeBenito |
17de1b |
fs_read_nfs_files($1_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
tunable_policy(`use_samba_home_dirs',`
|
|
Chris PeBenito |
17de1b |
fs_read_cifs_files($1_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# cjp: commenting out until typeattribute works in conditional
|
|
Chris PeBenito |
17de1b |
# and require block in optional else is resolved
|
|
Chris PeBenito |
17de1b |
#optional_policy(`
|
|
Chris PeBenito |
17de1b |
# tunable_policy(`run_ssh_inetd',`
|
|
Chris PeBenito |
17de1b |
# allow $1_t self:process signal;
|
|
Chris PeBenito |
17de1b |
# files_list_pids($1_t)
|
|
Chris PeBenito |
17de1b |
# ',`
|
|
Chris PeBenito |
17de1b |
# corenet_tcp_bind_ssh_port($1_t)
|
|
Chris PeBenito |
17de1b |
# init_use_fds($1_t)
|
|
Chris PeBenito |
17de1b |
# init_use_script_ptys($1_t)
|
|
Chris PeBenito |
17de1b |
# ')
|
|
Chris PeBenito |
17de1b |
#',`
|
|
Chris PeBenito |
17de1b |
# These rules should match the else block
|
|
Chris PeBenito |
17de1b |
# of the run_ssh_inetd tunable directly above
|
|
Chris PeBenito |
17de1b |
corenet_tcp_bind_ssh_port($1_t)
|
|
Chris PeBenito |
17de1b |
init_use_fds($1_t)
|
|
Chris PeBenito |
17de1b |
init_use_script_ptys($1_t)
|
|
Chris PeBenito |
17de1b |
#')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
kerberos_use($1_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
nscd_socket_use($1_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
nx_spec_domtrans_server($1_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Send a SIGCHLD signal to the ssh server.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`ssh_sigchld',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type sshd_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1 sshd_t:process sigchld;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Read a ssh server unnamed pipe.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`ssh_read_pipes',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type sshd_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1 sshd_t:fifo_file { getattr read };
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Read and write ssh server unix domain stream sockets.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`ssh_rw_stream_sockets',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type sshd_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1 sshd_t:unix_stream_socket rw_stream_socket_perms;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Read and write ssh server TCP sockets.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`ssh_rw_tcp_sockets',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type sshd_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1 sshd_t:tcp_socket rw_stream_socket_perms;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Do not audit attempts to read and write
|
|
Chris PeBenito |
17de1b |
## ssh server TCP sockets.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain to not audit.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`ssh_dontaudit_rw_tcp_sockets',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type sshd_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
dontaudit $1 sshd_t:tcp_socket { read write };
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Connect to SSH daemons over TCP sockets.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`ssh_tcp_connect',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type sshd_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1 sshd_t:tcp_socket { connectto recvfrom };
|
|
Chris PeBenito |
17de1b |
allow sshd_t $1:tcp_socket { acceptfrom recvfrom };
|
|
Chris PeBenito |
17de1b |
kernel_tcp_recvfrom($1)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Execute the ssh client in the caller domain.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`ssh_exec',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type ssh_exec_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
corecmd_search_bin($1)
|
|
Chris PeBenito |
17de1b |
can_exec($1,ssh_exec_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Read ssh server keys
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <param name="domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## Domain allowed access.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
interface(`ssh_dontaudit_read_server_keys',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type sshd_key_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
dontaudit $1 sshd_key_t:file { getattr read };
|
|
Chris PeBenito |
17de1b |
')
|