|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
f7925f |
policy_module(ssh,1.9.0)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Declarations
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
56e1b3 |
## <desc>
|
|
Chris PeBenito |
56e1b3 |
##
|
|
Chris PeBenito |
56e1b3 |
## allow host key based authentication
|
|
Chris PeBenito |
56e1b3 |
##
|
|
Chris PeBenito |
56e1b3 |
## </desc>
|
|
Chris PeBenito |
56e1b3 |
gen_tunable(allow_ssh_keysign,false)
|
|
Chris PeBenito |
56e1b3 |
|
|
Chris PeBenito |
56e1b3 |
## <desc>
|
|
Chris PeBenito |
56e1b3 |
##
|
|
Chris PeBenito |
56e1b3 |
## Allow ssh logins as sysadm_r:sysadm_t
|
|
Chris PeBenito |
56e1b3 |
##
|
|
Chris PeBenito |
56e1b3 |
## </desc>
|
|
Chris PeBenito |
56e1b3 |
gen_tunable(ssh_sysadm_login,false)
|
|
Chris PeBenito |
56e1b3 |
|
|
Chris PeBenito |
17de1b |
attribute ssh_server;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
6b19be |
# Type for the ssh-agent executable.
|
|
Chris PeBenito |
6b19be |
type ssh_agent_exec_t;
|
|
Chris PeBenito |
6b19be |
files_type(ssh_agent_exec_t)
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
17de1b |
# ssh client executable.
|
|
Chris PeBenito |
17de1b |
type ssh_exec_t;
|
|
Chris PeBenito |
d46cfe |
application_executable_file(ssh_exec_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
type ssh_keygen_t;
|
|
Chris PeBenito |
17de1b |
type ssh_keygen_exec_t;
|
|
Chris PeBenito |
75beb9 |
init_system_domain(ssh_keygen_t,ssh_keygen_exec_t)
|
|
Chris PeBenito |
75beb9 |
role system_r types ssh_keygen_t;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
type ssh_keysign_exec_t;
|
|
Chris PeBenito |
d46cfe |
application_executable_file(ssh_keysign_exec_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
e070dd |
type sshd_exec_t;
|
|
Chris PeBenito |
17de1b |
corecmd_executable_file(sshd_exec_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
6b19be |
ssh_server_template(sshd)
|
|
Chris PeBenito |
6b19be |
init_daemon_domain(sshd_t,sshd_exec_t)
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
6b19be |
ssh_server_template(sshd_extern)
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
17de1b |
type sshd_key_t;
|
|
Chris PeBenito |
17de1b |
files_type(sshd_key_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
6b19be |
type sshd_tmp_t;
|
|
Chris PeBenito |
6b19be |
files_tmp_file(sshd_tmp_t)
|
|
Chris PeBenito |
6b19be |
files_poly_parent(sshd_tmp_t)
|
|
Chris PeBenito |
e070dd |
|
|
Chris PeBenito |
6b19be |
ifdef(`enable_mcs',`
|
|
Chris PeBenito |
6b19be |
init_ranged_daemon_domain(sshd_t,sshd_exec_t,s0 - mcs_systemhigh)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
#################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# sshd local policy
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# sshd_t is the domain for the sshd program.
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
6b19be |
# so a tunnel can point to another ssh tunnel
|
|
Chris PeBenito |
6b19be |
allow sshd_t self:netlink_route_socket r_netlink_socket_perms;
|
|
Chris PeBenito |
6b19be |
allow sshd_t self:key { search link write };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
6b19be |
manage_dirs_pattern(sshd_t,sshd_tmp_t,sshd_tmp_t)
|
|
Chris PeBenito |
6b19be |
manage_files_pattern(sshd_t,sshd_tmp_t,sshd_tmp_t)
|
|
Chris PeBenito |
6b19be |
manage_sock_files_pattern(sshd_t,sshd_tmp_t,sshd_tmp_t)
|
|
Chris PeBenito |
6b19be |
files_tmp_filetrans(sshd_t, sshd_tmp_t, { dir file sock_file })
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
6b19be |
kernel_search_key(sshd_t)
|
|
Chris PeBenito |
6b19be |
kernel_link_key(sshd_t)
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
6b19be |
# for X forwarding
|
|
Chris PeBenito |
6b19be |
corenet_tcp_bind_xserver_port(sshd_t)
|
|
Chris PeBenito |
6b19be |
corenet_sendrecv_xserver_server_packets(sshd_t)
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
6b19be |
tunable_policy(`ssh_sysadm_login',`
|
|
Chris PeBenito |
6b19be |
# Relabel and access ptys created by sshd
|
|
Chris PeBenito |
6b19be |
# ioctl is necessary for logout() processing for utmp entry and for w to
|
|
Chris PeBenito |
6b19be |
# display the tty.
|
|
Chris PeBenito |
6b19be |
# some versions of sshd on the new SE Linux require setattr
|
|
Chris PeBenito |
6b19be |
term_use_all_user_ptys(sshd_t)
|
|
Chris PeBenito |
6b19be |
term_setattr_all_user_ptys(sshd_t)
|
|
Chris PeBenito |
6b19be |
term_relabelto_all_user_ptys(sshd_t)
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
6b19be |
userdom_spec_domtrans_all_users(sshd_t)
|
|
Chris PeBenito |
6b19be |
userdom_signal_all_users(sshd_t)
|
|
Chris PeBenito |
6b19be |
',`
|
|
Chris PeBenito |
6b19be |
userdom_spec_domtrans_unpriv_users(sshd_t)
|
|
Chris PeBenito |
6b19be |
userdom_signal_unpriv_users(sshd_t)
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
6b19be |
userdom_setattr_unpriv_users_ptys(sshd_t)
|
|
Chris PeBenito |
6b19be |
userdom_relabelto_unpriv_users_ptys(sshd_t)
|
|
Chris PeBenito |
6b19be |
userdom_use_unpriv_users_ptys(sshd_t)
|
|
Chris PeBenito |
6b19be |
')
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
6b19be |
optional_policy(`
|
|
Chris PeBenito |
6b19be |
daemontools_service_domain(sshd_t, sshd_exec_t)
|
|
Chris PeBenito |
6b19be |
')
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
6b19be |
optional_policy(`
|
|
Chris PeBenito |
6b19be |
inetd_tcp_service_domain(sshd_t, sshd_exec_t)
|
|
Chris PeBenito |
6b19be |
')
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
6b19be |
optional_policy(`
|
|
Chris PeBenito |
6b19be |
rpm_use_script_fds(sshd_t)
|
|
Chris PeBenito |
6b19be |
')
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
6b19be |
optional_policy(`
|
|
Chris PeBenito |
6b19be |
rssh_spec_domtrans_all_users(sshd_t)
|
|
Chris PeBenito |
6b19be |
# For reading /home/user/.ssh
|
|
Chris PeBenito |
6b19be |
rssh_read_all_users_ro_content(sshd_t)
|
|
Chris PeBenito |
6b19be |
')
|
|
Chris PeBenito |
6b19be |
|
|
Chris PeBenito |
350b6a |
optional_policy(`
|
|
Chris PeBenito |
350b6a |
unconfined_domain(sshd_t)
|
|
Chris PeBenito |
350b6a |
unconfined_shell_domtrans(sshd_t)
|
|
Chris PeBenito |
350b6a |
')
|
|
Chris PeBenito |
350b6a |
|
|
Chris PeBenito |
6b19be |
ifdef(`TODO',`
|
|
Chris PeBenito |
6b19be |
tunable_policy(`ssh_sysadm_login',`
|
|
Chris PeBenito |
6b19be |
# Relabel and access ptys created by sshd
|
|
Chris PeBenito |
6b19be |
# ioctl is necessary for logout() processing for utmp entry and for w to
|
|
Chris PeBenito |
6b19be |
# display the tty.
|
|
Chris PeBenito |
6b19be |
# some versions of sshd on the new SE Linux require setattr
|
|
Chris PeBenito |
6b19be |
allow sshd_t ptyfile:chr_file relabelto;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
6b19be |
domain_trans(sshd_t, xauth_exec_t, userdomain)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
6b19be |
',`
|
|
Chris PeBenito |
6b19be |
optional_policy(`
|
|
Chris PeBenito |
6b19be |
domain_trans(sshd_t, xauth_exec_t, unpriv_userdomain)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
6b19be |
# Relabel and access ptys created by sshd
|
|
Chris PeBenito |
6b19be |
# ioctl is necessary for logout() processing for utmp entry and for w to
|
|
Chris PeBenito |
6b19be |
# display the tty.
|
|
Chris PeBenito |
6b19be |
# some versions of sshd on the new SE Linux require setattr
|
|
Chris PeBenito |
6b19be |
allow sshd_t userpty_type:chr_file { relabelto read write getattr ioctl setattr };
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
6b19be |
') dnl endif TODO
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
#################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# sshd_extern local policy
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# sshd_extern_t is the domain for ssh from outside our network
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
350b6a |
ifdef(`TODO',`
|
|
Chris PeBenito |
350b6a |
domain_trans(initrc_t, sshd_exec_t, sshd_extern_t)
|
|
Chris PeBenito |
56e1b3 |
|
|
Chris PeBenito |
350b6a |
domain_trans(sshd_extern_t, shell_exec_t, user_mini_domain)
|
|
Chris PeBenito |
350b6a |
# Signal the user domains.
|
|
Chris PeBenito |
350b6a |
allow sshd_extern_t user_mini_domain:process signal;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
350b6a |
ifdef(`xauth.te', `
|
|
Chris PeBenito |
350b6a |
domain_trans(sshd_extern_t, xauth_exec_t, user_mini_domain)
|
|
Chris PeBenito |
350b6a |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
350b6a |
# Relabel and access ptys created by sshd
|
|
Chris PeBenito |
350b6a |
# ioctl is necessary for logout() processing for utmp entry and for w to
|
|
Chris PeBenito |
350b6a |
# display the tty.
|
|
Chris PeBenito |
350b6a |
# some versions of sshd on the new SE Linux require setattr
|
|
Chris PeBenito |
350b6a |
allow sshd_extern_t user_mini_domain:chr_file { relabelto read write getattr ioctl setattr };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
350b6a |
# inheriting stream sockets is needed for "ssh host command" as no pty
|
|
Chris PeBenito |
350b6a |
# is allocated
|
|
Chris PeBenito |
350b6a |
allow user_mini_domain sshd_extern_t:unix_stream_socket rw_stream_socket_perms;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
350b6a |
optional_policy(`
|
|
Chris PeBenito |
350b6a |
domain_trans(inetd_t, sshd_exec_t, sshd_extern_t)
|
|
Chris PeBenito |
350b6a |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
350b6a |
ifdef(`direct_sysadm_daemon', `
|
|
Chris PeBenito |
350b6a |
# Direct execution by sysadm_r.
|
|
Chris PeBenito |
350b6a |
domain_auto_trans(sysadm_t, sshd_exec_t, sshd_t)
|
|
Chris PeBenito |
350b6a |
role_transition sysadm_r sshd_exec_t system_r;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
350b6a |
') dnl endif TODO
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# ssh_keygen local policy
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
# ssh_keygen_t is the type of the ssh-keygen program when run at install time
|
|
Chris PeBenito |
75beb9 |
# and by sysadm_t
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
dontaudit ssh_keygen_t self:capability sys_tty_config;
|
|
Chris PeBenito |
75beb9 |
allow ssh_keygen_t self:process { sigchld sigkill sigstop signull signal };
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
allow ssh_keygen_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
c0868a |
allow ssh_keygen_t sshd_key_t:file manage_file_perms;
|
|
Chris PeBenito |
75beb9 |
files_etc_filetrans(ssh_keygen_t,sshd_key_t,file)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
kernel_read_kernel_sysctls(ssh_keygen_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
fs_search_auto_mountpoints(ssh_keygen_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
dev_read_sysfs(ssh_keygen_t)
|
|
Chris PeBenito |
75beb9 |
dev_read_urand(ssh_keygen_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
term_dontaudit_use_console(ssh_keygen_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
domain_use_interactive_fds(ssh_keygen_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
files_read_etc_files(ssh_keygen_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
init_use_fds(ssh_keygen_t)
|
|
Chris PeBenito |
75beb9 |
init_use_script_ptys(ssh_keygen_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
libs_use_ld_so(ssh_keygen_t)
|
|
Chris PeBenito |
75beb9 |
libs_use_shared_libs(ssh_keygen_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
logging_send_syslog_msg(ssh_keygen_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
userdom_dontaudit_use_unpriv_user_fds(ssh_keygen_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
optional_policy(`
|
|
Chris PeBenito |
75beb9 |
nscd_socket_use(ssh_keygen_t)
|
|
Chris PeBenito |
75beb9 |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
75beb9 |
optional_policy(`
|
|
Chris PeBenito |
75beb9 |
seutil_sigchld_newrole(ssh_keygen_t)
|
|
Chris PeBenito |
75beb9 |
')
|
|
Chris PeBenito |
75beb9 |
|
|
Chris PeBenito |
75beb9 |
optional_policy(`
|
|
Chris PeBenito |
75beb9 |
udev_read_db(ssh_keygen_t)
|
|
Chris PeBenito |
17de1b |
')
|