2005-06-21 21:07:46 +00:00
|
|
|
|
2008-10-14 15:46:36 +00:00
|
|
|
policy_module(ssh, 1.11.0)
|
2005-06-21 21:07:46 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2007-03-26 18:41:45 +00:00
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## allow host key based authentication
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
2008-07-23 21:38:39 +00:00
|
|
|
gen_tunable(allow_ssh_keysign, false)
|
2007-03-26 18:41:45 +00:00
|
|
|
|
|
|
|
## <desc>
|
|
|
|
## <p>
|
|
|
|
## Allow ssh logins as sysadm_r:sysadm_t
|
|
|
|
## </p>
|
|
|
|
## </desc>
|
2008-07-23 21:38:39 +00:00
|
|
|
gen_tunable(ssh_sysadm_login, false)
|
2007-03-26 18:41:45 +00:00
|
|
|
|
2005-06-23 19:57:15 +00:00
|
|
|
attribute ssh_server;
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2007-02-16 23:01:42 +00:00
|
|
|
# Type for the ssh-agent executable.
|
|
|
|
type ssh_agent_exec_t;
|
|
|
|
files_type(ssh_agent_exec_t)
|
|
|
|
|
2005-06-21 21:07:46 +00:00
|
|
|
# ssh client executable.
|
|
|
|
type ssh_exec_t;
|
2007-07-19 18:57:48 +00:00
|
|
|
application_executable_file(ssh_exec_t)
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
type ssh_keygen_t;
|
2005-06-21 21:07:46 +00:00
|
|
|
type ssh_keygen_exec_t;
|
2008-07-23 21:38:39 +00:00
|
|
|
init_system_domain(ssh_keygen_t, ssh_keygen_exec_t)
|
2006-09-06 16:36:23 +00:00
|
|
|
role system_r types ssh_keygen_t;
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2005-09-16 13:36:26 +00:00
|
|
|
type ssh_keysign_exec_t;
|
2007-07-19 18:57:48 +00:00
|
|
|
application_executable_file(ssh_keysign_exec_t)
|
2005-09-16 13:36:26 +00:00
|
|
|
|
2006-10-04 17:25:34 +00:00
|
|
|
type sshd_exec_t;
|
2006-04-19 21:43:02 +00:00
|
|
|
corecmd_executable_file(sshd_exec_t)
|
2005-10-18 15:07:11 +00:00
|
|
|
|
2007-02-16 23:01:42 +00:00
|
|
|
ssh_server_template(sshd)
|
2008-07-23 21:38:39 +00:00
|
|
|
init_daemon_domain(sshd_t, sshd_exec_t)
|
2007-02-16 23:01:42 +00:00
|
|
|
|
2005-10-28 18:13:44 +00:00
|
|
|
type sshd_key_t;
|
|
|
|
files_type(sshd_key_t)
|
2005-06-22 21:14:48 +00:00
|
|
|
|
2007-02-16 23:01:42 +00:00
|
|
|
type sshd_tmp_t;
|
|
|
|
files_tmp_file(sshd_tmp_t)
|
|
|
|
files_poly_parent(sshd_tmp_t)
|
2006-10-04 17:25:34 +00:00
|
|
|
|
2007-02-16 23:01:42 +00:00
|
|
|
ifdef(`enable_mcs',`
|
|
|
|
init_ranged_daemon_domain(sshd_t,sshd_exec_t,s0 - mcs_systemhigh)
|
2005-10-28 18:13:44 +00:00
|
|
|
')
|
2005-06-21 21:07:46 +00:00
|
|
|
|
|
|
|
#################################
|
|
|
|
#
|
|
|
|
# sshd local policy
|
|
|
|
#
|
|
|
|
# sshd_t is the domain for the sshd program.
|
|
|
|
#
|
|
|
|
|
2007-02-16 23:01:42 +00:00
|
|
|
# so a tunnel can point to another ssh tunnel
|
|
|
|
allow sshd_t self:netlink_route_socket r_netlink_socket_perms;
|
|
|
|
allow sshd_t self:key { search link write };
|
2005-07-29 15:07:15 +00:00
|
|
|
|
2008-07-23 21:38:39 +00:00
|
|
|
manage_dirs_pattern(sshd_t, sshd_tmp_t, sshd_tmp_t)
|
|
|
|
manage_files_pattern(sshd_t, sshd_tmp_t, sshd_tmp_t)
|
|
|
|
manage_sock_files_pattern(sshd_t, sshd_tmp_t, sshd_tmp_t)
|
2007-02-16 23:01:42 +00:00
|
|
|
files_tmp_filetrans(sshd_t, sshd_tmp_t, { dir file sock_file })
|
2006-01-16 18:30:14 +00:00
|
|
|
|
2007-02-16 23:01:42 +00:00
|
|
|
kernel_search_key(sshd_t)
|
|
|
|
kernel_link_key(sshd_t)
|
|
|
|
|
|
|
|
# for X forwarding
|
|
|
|
corenet_tcp_bind_xserver_port(sshd_t)
|
|
|
|
corenet_sendrecv_xserver_server_packets(sshd_t)
|
|
|
|
|
|
|
|
tunable_policy(`ssh_sysadm_login',`
|
|
|
|
# Relabel and access ptys created by sshd
|
|
|
|
# ioctl is necessary for logout() processing for utmp entry and for w to
|
|
|
|
# display the tty.
|
|
|
|
# some versions of sshd on the new SE Linux require setattr
|
|
|
|
term_use_all_user_ptys(sshd_t)
|
|
|
|
term_setattr_all_user_ptys(sshd_t)
|
|
|
|
term_relabelto_all_user_ptys(sshd_t)
|
|
|
|
|
|
|
|
userdom_spec_domtrans_all_users(sshd_t)
|
|
|
|
userdom_signal_all_users(sshd_t)
|
|
|
|
',`
|
|
|
|
userdom_spec_domtrans_unpriv_users(sshd_t)
|
|
|
|
userdom_signal_unpriv_users(sshd_t)
|
|
|
|
|
|
|
|
userdom_setattr_unpriv_users_ptys(sshd_t)
|
|
|
|
userdom_relabelto_unpriv_users_ptys(sshd_t)
|
|
|
|
userdom_use_unpriv_users_ptys(sshd_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
daemontools_service_domain(sshd_t, sshd_exec_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
inetd_tcp_service_domain(sshd_t, sshd_exec_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
rpm_use_script_fds(sshd_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
rssh_spec_domtrans_all_users(sshd_t)
|
|
|
|
# For reading /home/user/.ssh
|
|
|
|
rssh_read_all_users_ro_content(sshd_t)
|
|
|
|
')
|
|
|
|
|
2007-10-02 16:04:50 +00:00
|
|
|
optional_policy(`
|
|
|
|
unconfined_domain(sshd_t)
|
|
|
|
unconfined_shell_domtrans(sshd_t)
|
|
|
|
')
|
|
|
|
|
2007-02-16 23:01:42 +00:00
|
|
|
ifdef(`TODO',`
|
|
|
|
tunable_policy(`ssh_sysadm_login',`
|
|
|
|
# Relabel and access ptys created by sshd
|
|
|
|
# ioctl is necessary for logout() processing for utmp entry and for w to
|
|
|
|
# display the tty.
|
|
|
|
# some versions of sshd on the new SE Linux require setattr
|
|
|
|
allow sshd_t ptyfile:chr_file relabelto;
|
2005-10-28 18:13:44 +00:00
|
|
|
|
2006-04-25 19:17:43 +00:00
|
|
|
optional_policy(`
|
2007-02-16 23:01:42 +00:00
|
|
|
domain_trans(sshd_t, xauth_exec_t, userdomain)
|
2006-04-25 19:17:43 +00:00
|
|
|
')
|
2007-02-16 23:01:42 +00:00
|
|
|
',`
|
|
|
|
optional_policy(`
|
|
|
|
domain_trans(sshd_t, xauth_exec_t, unpriv_userdomain)
|
2005-06-21 21:07:46 +00:00
|
|
|
')
|
2007-02-16 23:01:42 +00:00
|
|
|
# Relabel and access ptys created by sshd
|
|
|
|
# ioctl is necessary for logout() processing for utmp entry and for w to
|
|
|
|
# display the tty.
|
|
|
|
# some versions of sshd on the new SE Linux require setattr
|
|
|
|
allow sshd_t userpty_type:chr_file { relabelto read write getattr ioctl setattr };
|
2005-06-22 21:14:48 +00:00
|
|
|
')
|
2007-02-16 23:01:42 +00:00
|
|
|
') dnl endif TODO
|
2005-06-21 21:07:46 +00:00
|
|
|
|
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# ssh_keygen local policy
|
|
|
|
#
|
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
# ssh_keygen_t is the type of the ssh-keygen program when run at install time
|
|
|
|
# and by sysadm_t
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
dontaudit ssh_keygen_t self:capability sys_tty_config;
|
|
|
|
allow ssh_keygen_t self:process { sigchld sigkill sigstop signull signal };
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
allow ssh_keygen_t self:unix_stream_socket create_stream_socket_perms;
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-12-12 20:08:08 +00:00
|
|
|
allow ssh_keygen_t sshd_key_t:file manage_file_perms;
|
2008-07-23 21:38:39 +00:00
|
|
|
files_etc_filetrans(ssh_keygen_t, sshd_key_t, file)
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
kernel_read_kernel_sysctls(ssh_keygen_t)
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
fs_search_auto_mountpoints(ssh_keygen_t)
|
2005-06-27 16:30:55 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
dev_read_sysfs(ssh_keygen_t)
|
|
|
|
dev_read_urand(ssh_keygen_t)
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
term_dontaudit_use_console(ssh_keygen_t)
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
domain_use_interactive_fds(ssh_keygen_t)
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
files_read_etc_files(ssh_keygen_t)
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
init_use_fds(ssh_keygen_t)
|
|
|
|
init_use_script_ptys(ssh_keygen_t)
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
logging_send_syslog_msg(ssh_keygen_t)
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
userdom_dontaudit_use_unpriv_user_fds(ssh_keygen_t)
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
optional_policy(`
|
|
|
|
nscd_socket_use(ssh_keygen_t)
|
|
|
|
')
|
2005-06-21 21:07:46 +00:00
|
|
|
|
2006-09-06 16:36:23 +00:00
|
|
|
optional_policy(`
|
|
|
|
seutil_sigchld_newrole(ssh_keygen_t)
|
|
|
|
')
|
|
|
|
|
|
|
|
optional_policy(`
|
|
|
|
udev_read_db(ssh_keygen_t)
|
2005-09-01 13:52:59 +00:00
|
|
|
')
|