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 f66a1a
files_make_file(chkpwd_exec_t)
Chris PeBenito 3ba13b
Chris PeBenito 3ba13b
type faillog_t;
Chris PeBenito 3ba13b
logging_make_log_file(faillog_t)
Chris PeBenito 3ba13b
Chris PeBenito b4cd15
type lastlog_t;
Chris PeBenito b4cd15
logging_make_log_file(lastlog_t)
Chris PeBenito b4cd15
Chris PeBenito 3ba13b
type login_exec_t;
Chris PeBenito 3ba13b
files_make_file(login_exec_t)
Chris PeBenito 3ba13b
Chris PeBenito 07d6e3
type pam_console_t;
Chris PeBenito 07d6e3
type pam_console_exec_t;
Chris PeBenito ff3138
init_make_system_domain(pam_console_t,pam_console_exec_t)
Chris PeBenito 75a10b
role system_r types pam_console_t;
Chris PeBenito 75a10b
Chris PeBenito 07d6e3
domain_make_entrypoint_file(pam_console_t,pam_console_exec_t)
Chris PeBenito 07d6e3
Chris PeBenito 3ce6cb
type pam_t; #, nscd_client_domain;
Chris PeBenito 3ba13b
domain_make_domain(pam_t)
Chris PeBenito 3ce6cb
role system_r types pam_t;
Chris PeBenito 3ba13b
Chris PeBenito 07d6e3
type pam_exec_t;
Chris PeBenito 07d6e3
domain_make_entrypoint_file(pam_t,pam_exec_t)
Chris PeBenito 07d6e3
Chris PeBenito 3ba13b
type pam_tmp_t;
Chris PeBenito 38e24a
files_make_temporary_file(pam_tmp_t)
Chris PeBenito 3ba13b
Chris PeBenito 75a10b
type pam_var_console_t; #, nscd_client_domain
Chris PeBenito 3ba13b
files_make_file(pam_var_console_t)
Chris PeBenito 3ba13b
Chris PeBenito 3ba13b
type pam_var_run_t;
Chris PeBenito d25dd9
files_make_daemon_runtime_file(pam_var_run_t)
Chris PeBenito 3ba13b
Chris PeBenito 3ba13b
type shadow_t;
Chris PeBenito 3ba13b
files_make_file(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 5c1621
domain_make_domain(system_chkpwd_t)
Chris PeBenito 5c1621
domain_make_entrypoint_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 3ba13b
domain_make_domain(utempter_t)
Chris PeBenito 3ba13b
Chris PeBenito 3ba13b
type utempter_exec_t;
Chris PeBenito 3ba13b
domain_make_entrypoint_file(utempter_t,utempter_exec_t)
Chris PeBenito 3ba13b
Chris PeBenito b4cd15
type wtmp_t;
Chris PeBenito b4cd15
logging_make_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 3ce6cb
allow pam_t self:fifo_file { read getattr lock ioctl write append };
Chris PeBenito 3ce6cb
allow pam_t self:unix_dgram_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
Chris PeBenito 3ce6cb
allow pam_t self:unix_stream_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown listen accept };
Chris PeBenito 3ce6cb
allow pam_t self:unix_dgram_socket sendto;
Chris PeBenito 3ce6cb
allow pam_t self:unix_stream_socket connectto;
Chris PeBenito 3ce6cb
allow pam_t self:shm { associate getattr setattr create destroy read write lock unix_read unix_write };
Chris PeBenito 3ce6cb
allow pam_t self:sem { associate getattr setattr create destroy read write unix_read unix_write };
Chris PeBenito 3ce6cb
allow pam_t self:msgq { associate getattr setattr create destroy read write enqueue unix_read unix_write };
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 3ce6cb
allow pam_t pam_tmp_t:dir { create read getattr lock setattr ioctl link unlink rename search add_name remove_name reparent write rmdir };
Chris PeBenito 3ce6cb
allow pam_t pam_tmp_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 3ce6cb
files_create_private_tmp_data(pam_t, pam_tmp_t, { file dir })
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
kernel_read_system_state(pam_t)
Chris PeBenito 3ce6cb
Chris PeBenito b16c6b
terminal_use_all_private_physical_terminals(pam_t)
Chris PeBenito b16c6b
terminal_use_all_private_pseudoterminals(pam_t)
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
init_script_ignore_modify_runtime_data(pam_t)
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
files_read_general_system_config(pam_t)
Chris PeBenito 3ce6cb
files_read_runtime_data_directory(pam_t)
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
libraries_use_dynamic_loader(pam_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(pam_t)
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
logging_send_system_log_message(pam_t)
Chris PeBenito 3ce6cb
Chris PeBenito dc771f
userdomain_use_all_unprivileged_users_file_descriptors(pam_t)
Chris PeBenito dc771f
Chris PeBenito 3ce6cb
optional_policy(`locallogin.te',`
Chris PeBenito 0c73cd
	locallogin_use_file_descriptors(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 75a10b
allow pam_console_t pam_var_console_t:dir { getattr read search };
Chris PeBenito 75a10b
allow pam_console_t pam_var_console_t:file { read getattr };
Chris PeBenito 75a10b
allow pam_console_t pam_var_console_t:lnk_file { getattr read };
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 75a10b
kernel_read_hardware_state(pam_console_t)
Chris PeBenito 75a10b
kernel_use_file_descriptors(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito 75a10b
# Allow to set attributes on /dev entries
Chris PeBenito 75a10b
storage_get_fixed_disk_attributes(pam_console_t)
Chris PeBenito 75a10b
storage_set_fixed_disk_attributes(pam_console_t)
Chris PeBenito 75a10b
storage_get_removable_device_attributes(pam_console_t)
Chris PeBenito 75a10b
storage_set_removable_device_attributes(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito 75a10b
terminal_use_console(pam_console_t)
Chris PeBenito 7bba9d
terminal_get_general_physical_terminal_attributes(pam_console_t)
Chris PeBenito 7bba9d
terminal_set_general_physical_terminal_attributes(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito 75a10b
init_use_file_descriptors(pam_console_t)
Chris PeBenito 75a10b
init_use_file_descriptors(pam_console_t)
Chris PeBenito 75a10b
init_script_use_pseudoterminal(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito 75a10b
domain_use_widely_inheritable_file_descriptors(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito 75a10b
files_read_general_system_config(pam_console_t)
Chris PeBenito 75a10b
files_search_runtime_data_directory(pam_console_t)
Chris PeBenito d490eb
files_read_mnt_dir(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito 75a10b
libraries_use_dynamic_loader(pam_console_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito 75a10b
logging_send_system_log_message(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito 75a10b
selinux_read_file_contexts(pam_console_t)
Chris PeBenito 75a10b
Chris PeBenito dc771f
userdomain_ignore_use_all_unprivileged_users_file_descriptors(pam_console_t)
Chris PeBenito dc771f
Chris PeBenito 763c44
ifdef(`direct_sysadm_daemon', `
Chris PeBenito 763c44
	userdomain_dontaudit_use_admin_terminals(pam_console_t)
Chris PeBenito 75a10b
')
Chris PeBenito 75a10b
Chris PeBenito 254bbc
ifdef(`targeted_policy', `
Chris PeBenito 0c73cd
	terminal_ignore_use_general_physical_terminal(pam_console_t)
Chris PeBenito 0c73cd
	terminal_ignore_use_general_pseudoterminal(pam_console_t)
Chris PeBenito 0c73cd
	files_ignore_read_rootfs_file(pam_console_t)
Chris PeBenito 75a10b
')
Chris PeBenito 75a10b
Chris PeBenito 1e5c2a
optional_policy(`hotplug.te', `
Chris PeBenito 0c73cd
	hotplug_use_file_descriptors(pam_console_t)
Chris PeBenito 0c73cd
	hotplug_ignore_search_config_directory(pam_console_t)
Chris PeBenito 1e5c2a
')
Chris PeBenito 1e5c2a
Chris PeBenito 75a10b
optional_policy(`selinux.te',`
Chris PeBenito 75a10b
selinux_newrole_sigchld(pam_console_t)
Chris PeBenito 75a10b
')
Chris PeBenito 75a10b
Chris PeBenito 75a10b
optional_policy(`udev.te', `
Chris PeBenito 0c73cd
	udev_read_database(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 763c44
fs_ignore_get_persistent_fs_attributes(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 5c1621
terminal_use_general_physical_terminal(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 5c1621
files_read_general_system_config(system_chkpwd_t)
Chris PeBenito 5c1621
# for nscd
Chris PeBenito 5c1621
files_ignore_search_system_state_data_directory(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 5c1621
libraries_use_dynamic_loader(system_chkpwd_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 5c1621
logging_send_system_log_message(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 5c1621
miscfiles_read_localization(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 5c1621
selinux_read_config(system_chkpwd_t)
Chris PeBenito 5c1621
Chris PeBenito 5c1621
tunable_policy(`use_dns',`
Chris PeBenito 0c73cd
	allow system_chkpwd_t self:udp_socket { create ioctl read getattr write setattr append bind getopt setopt shutdown connect };
Chris PeBenito 0c73cd
	corenetwork_sendrecv_udp_on_all_interfaces(system_chkpwd_t)
Chris PeBenito 0c73cd
	corenetwork_sendrecv_raw_on_all_interfaces(system_chkpwd_t)
Chris PeBenito 0c73cd
	corenetwork_sendrecv_udp_on_all_nodes(system_chkpwd_t)
Chris PeBenito 0c73cd
	corenetwork_sendrecv_raw_on_all_nodes(system_chkpwd_t)
Chris PeBenito 0c73cd
	corenetwork_bind_udp_on_all_nodes(system_chkpwd_t)
Chris PeBenito 0c73cd
	corenetwork_sendrecv_udp_on_dns_port(system_chkpwd_t)
Chris PeBenito 0c73cd
	sysnetwork_read_network_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 3ce6cb
allow utempter_t self:unix_stream_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown listen accept };
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
allow utempter_t wtmp_t:file { ioctl read getattr lock write append };
Chris PeBenito 3ce6cb
Chris PeBenito b16c6b
terminal_get_all_private_physical_terminal_attributes(utempter_t)
Chris PeBenito b16c6b
terminal_get_all_private_pseudoterminal_attributes(utempter_t)
Chris PeBenito b16c6b
terminal_ignore_use_all_private_physical_terminals(utempter_t)
Chris PeBenito b16c6b
terminal_ignore_use_all_private_pseudoterminals(utempter_t)
Chris PeBenito 1e5c2a
terminal_ignore_use_pseudoterminal_multiplexer(utempter_t)
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
init_script_modify_runtime_data(utempter_t)
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
files_read_general_system_config(utempter_t)
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
domain_use_widely_inheritable_file_descriptors(utempter_t)
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
libraries_use_dynamic_loader(utempter_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(utempter_t)
Chris PeBenito 3ce6cb
Chris PeBenito 3ce6cb
logging_search_system_log_directory(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