|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
02bcb8 |
policy_module(ssh,1.2.1)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
0404a3 |
########################################
|
|
Chris PeBenito |
0404a3 |
#
|
|
Chris PeBenito |
0404a3 |
# Declarations
|
|
Chris PeBenito |
0404a3 |
#
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
452399 |
attribute ssh_server;
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
0404a3 |
# ssh client executable.
|
|
Chris PeBenito |
0404a3 |
type ssh_exec_t;
|
|
Chris PeBenito |
8fd367 |
files_type(ssh_exec_t)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
0404a3 |
type ssh_keygen_exec_t;
|
|
Chris PeBenito |
375c24 |
files_type(ssh_keygen_exec_t)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
a08248 |
type ssh_keysign_exec_t;
|
|
Chris PeBenito |
a08248 |
files_type(ssh_keysign_exec_t)
|
|
Chris PeBenito |
a08248 |
|
|
Chris PeBenito |
c38127 |
# real declaration moved to mls until
|
|
Chris PeBenito |
c38127 |
# range_transition works in loadable modules
|
|
Chris PeBenito |
c38127 |
gen_require(`
|
|
Chris PeBenito |
c38127 |
type sshd_exec_t;
|
|
Chris PeBenito |
c38127 |
')
|
|
Chris PeBenito |
c38127 |
files_type(sshd_exec_t)
|
|
Chris PeBenito |
c38127 |
|
|
Chris PeBenito |
375c24 |
type sshd_key_t;
|
|
Chris PeBenito |
375c24 |
files_type(sshd_key_t)
|
|
Chris PeBenito |
9ccd96 |
|
|
Chris PeBenito |
375c24 |
ifdef(`targeted_policy',`
|
|
Chris PeBenito |
375c24 |
unconfined_alias_domain(sshd_t)
|
|
Chris PeBenito |
375c24 |
init_system_domain(sshd_t,sshd_exec_t)
|
|
Chris PeBenito |
2d13f7 |
|
|
Chris PeBenito |
2d13f7 |
type sshd_var_run_t;
|
|
Chris PeBenito |
2d13f7 |
files_type(sshd_var_run_t)
|
|
Chris PeBenito |
b48801 |
|
|
Chris PeBenito |
b48801 |
# FIXME
|
|
Chris PeBenito |
b48801 |
typeattribute ssh_exec_t entry_type;
|
|
Chris PeBenito |
b48801 |
typeattribute ssh_keygen_exec_t entry_type;
|
|
Chris PeBenito |
b48801 |
typeattribute ssh_keysign_exec_t entry_type;
|
|
Chris PeBenito |
375c24 |
',`
|
|
Chris PeBenito |
375c24 |
# Type for the ssh-agent executable.
|
|
Chris PeBenito |
375c24 |
type ssh_agent_exec_t;
|
|
Chris PeBenito |
375c24 |
files_type(ssh_agent_exec_t)
|
|
Chris PeBenito |
375c24 |
|
|
Chris PeBenito |
375c24 |
type ssh_keygen_t;
|
|
Chris PeBenito |
375c24 |
init_system_domain(ssh_keygen_t,ssh_keygen_exec_t)
|
|
Chris PeBenito |
375c24 |
role system_r types ssh_keygen_t;
|
|
Chris PeBenito |
375c24 |
|
|
Chris PeBenito |
375c24 |
ssh_server_template(sshd)
|
|
Chris PeBenito |
375c24 |
ssh_server_template(sshd_extern)
|
|
Chris PeBenito |
375c24 |
|
|
Chris PeBenito |
375c24 |
# cjp: commenting this out until typeattribute works in a conditional
|
|
Chris PeBenito |
132880 |
# optional_policy(`inetd',`
|
|
Chris PeBenito |
375c24 |
# tunable_policy(`run_ssh_inetd',`
|
|
Chris PeBenito |
375c24 |
# inetd_tcp_service_domain(sshd_t,sshd_exec_t)
|
|
Chris PeBenito |
375c24 |
# ',`
|
|
Chris PeBenito |
375c24 |
# init_daemon_domain(sshd_t,sshd_exec_t)
|
|
Chris PeBenito |
375c24 |
# ')
|
|
Chris PeBenito |
80436b |
# ',`
|
|
Chris PeBenito |
375c24 |
# These rules should match the else block
|
|
Chris PeBenito |
375c24 |
# of the run_ssh_inetd tunable directly above
|
|
Chris PeBenito |
375c24 |
init_daemon_domain(sshd_t,sshd_exec_t)
|
|
Chris PeBenito |
80436b |
# ')
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
type sshd_tmp_t;
|
|
Chris PeBenito |
375c24 |
files_tmp_file(sshd_tmp_t)
|
|
Chris PeBenito |
375c24 |
')
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
0404a3 |
#################################
|
|
Chris PeBenito |
0404a3 |
#
|
|
Chris PeBenito |
0404a3 |
# sshd local policy
|
|
Chris PeBenito |
0404a3 |
#
|
|
Chris PeBenito |
0404a3 |
# sshd_t is the domain for the sshd program.
|
|
Chris PeBenito |
0404a3 |
#
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
ifdef(`targeted_policy',`',`
|
|
Chris PeBenito |
375c24 |
# so a tunnel can point to another ssh tunnel
|
|
Chris PeBenito |
375c24 |
allow sshd_t self:tcp_socket { acceptfrom connectto recvfrom };
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
allow sshd_t sshd_tmp_t:dir create_dir_perms;
|
|
Chris PeBenito |
375c24 |
allow sshd_t sshd_tmp_t:file create_file_perms;
|
|
Chris PeBenito |
375c24 |
allow sshd_t sshd_tmp_t:sock_file create_file_perms;
|
|
Chris PeBenito |
103fe2 |
files_tmp_filetrans(sshd_t, sshd_tmp_t, { dir file sock_file })
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
# for X forwarding
|
|
Chris PeBenito |
375c24 |
corenet_tcp_bind_xserver_port(sshd_t)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
bf080a |
mls_file_read_up(sshd_t)
|
|
Chris PeBenito |
bf080a |
mls_file_write_down(sshd_t)
|
|
Chris PeBenito |
bf080a |
mls_file_upgrade(sshd_t)
|
|
Chris PeBenito |
bf080a |
mls_file_downgrade(sshd_t)
|
|
Chris PeBenito |
bf080a |
mls_process_set_level(sshd_t)
|
|
Chris PeBenito |
bf080a |
|
|
Chris PeBenito |
375c24 |
auth_exec_pam(sshd_t)
|
|
Chris PeBenito |
e5590e |
|
|
Chris PeBenito |
375c24 |
seutil_read_config(sshd_t)
|
|
Chris PeBenito |
e5590e |
|
|
Chris PeBenito |
375c24 |
tunable_policy(`ssh_sysadm_login',`
|
|
Chris PeBenito |
375c24 |
# Relabel and access ptys created by sshd
|
|
Chris PeBenito |
375c24 |
# ioctl is necessary for logout() processing for utmp entry and for w to
|
|
Chris PeBenito |
375c24 |
# display the tty.
|
|
Chris PeBenito |
375c24 |
# some versions of sshd on the new SE Linux require setattr
|
|
Chris PeBenito |
375c24 |
term_use_all_user_ptys(sshd_t)
|
|
Chris PeBenito |
375c24 |
term_setattr_all_user_ptys(sshd_t)
|
|
Chris PeBenito |
375c24 |
term_relabelto_all_user_ptys(sshd_t)
|
|
Chris PeBenito |
375c24 |
|
|
Chris PeBenito |
375c24 |
userdom_spec_domtrans_all_users(sshd_t)
|
|
Chris PeBenito |
375c24 |
userdom_signal_all_users(sshd_t)
|
|
Chris PeBenito |
375c24 |
',`
|
|
Chris PeBenito |
375c24 |
userdom_spec_domtrans_unpriv_users(sshd_t)
|
|
Chris PeBenito |
375c24 |
userdom_signal_unpriv_users(sshd_t)
|
|
Chris PeBenito |
f6abfd |
|
|
Chris PeBenito |
15722e |
userdom_setattr_unpriv_users_ptys(sshd_t)
|
|
Chris PeBenito |
15722e |
userdom_relabelto_unpriv_users_ptys(sshd_t)
|
|
Chris PeBenito |
1815ba |
userdom_use_unpriv_users_ptys(sshd_t)
|
|
Chris PeBenito |
375c24 |
')
|
|
Chris PeBenito |
bbdbdb |
|
|
Chris PeBenito |
44d5d9 |
optional_policy(`daemontools',`
|
|
Chris PeBenito |
44d5d9 |
daemontools_service_domain(sshd_t, sshd_exec_t)
|
|
Chris PeBenito |
44d5d9 |
')
|
|
Chris PeBenito |
44d5d9 |
|
|
Chris PeBenito |
132880 |
optional_policy(`rpm',`
|
|
Chris PeBenito |
15722e |
rpm_use_script_fds(sshd_t)
|
|
Chris PeBenito |
0404a3 |
')
|
|
Chris PeBenito |
375c24 |
|
|
Chris PeBenito |
375c24 |
ifdef(`TODO',`
|
|
Chris PeBenito |
375c24 |
tunable_policy(`ssh_sysadm_login',`
|
|
Chris PeBenito |
375c24 |
# Relabel and access ptys created by sshd
|
|
Chris PeBenito |
375c24 |
# ioctl is necessary for logout() processing for utmp entry and for w to
|
|
Chris PeBenito |
375c24 |
# display the tty.
|
|
Chris PeBenito |
375c24 |
# some versions of sshd on the new SE Linux require setattr
|
|
Chris PeBenito |
375c24 |
allow sshd_t ptyfile:chr_file relabelto;
|
|
Chris PeBenito |
375c24 |
|
|
Chris PeBenito |
132880 |
optional_policy(`xauth',`
|
|
Chris PeBenito |
375c24 |
domain_trans(sshd_t, xauth_exec_t, userdomain)
|
|
Chris PeBenito |
375c24 |
')
|
|
Chris PeBenito |
375c24 |
',`
|
|
Chris PeBenito |
132880 |
optional_policy(`xauth',`
|
|
Chris PeBenito |
375c24 |
domain_trans(sshd_t, xauth_exec_t, unpriv_userdomain)
|
|
Chris PeBenito |
375c24 |
')
|
|
Chris PeBenito |
375c24 |
# Relabel and access ptys created by sshd
|
|
Chris PeBenito |
375c24 |
# ioctl is necessary for logout() processing for utmp entry and for w to
|
|
Chris PeBenito |
375c24 |
# display the tty.
|
|
Chris PeBenito |
375c24 |
# some versions of sshd on the new SE Linux require setattr
|
|
Chris PeBenito |
375c24 |
allow sshd_t userpty_type:chr_file { relabelto read write getattr ioctl setattr };
|
|
Chris PeBenito |
0404a3 |
')
|
|
Chris PeBenito |
375c24 |
') dnl endif TODO
|
|
Chris PeBenito |
9ccd96 |
')
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
0404a3 |
#################################
|
|
Chris PeBenito |
0404a3 |
#
|
|
Chris PeBenito |
0404a3 |
# sshd_extern local policy
|
|
Chris PeBenito |
0404a3 |
#
|
|
Chris PeBenito |
0404a3 |
# sshd_extern_t is the domain for ssh from outside our network
|
|
Chris PeBenito |
0404a3 |
#
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
ifdef(`targeted_policy',`',`
|
|
Chris PeBenito |
375c24 |
ifdef(`TODO',`
|
|
Chris PeBenito |
375c24 |
domain_trans(sshd_extern_t, shell_exec_t, user_mini_domain)
|
|
Chris PeBenito |
375c24 |
# Signal the user domains.
|
|
Chris PeBenito |
375c24 |
allow sshd_extern_t user_mini_domain:process signal;
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
ifdef(`xauth.te', `
|
|
Chris PeBenito |
375c24 |
domain_trans(sshd_extern_t, xauth_exec_t, user_mini_domain)
|
|
Chris PeBenito |
375c24 |
')
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
# Relabel and access ptys created by sshd
|
|
Chris PeBenito |
375c24 |
# ioctl is necessary for logout() processing for utmp entry and for w to
|
|
Chris PeBenito |
375c24 |
# display the tty.
|
|
Chris PeBenito |
375c24 |
# some versions of sshd on the new SE Linux require setattr
|
|
Chris PeBenito |
375c24 |
allow sshd_extern_t user_mini_domain:chr_file { relabelto read write getattr ioctl setattr };
|
|
Chris PeBenito |
375c24 |
|
|
Chris PeBenito |
375c24 |
# inheriting stream sockets is needed for "ssh host command" as no pty
|
|
Chris PeBenito |
375c24 |
# is allocated
|
|
Chris PeBenito |
375c24 |
allow user_mini_domain sshd_extern_t:unix_stream_socket rw_stream_socket_perms;
|
|
Chris PeBenito |
375c24 |
|
|
Chris PeBenito |
132880 |
optional_policy(`inetd',`
|
|
Chris PeBenito |
375c24 |
tunable_policy(`run_ssh_inetd',`
|
|
Chris PeBenito |
375c24 |
domain_trans(inetd_t, sshd_exec_t, sshd_extern_t)
|
|
Chris PeBenito |
375c24 |
',`
|
|
Chris PeBenito |
375c24 |
domain_trans(initrc_t, sshd_exec_t, sshd_extern_t)
|
|
Chris PeBenito |
375c24 |
')
|
|
Chris PeBenito |
9ccd96 |
',`
|
|
Chris PeBenito |
375c24 |
# These rules should match the else block
|
|
Chris PeBenito |
375c24 |
# of the run_ssh_inetd tunable directly above
|
|
Chris PeBenito |
0404a3 |
domain_trans(initrc_t, sshd_exec_t, sshd_extern_t)
|
|
Chris PeBenito |
9ccd96 |
')
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
ifdef(`direct_sysadm_daemon', `
|
|
Chris PeBenito |
375c24 |
# Direct execution by sysadm_r.
|
|
Chris PeBenito |
375c24 |
domain_auto_trans(sysadm_t, sshd_exec_t, sshd_t)
|
|
Chris PeBenito |
375c24 |
role_transition sysadm_r sshd_exec_t system_r;
|
|
Chris PeBenito |
375c24 |
')
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
# for port forwarding
|
|
Chris PeBenito |
375c24 |
allow userdomain sshd_t:tcp_socket { connectto recvfrom };
|
|
Chris PeBenito |
375c24 |
allow sshd_t userdomain:tcp_socket { acceptfrom recvfrom };
|
|
Chris PeBenito |
375c24 |
allow userdomain kernel_t:tcp_socket recvfrom;
|
|
Chris PeBenito |
375c24 |
allow sshd_t kernel_t:tcp_socket recvfrom;
|
|
Chris PeBenito |
375c24 |
') dnl endif TODO
|
|
Chris PeBenito |
375c24 |
')
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
0404a3 |
########################################
|
|
Chris PeBenito |
0404a3 |
#
|
|
Chris PeBenito |
0404a3 |
# ssh_keygen local policy
|
|
Chris PeBenito |
0404a3 |
#
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
ifdef(`targeted_policy',`',`
|
|
Chris PeBenito |
375c24 |
# ssh_keygen_t is the type of the ssh-keygen program when run at install time
|
|
Chris PeBenito |
375c24 |
# and by sysadm_t
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
dontaudit ssh_keygen_t self:capability sys_tty_config;
|
|
Chris PeBenito |
375c24 |
allow ssh_keygen_t self:process { sigchld sigkill sigstop signull signal };
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
allow ssh_keygen_t self:unix_stream_socket create_stream_socket_perms;
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
allow ssh_keygen_t sshd_key_t:file create_file_perms;
|
|
Chris PeBenito |
103fe2 |
files_etc_filetrans(ssh_keygen_t,sshd_key_t,file)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
445522 |
kernel_read_kernel_sysctls(ssh_keygen_t)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
fs_search_auto_mountpoints(ssh_keygen_t)
|
|
Chris PeBenito |
ab940a |
|
|
Chris PeBenito |
375c24 |
dev_read_sysfs(ssh_keygen_t)
|
|
Chris PeBenito |
375c24 |
dev_read_urand(ssh_keygen_t)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
term_dontaudit_use_console(ssh_keygen_t)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
15722e |
domain_use_interactive_fds(ssh_keygen_t)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
files_read_etc_files(ssh_keygen_t)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
init_use_fd(ssh_keygen_t)
|
|
Chris PeBenito |
1815ba |
init_use_script_ptys(ssh_keygen_t)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
libs_use_ld_so(ssh_keygen_t)
|
|
Chris PeBenito |
375c24 |
libs_use_shared_libs(ssh_keygen_t)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
logging_send_syslog_msg(ssh_keygen_t)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
allow ssh_keygen_t proc_t:dir r_dir_perms;
|
|
Chris PeBenito |
375c24 |
allow ssh_keygen_t proc_t:lnk_file read;
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
1815ba |
userdom_use_sysadm_ttys(ssh_keygen_t)
|
|
Chris PeBenito |
15722e |
userdom_dontaudit_use_unpriv_user_fds(ssh_keygen_t)
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
# cjp: with the old daemon_(base_)domain being broken up into
|
|
Chris PeBenito |
375c24 |
# a daemon and system interface, this probably is not needed:
|
|
Chris PeBenito |
375c24 |
ifdef(`direct_sysadm_daemon',`
|
|
Chris PeBenito |
375c24 |
userdom_dontaudit_use_sysadm_terms(ssh_keygen_t)
|
|
Chris PeBenito |
375c24 |
')
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
375c24 |
ifdef(`targeted_policy', `
|
|
Chris PeBenito |
1815ba |
term_dontaudit_use_unallocated_ttys(ssh_keygen_t)
|
|
Chris PeBenito |
1815ba |
term_dontaudit_use_generic_ptys(ssh_keygen_t)
|
|
Chris PeBenito |
9e04f5 |
files_dontaudit_read_root_files(ssh_keygen_t)
|
|
Chris PeBenito |
375c24 |
')
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
132880 |
optional_policy(`selinuxutil',`
|
|
Chris PeBenito |
375c24 |
seutil_sigchld_newrole(ssh_keygen_t)
|
|
Chris PeBenito |
375c24 |
')
|
|
Chris PeBenito |
0404a3 |
|
|
Chris PeBenito |
132880 |
optional_policy(`udev',`
|
|
Chris PeBenito |
375c24 |
udev_read_db(ssh_keygen_t)
|
|
Chris PeBenito |
375c24 |
')
|
|
Chris PeBenito |
c0d156 |
')
|