Chris PeBenito 17de1b
Chris PeBenito 17de1b
policy_module(locallogin,1.2.3)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Declarations
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type local_login_t;
Chris PeBenito 17de1b
auth_login_entry_type(local_login_t)
Chris PeBenito 17de1b
domain_type(local_login_t)
Chris PeBenito 17de1b
domain_obj_id_change_exemption(local_login_t)
Chris PeBenito 17de1b
domain_subj_id_change_exemption(local_login_t)
Chris PeBenito 17de1b
domain_role_change_exemption(local_login_t)
Chris PeBenito 17de1b
domain_interactive_fd(local_login_t)
Chris PeBenito 17de1b
role system_r types local_login_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type local_login_lock_t;
Chris PeBenito 17de1b
files_lock_file(local_login_lock_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type local_login_tmp_t;
Chris PeBenito 17de1b
files_tmp_file(local_login_tmp_t)
Chris PeBenito 17de1b
files_poly_parent(local_login_tmp_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
type sulogin_t;
Chris PeBenito 17de1b
type sulogin_exec_t;
Chris PeBenito 17de1b
domain_obj_id_change_exemption(sulogin_t)
Chris PeBenito 17de1b
domain_subj_id_change_exemption(sulogin_t)
Chris PeBenito 17de1b
domain_role_change_exemption(sulogin_t)
Chris PeBenito 17de1b
domain_interactive_fd(sulogin_t)
Chris PeBenito 17de1b
init_domain(sulogin_t,sulogin_exec_t)
Chris PeBenito 17de1b
init_system_domain(sulogin_t,sulogin_exec_t)
Chris PeBenito 17de1b
role system_r types sulogin_t;
Chris PeBenito 17de1b
Chris PeBenito 17de1b
########################################
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
# Local login local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow local_login_t self:capability { dac_override chown fowner fsetid kill setgid setuid sys_nice sys_resource sys_tty_config };
Chris PeBenito 17de1b
allow local_login_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
Chris PeBenito 17de1b
allow local_login_t self:process { setrlimit setexec };
Chris PeBenito 17de1b
allow local_login_t self:fd use;
Chris PeBenito 17de1b
allow local_login_t self:fifo_file rw_file_perms;
Chris PeBenito 17de1b
allow local_login_t self:sock_file r_file_perms;
Chris PeBenito 17de1b
allow local_login_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow local_login_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow local_login_t self:unix_dgram_socket sendto;
Chris PeBenito 17de1b
allow local_login_t self:unix_stream_socket connectto;
Chris PeBenito 17de1b
allow local_login_t self:shm create_shm_perms;
Chris PeBenito 17de1b
allow local_login_t self:sem create_sem_perms;
Chris PeBenito 17de1b
allow local_login_t self:msgq create_msgq_perms;
Chris PeBenito 17de1b
allow local_login_t self:msg { send receive };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow local_login_t local_login_lock_t:file create_file_perms;
Chris PeBenito 17de1b
files_lock_filetrans(local_login_t,local_login_lock_t,file)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow local_login_t local_login_tmp_t:dir create_dir_perms;
Chris PeBenito 17de1b
allow local_login_t local_login_tmp_t:file create_file_perms;
Chris PeBenito 17de1b
files_tmp_filetrans(local_login_t, local_login_tmp_t, { file dir })
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_system_state(local_login_t)
Chris PeBenito 17de1b
kernel_read_kernel_sysctls(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
dev_setattr_mouse_dev(local_login_t)
Chris PeBenito 17de1b
dev_getattr_mouse_dev(local_login_t)
Chris PeBenito 17de1b
dev_getattr_power_mgmt_dev(local_login_t)
Chris PeBenito 17de1b
dev_setattr_power_mgmt_dev(local_login_t)
Chris PeBenito 17de1b
dev_getattr_sound_dev(local_login_t)
Chris PeBenito 17de1b
dev_setattr_sound_dev(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_getattr_apm_bios_dev(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_setattr_apm_bios_dev(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_read_framebuffer(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_setattr_framebuffer_dev(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_getattr_generic_blk_files(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_setattr_generic_blk_files(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_getattr_generic_chr_files(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_setattr_generic_chr_files(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_setattr_generic_symlinks(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_getattr_misc_dev(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_setattr_misc_dev(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_getattr_scanner_dev(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_setattr_scanner_dev(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_search_sysfs(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_getattr_video_dev(local_login_t)
Chris PeBenito 17de1b
dev_dontaudit_setattr_video_dev(local_login_t)
Chris PeBenito 17de1b
# for SSP/ProPolice
Chris PeBenito 17de1b
dev_read_urand(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_search_auto_mountpoints(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
selinux_get_fs_mount(local_login_t)
Chris PeBenito 17de1b
selinux_validate_context(local_login_t)
Chris PeBenito 17de1b
selinux_compute_access_vector(local_login_t)
Chris PeBenito 17de1b
selinux_compute_create_context(local_login_t)
Chris PeBenito 17de1b
selinux_compute_relabel_context(local_login_t)
Chris PeBenito 17de1b
selinux_compute_user_contexts(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
storage_dontaudit_getattr_fixed_disk_dev(local_login_t)
Chris PeBenito 17de1b
storage_dontaudit_setattr_fixed_disk_dev(local_login_t)
Chris PeBenito 17de1b
storage_dontaudit_getattr_removable_dev(local_login_t)
Chris PeBenito 17de1b
storage_dontaudit_setattr_removable_dev(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
term_use_all_user_ttys(local_login_t)
Chris PeBenito 17de1b
term_use_unallocated_ttys(local_login_t)
Chris PeBenito 17de1b
term_relabel_unallocated_ttys(local_login_t)
Chris PeBenito 17de1b
term_relabel_all_user_ttys(local_login_t)
Chris PeBenito 17de1b
term_setattr_all_user_ttys(local_login_t)
Chris PeBenito 17de1b
term_setattr_unallocated_ttys(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
auth_domtrans_chk_passwd(local_login_t)
Chris PeBenito 17de1b
auth_dontaudit_read_shadow(local_login_t)
Chris PeBenito 17de1b
auth_rw_login_records(local_login_t)
Chris PeBenito 17de1b
auth_rw_lastlog(local_login_t)
Chris PeBenito 17de1b
auth_rw_faillog(local_login_t)
Chris PeBenito 17de1b
auth_exec_pam(local_login_t)
Chris PeBenito 17de1b
auth_manage_pam_console_data(local_login_t)
Chris PeBenito 17de1b
auth_domtrans_pam_console(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
corecmd_list_bin(local_login_t)
Chris PeBenito 17de1b
corecmd_list_sbin(local_login_t)
Chris PeBenito 17de1b
corecmd_read_bin_symlinks(local_login_t)
Chris PeBenito 17de1b
corecmd_read_sbin_symlinks(local_login_t)
Chris PeBenito 17de1b
# cjp: these are probably not needed:
Chris PeBenito 17de1b
corecmd_read_bin_files(local_login_t)
Chris PeBenito 17de1b
corecmd_read_bin_pipes(local_login_t)
Chris PeBenito 17de1b
corecmd_read_bin_sockets(local_login_t)
Chris PeBenito 17de1b
corecmd_read_sbin_files(local_login_t)
Chris PeBenito 17de1b
corecmd_read_sbin_pipes(local_login_t)
Chris PeBenito 17de1b
corecmd_read_sbin_sockets(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
domain_read_all_entry_files(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(local_login_t)
Chris PeBenito 17de1b
files_read_etc_runtime_files(local_login_t)
Chris PeBenito 17de1b
files_read_usr_files(local_login_t)
Chris PeBenito 17de1b
files_list_mnt(local_login_t)
Chris PeBenito 17de1b
files_list_world_readable(local_login_t)
Chris PeBenito 17de1b
files_read_world_readable_files(local_login_t)
Chris PeBenito 17de1b
files_read_world_readable_symlinks(local_login_t)
Chris PeBenito 17de1b
files_read_world_readable_pipes(local_login_t)
Chris PeBenito 17de1b
files_read_world_readable_sockets(local_login_t)
Chris PeBenito 17de1b
# for when /var/mail is a symlink
Chris PeBenito 17de1b
files_read_var_symlinks(local_login_t)
Chris PeBenito 17de1b
# Login can polyinstantiate
Chris PeBenito 17de1b
files_polyinstantiate_all(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_rw_utmp(local_login_t)
Chris PeBenito 17de1b
init_dontaudit_use_fds(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(local_login_t)
Chris PeBenito 17de1b
libs_use_shared_libs(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
miscfiles_read_localization(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
mls_file_read_up(local_login_t)
Chris PeBenito 17de1b
mls_file_write_down(local_login_t)
Chris PeBenito 17de1b
mls_file_upgrade(local_login_t)
Chris PeBenito 17de1b
mls_file_downgrade(local_login_t)
Chris PeBenito 17de1b
mls_process_set_level(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
seutil_read_config(local_login_t)
Chris PeBenito 17de1b
seutil_read_default_contexts(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_spec_domtrans_all_users(local_login_t)
Chris PeBenito 17de1b
userdom_signal_all_users(local_login_t)
Chris PeBenito 17de1b
userdom_search_all_users_home_content(local_login_t)
Chris PeBenito 17de1b
userdom_use_unpriv_users_fds(local_login_t)
Chris PeBenito 17de1b
userdom_sigchld_all_users(local_login_t)
Chris PeBenito 17de1b
userdom_create_all_users_keys(local_login_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`targeted_policy',`
Chris PeBenito 17de1b
	unconfined_domain(local_login_t)
Chris PeBenito 17de1b
	unconfined_shell_domtrans(local_login_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`read_default_t',`
Chris PeBenito 17de1b
	files_list_default(local_login_t)
Chris PeBenito 17de1b
	files_read_default_files(local_login_t)
Chris PeBenito 17de1b
	files_read_default_symlinks(local_login_t)
Chris PeBenito 17de1b
	files_read_default_sockets(local_login_t)
Chris PeBenito 17de1b
	files_read_default_pipes(local_login_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito 17de1b
	fs_read_nfs_files(local_login_t)
Chris PeBenito 17de1b
	fs_read_nfs_symlinks(local_login_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
tunable_policy(`use_samba_home_dirs',`
Chris PeBenito 17de1b
	fs_read_cifs_files(local_login_t)
Chris PeBenito 17de1b
	fs_read_cifs_symlinks(local_login_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	gpm_getattr_gpmctl(local_login_t)
Chris PeBenito 17de1b
	gpm_setattr_gpmctl(local_login_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	# Search for mail spool file.
Chris PeBenito 17de1b
	mta_getattr_spool(local_login_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nis_use_ypbind(local_login_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nscd_socket_use(local_login_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	usermanage_read_crack_db(local_login_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	alsa_domtrans(local_login_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
#################################
Chris PeBenito 17de1b
# 
Chris PeBenito 17de1b
# Sulogin local policy
Chris PeBenito 17de1b
#
Chris PeBenito 17de1b
Chris PeBenito 17de1b
allow sulogin_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
Chris PeBenito 17de1b
allow sulogin_t self:fd use;
Chris PeBenito 17de1b
allow sulogin_t self:fifo_file rw_file_perms;
Chris PeBenito 17de1b
allow sulogin_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 17de1b
allow sulogin_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 17de1b
allow sulogin_t self:unix_dgram_socket sendto;
Chris PeBenito 17de1b
allow sulogin_t self:unix_stream_socket connectto;
Chris PeBenito 17de1b
allow sulogin_t self:shm create_shm_perms;
Chris PeBenito 17de1b
allow sulogin_t self:sem create_sem_perms;
Chris PeBenito 17de1b
allow sulogin_t self:msgq create_msgq_perms;
Chris PeBenito 17de1b
allow sulogin_t self:msg { send receive };
Chris PeBenito 17de1b
Chris PeBenito 17de1b
kernel_read_system_state(sulogin_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
fs_search_auto_mountpoints(sulogin_t)
Chris PeBenito 17de1b
fs_rw_tmpfs_chr_files(sulogin_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
files_read_etc_files(sulogin_t)
Chris PeBenito 17de1b
# because file systems are not mounted:
Chris PeBenito 17de1b
files_dontaudit_search_isid_type_dirs(sulogin_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
init_getpgid_script(sulogin_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
libs_use_ld_so(sulogin_t)
Chris PeBenito 17de1b
libs_use_shared_libs(sulogin_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
logging_send_syslog_msg(sulogin_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
seutil_read_config(sulogin_t)
Chris PeBenito 17de1b
seutil_read_default_contexts(sulogin_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
auth_read_shadow(sulogin_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
userdom_shell_domtrans_sysadm(sulogin_t)
Chris PeBenito 17de1b
userdom_use_unpriv_users_fds(sulogin_t)
Chris PeBenito 17de1b
userdom_use_sysadm_ptys(sulogin_t)
Chris PeBenito 17de1b
userdom_search_staff_home_dirs(sulogin_t)
Chris PeBenito 17de1b
userdom_search_sysadm_home_dirs(sulogin_t)
Chris PeBenito 17de1b
Chris PeBenito 17de1b
# suse and debian do not use pam with sulogin...
Chris PeBenito 17de1b
ifdef(`distro_suse', `define(`sulogin_no_pam')')
Chris PeBenito 17de1b
ifdef(`distro_debian', `define(`sulogin_no_pam')')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
ifdef(`sulogin_no_pam', `
Chris PeBenito 17de1b
	allow sulogin_t self:capability sys_tty_config;
Chris PeBenito 17de1b
	init_getpgid(sulogin_t)
Chris PeBenito 17de1b
', `
Chris PeBenito 17de1b
	allow sulogin_t self:process setexec;
Chris PeBenito 17de1b
	selinux_get_fs_mount(sulogin_t)
Chris PeBenito 17de1b
	selinux_validate_context(sulogin_t)
Chris PeBenito 17de1b
	selinux_compute_access_vector(sulogin_t)
Chris PeBenito 17de1b
	selinux_compute_create_context(sulogin_t)
Chris PeBenito 17de1b
	selinux_compute_relabel_context(sulogin_t)
Chris PeBenito 17de1b
	selinux_compute_user_contexts(sulogin_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nis_use_ypbind(sulogin_t)
Chris PeBenito 17de1b
')
Chris PeBenito 17de1b
Chris PeBenito 17de1b
optional_policy(`
Chris PeBenito 17de1b
	nscd_socket_use(sulogin_t)
Chris PeBenito 17de1b
')