Chris PeBenito e181fe
Chris PeBenito 960373
policy_module(authlogin,1.0)
Chris PeBenito 960373
Chris PeBenito 3ba13b
########################################
Chris PeBenito 3ba13b
#
Chris PeBenito 3ba13b
# Declarations
Chris PeBenito 3ba13b
#
Chris PeBenito 7bba9d
Chris PeBenito 7bba9d
attribute can_read_shadow_passwords;
Chris PeBenito 7bba9d
attribute can_write_shadow_passwords;
Chris PeBenito 7bba9d
attribute can_relabelto_shadow_passwords;
Chris PeBenito 7bba9d
Chris PeBenito 3ba13b
type chkpwd_exec_t;
Chris PeBenito c9428d
files_file_type(chkpwd_exec_t)
Chris PeBenito 3ba13b
Chris PeBenito 3ba13b
type faillog_t;
Chris PeBenito c9428d
logging_log_file(faillog_t)
Chris PeBenito 3ba13b
Chris PeBenito b4cd15
type lastlog_t;
Chris PeBenito c9428d
logging_log_file(lastlog_t)
Chris PeBenito b4cd15
Chris PeBenito 3ba13b
type login_exec_t;
Chris PeBenito c9428d
files_file_type(login_exec_t)
Chris PeBenito 3ba13b
Chris PeBenito 07d6e3
type pam_console_t;
Chris PeBenito 07d6e3
type pam_console_exec_t;
Chris PeBenito c9428d
init_system_domain(pam_console_t,pam_console_exec_t)
Chris PeBenito 75a10b
role system_r types pam_console_t;
Chris PeBenito 75a10b
Chris PeBenito c9428d
domain_entry_file(pam_console_t,pam_console_exec_t)
Chris PeBenito 07d6e3
Chris PeBenito 3ce6cb
type pam_t; #, nscd_client_domain;
Chris PeBenito c9428d
domain_type(pam_t)
Chris PeBenito 3ce6cb
role system_r types pam_t;
Chris PeBenito 3ba13b
Chris PeBenito 07d6e3
type pam_exec_t;
Chris PeBenito c9428d
domain_entry_file(pam_t,pam_exec_t)
Chris PeBenito 07d6e3
Chris PeBenito 3ba13b
type pam_tmp_t;
Chris PeBenito c9428d
files_tmp_file(pam_tmp_t)
Chris PeBenito 3ba13b
Chris PeBenito 75a10b
type pam_var_console_t; #, nscd_client_domain
Chris PeBenito c9428d
files_file_type(pam_var_console_t)
Chris PeBenito 3ba13b
Chris PeBenito 3ba13b
type pam_var_run_t;
Chris PeBenito c9428d
files_pid_file(pam_var_run_t)
Chris PeBenito 3ba13b
Chris PeBenito 3ba13b
type shadow_t;
Chris PeBenito c9428d
files_file_type(shadow_t)
Chris PeBenito 3ba13b
neverallow ~can_read_shadow_passwords shadow_t:file read;
Chris PeBenito a1f94a
neverallow ~can_write_shadow_passwords shadow_t:file { create write };
Chris PeBenito a1f94a
neverallow ~can_relabelto_shadow_passwords shadow_t:file relabelto;
Chris PeBenito 3ba13b
Chris PeBenito 5c1621
type system_chkpwd_t, can_read_shadow_passwords; # , nscd_client_domain;
Chris PeBenito c9428d
domain_type(system_chkpwd_t)
Chris PeBenito c9428d
domain_entry_file(system_chkpwd_t,chkpwd_exec_t)
Chris PeBenito 5c1621
role system_r types system_chkpwd_t;
Chris PeBenito 5c1621
Chris PeBenito 3ce6cb
type utempter_t; #, nscd_client_domain;
Chris PeBenito c9428d
domain_type(utempter_t)
Chris PeBenito 3ba13b
Chris PeBenito 3ba13b
type utempter_exec_t;
Chris PeBenito c9428d
domain_entry_file(utempter_t,utempter_exec_t)
Chris PeBenito 3ba13b
Chris PeBenito b4cd15
type wtmp_t;
Chris PeBenito c9428d
logging_log_file(wtmp_t)
Chris PeBenito 3ba13b
Chris PeBenito 3ba13b
########################################
Chris PeBenito 3ba13b
#
Chris PeBenito 3ce6cb
# PAM local policy
Chris PeBenito 3ba13b
#
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
allow pam_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
Chris PeBenito 3ce6cb
dontaudit pam_t self:capability sys_tty_config;
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
allow pam_t self:fd use;
Chris PeBenito dd8229
allow pam_t self:fifo_file rw_file_perms;
Chris PeBenito dd8229
allow pam_t self:unix_dgram_socket create_socket_perms; 
Chris PeBenito dd8229
allow pam_t self:unix_stream_socket rw_stream_socket_perms;
Chris PeBenito 3ce6cb
allow pam_t self:unix_dgram_socket sendto;
Chris PeBenito 3ce6cb
allow pam_t self:unix_stream_socket connectto;
Chris PeBenito dd8229
allow pam_t self:shm create_shm_perms;
Chris PeBenito dd8229
allow pam_t self:sem create_sem_perms;
Chris PeBenito dd8229
allow pam_t self:msgq create_msgq_perms;
Chris PeBenito 3ce6cb
allow pam_t self:msg { send receive };
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
allow pam_t pam_var_run_t:dir { search getattr read write remove_name };
Chris PeBenito 3ce6cb
allow pam_t pam_var_run_t:file { getattr read unlink };
Chris PeBenito 3ce6cb
Chris PeBenito dd8229
allow pam_t pam_tmp_t:dir create_dir_perms;
Chris PeBenito dd8229
allow pam_t pam_tmp_t:file create_file_perms;
Chris PeBenito c9428d
files_create_tmp_files(pam_t, pam_tmp_t, { file dir })
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
kernel_read_system_state(pam_t)
Chris PeBenito 3ce6cb
Chris PeBenito 0fd9dc
term_use_all_user_ttys(pam_t)
Chris PeBenito 0fd9dc
term_use_all_user_ptys(pam_t)
Chris PeBenito 3ce6cb
Chris PeBenito c9428d
init_dontaudit_rw_script_pid(pam_t)
Chris PeBenito 3ce6cb
Chris PeBenito c9428d
files_read_generic_etc_files(pam_t)
Chris PeBenito c9428d
files_list_pids(pam_t)
Chris PeBenito 3ce6cb
Chris PeBenito c9428d
libs_use_ld_so(pam_t)
Chris PeBenito c9428d
libs_use_shared_libs(pam_t)
Chris PeBenito 3ce6cb
Chris PeBenito c9428d
logging_send_syslog_msg(pam_t)
Chris PeBenito 3ce6cb
Chris PeBenito c9428d
userdom_use_unpriv_users_fd(pam_t)
Chris PeBenito dc771f
Chris PeBenito 3ce6cb
optional_policy(`locallogin.te',`
Chris PeBenito c9428d
	locallogin_use_fd(pam_t)
Chris PeBenito 3ce6cb
')
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
ifdef(`TODO',`
Chris PeBenito 3ce6cb
can_ypbind(pam_t)
Chris PeBenito 3ce6cb
ifdef(`automount.te', `
Chris PeBenito 0c73cd
	allow pam_t autofs_t:dir { search getattr };
Chris PeBenito 3ce6cb
')
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
ifdef(`gnome-pty-helper.te', `allow pam_t gphdomain:fd use;')
Chris PeBenito 3ce6cb
') dnl endif TODO
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
########################################
Chris PeBenito 3ce6cb
#
Chris PeBenito 75a10b
# PAM console local policy
Chris PeBenito 75a10b
#
Chris PeBenito 75a10b
Chris PeBenito 75a10b
allow pam_console_t self:capability { chown fowner fsetid };
Chris PeBenito 75a10b
dontaudit pam_console_t self:capability sys_tty_config;
Chris PeBenito 75a10b
Chris PeBenito 75a10b
allow pam_console_t self:process { sigchld sigkill sigstop signull signal };
Chris PeBenito 75a10b
Chris PeBenito 75a10b
# for /var/run/console.lock checking
Chris PeBenito dd8229
allow pam_console_t pam_var_console_t:dir r_dir_perms;;
Chris PeBenito dd8229
allow pam_console_t pam_var_console_t:file r_file_perms;
Chris PeBenito dd8229
allow pam_console_t pam_var_console_t:lnk_file r_file_perms;
Chris PeBenito 75a10b
Chris PeBenito 75a10b
kernel_read_kernel_sysctl(pam_console_t)
Chris PeBenito 75a10b
kernel_read_system_state(pam_console_t)
Chris PeBenito 8bd678
dev_read_sysfs(pam_console_t)
Chris PeBenito 0fd9dc
kernel_use_fd(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito 75a10b
# Allow to set attributes on /dev entries
Chris PeBenito 0fd9dc
storage_getattr_fixed_disk(pam_console_t)
Chris PeBenito 0fd9dc
storage_setattr_fixed_disk(pam_console_t)
Chris PeBenito 0fd9dc
storage_getattr_removable_device(pam_console_t)
Chris PeBenito 5a45e7
storage_setattr_removable_device(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito 0fd9dc
term_use_console(pam_console_t)
Chris PeBenito 0fd9dc
term_getattr_unallocated_ttys(pam_console_t)
Chris PeBenito 0fd9dc
term_setattr_unallocated_ttys(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito c9428d
init_use_fd(pam_console_t)
Chris PeBenito c9428d
init_use_script_pty(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito c9428d
domain_use_wide_inherit_fd(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito c9428d
files_read_generic_etc_files(pam_console_t)
Chris PeBenito c9428d
files_search_pids(pam_console_t)
Chris PeBenito c9428d
files_list_mnt(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito c9428d
libs_use_ld_so(pam_console_t)
Chris PeBenito c9428d
libs_use_shared_libs(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito c9428d
logging_send_syslog_msg(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito 5e0da6
seutil_read_file_contexts(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito c9428d
userdom_dontaudit_use_unpriv_user_fd(pam_console_t)
Chris PeBenito dc771f
Chris PeBenito 763c44
ifdef(`direct_sysadm_daemon', `
Chris PeBenito c9428d
	userdom_dontaudit_use_sysadm_terms(pam_console_t)
Chris PeBenito 75a10b
')
Chris PeBenito 75a10b
Chris PeBenito 254bbc
ifdef(`targeted_policy', `
Chris PeBenito 0fd9dc
	term_dontaudit_use_unallocated_tty(pam_console_t)
Chris PeBenito 31908b
	term_dontaudit_use_generic_pty(pam_console_t)
Chris PeBenito c9428d
	files_dontaudit_read_root_file(pam_console_t)
Chris PeBenito 75a10b
')
Chris PeBenito 75a10b
Chris PeBenito 1e5c2a
optional_policy(`hotplug.te', `
Chris PeBenito c9428d
	hotplug_use_fd(pam_console_t)
Chris PeBenito c9428d
	hotplug_dontaudit_search_config(pam_console_t)
Chris PeBenito 1e5c2a
')
Chris PeBenito 1e5c2a
Chris PeBenito 75a10b
optional_policy(`selinux.te',`
Chris PeBenito 5e0da6
	seutil_newrole_sigchld(pam_console_t)
Chris PeBenito 75a10b
')
Chris PeBenito 75a10b
Chris PeBenito 75a10b
optional_policy(`udev.te', `
Chris PeBenito c9428d
	udev_read_db(pam_console_t)
Chris PeBenito 75a10b
')
Chris PeBenito 75a10b
Chris PeBenito 75a10b
ifdef(`TODO',`
Chris PeBenito 75a10b
optional_policy(`rhgb.te', `
Chris PeBenito 0c73cd
	allow pam_console_t rhgb_t:process sigchld;
Chris PeBenito 0c73cd
	allow pam_console_t rhgb_t:fd use;
Chris PeBenito 0c73cd
	allow pam_console_t rhgb_t:fifo_file { read write };
Chris PeBenito 75a10b
')
Chris PeBenito 75a10b
allow pam_console_t autofs_t:dir { search getattr };
Chris PeBenito 75a10b
Chris PeBenito 75a10b
allow pam_console_t { 
Chris PeBenito 75a10b
framebuf_device_t
Chris PeBenito 75a10b
v4l_device_t
Chris PeBenito 75a10b
apm_bios_t
Chris PeBenito 75a10b
sound_device_t
Chris PeBenito 75a10b
misc_device_t
Chris PeBenito 75a10b
scanner_device_t
Chris PeBenito 75a10b
mouse_device_t
Chris PeBenito 75a10b
power_device_t
Chris PeBenito 75a10b
removable_device_t
Chris PeBenito 75a10b
scsi_generic_device_t
Chris PeBenito 75a10b
}:chr_file { getattr setattr };
Chris PeBenito 75a10b
Chris PeBenito 75a10b
ifdef(`gpm.te', `
Chris PeBenito 0c73cd
	allow pam_console_t gpmctl_t:sock_file { getattr setattr };
Chris PeBenito 75a10b
')
Chris PeBenito 75a10b
Chris PeBenito 75a10b
ifdef(`xdm.te', `
Chris PeBenito 0c73cd
	allow pam_console_t xdm_var_run_t:file { getattr read };
Chris PeBenito 75a10b
')
Chris PeBenito 75a10b
') dnl endif TODO
Chris PeBenito 75a10b
Chris PeBenito 75a10b
########################################
Chris PeBenito 75a10b
#
Chris PeBenito f66a1a
# System check password local policy
Chris PeBenito f66a1a
#
Chris PeBenito f66a1a
Chris PeBenito 5c1621
allow system_chkpwd_t self:capability setuid;
Chris PeBenito 5c1621
allow system_chkpwd_t self:process getattr;
Chris PeBenito f66a1a
Chris PeBenito 5c1621
allow system_chkpwd_t shadow_t:file { getattr read };
Chris PeBenito 5c1621
Chris PeBenito 5c1621
# is_selinux_enabled
Chris PeBenito 5c1621
kernel_read_system_state(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 0fd9dc
fs_dontaudit_getattr_xattr_fs(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 0fd9dc
term_use_unallocated_tty(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito c9428d
files_read_generic_etc_files(system_chkpwd_t)
Chris PeBenito 5c1621
# for nscd
Chris PeBenito c9428d
files_dontaudit_search_var(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito c9428d
libs_use_ld_so(system_chkpwd_t)
Chris PeBenito c9428d
libs_use_shared_libs(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito c9428d
logging_send_syslog_msg(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 5c1621
miscfiles_read_localization(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 5e0da6
seutil_read_config(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 5c1621
tunable_policy(`use_dns',`
Chris PeBenito dd8229
	allow system_chkpwd_t self:udp_socket create_socket_perms;
Chris PeBenito 0fd9dc
	corenet_udp_sendrecv_all_if(system_chkpwd_t)
Chris PeBenito 0fd9dc
	corenet_raw_sendrecv_all_if(system_chkpwd_t)
Chris PeBenito 0fd9dc
	corenet_udp_sendrecv_all_nodes(system_chkpwd_t)
Chris PeBenito 0fd9dc
	corenet_raw_sendrecv_all_nodes(system_chkpwd_t)
Chris PeBenito 0fd9dc
	corenet_udp_bind_all_nodes(system_chkpwd_t)
Chris PeBenito 0fd9dc
	corenet_udp_sendrecv_dns_port(system_chkpwd_t)
Chris PeBenito c9428d
	sysnet_read_config(system_chkpwd_t)
Chris PeBenito 5c1621
')
Chris PeBenito 5c1621
Chris PeBenito 5c1621
ifdef(`TODO',`
Chris PeBenito 5c1621
can_ypbind(system_chkpwd_t)
Chris PeBenito 5c1621
can_kerberos(system_chkpwd_t)
Chris PeBenito 5c1621
can_ldap(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 5c1621
dontaudit system_chkpwd_t user_tty_type:chr_file rw_file_perms;
Chris PeBenito 0c73cd
') dnl end TODO
Chris PeBenito f66a1a
Chris PeBenito f66a1a
########################################
Chris PeBenito f66a1a
#
Chris PeBenito 3ce6cb
# Utempter local policy
Chris PeBenito 3ce6cb
#
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
allow utempter_t self:capability setgid;
Chris PeBenito 0fd9dc
allow utempter_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 3ce6cb
Chris PeBenito dd8229
allow utempter_t wtmp_t:file rw_file_perms;
Chris PeBenito 3ce6cb
Chris PeBenito 0fd9dc
term_getattr_all_user_ttys(utempter_t)
Chris PeBenito 0fd9dc
term_getattr_all_user_ptys(utempter_t)
Chris PeBenito 0fd9dc
term_dontaudit_use_all_user_ttys(utempter_t)
Chris PeBenito 0fd9dc
term_dontaudit_use_all_user_ptys(utempter_t)
Chris PeBenito 0fd9dc
term_dontaudit_use_ptmx(utempter_t)
Chris PeBenito 3ce6cb
Chris PeBenito c9428d
init_rw_script_pid(utempter_t)
Chris PeBenito 3ce6cb
Chris PeBenito c9428d
files_read_generic_etc_files(utempter_t)
Chris PeBenito 3ce6cb
Chris PeBenito c9428d
domain_use_wide_inherit_fd(utempter_t)
Chris PeBenito 3ce6cb
Chris PeBenito c9428d
libs_use_ld_so(utempter_t)
Chris PeBenito c9428d
libs_use_shared_libs(utempter_t)
Chris PeBenito 3ce6cb
Chris PeBenito c9428d
logging_search_logs(utempter_t)
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
ifdef(`TODO',`
Chris PeBenito 3ce6cb
# Allow utemper to write to /tmp/.xses-*
Chris PeBenito 3ce6cb
allow utempter_t user_tmpfile:file { getattr write append };
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
ifdef(`xdm.te', `
Chris PeBenito 3ce6cb
allow utempter_t xdm_t:fd use;
Chris PeBenito 3ce6cb
allow utempter_t xdm_t:fifo_file { write getattr };
Chris PeBenito 3ce6cb
')
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
') dnl endif TODO