Chris PeBenito df431c
Chris PeBenito a77e65
policy_module(locallogin,1.0.2)
Chris PeBenito df431c
Chris PeBenito 07efe9
########################################
Chris PeBenito 07efe9
#
Chris PeBenito 07efe9
# Declarations
Chris PeBenito 07efe9
#
Chris PeBenito 07efe9
Chris PeBenito f0574f
type local_login_t;
Chris PeBenito d35c62
auth_login_entry_type(local_login_t)
Chris PeBenito d35c62
domain_type(local_login_t)
Chris PeBenito 8bd678
domain_obj_id_change_exempt(local_login_t)
Chris PeBenito 8bd678
domain_subj_id_change_exempt(local_login_t)
Chris PeBenito 8bd678
domain_role_change_exempt(local_login_t)
Chris PeBenito c9428d
domain_wide_inherit_fd(local_login_t)
Chris PeBenito 07efe9
role system_r types local_login_t;
Chris PeBenito 07efe9
Chris PeBenito 98a8ea
type local_login_lock_t;
Chris PeBenito 98a8ea
files_lock_file(local_login_lock_t)
Chris PeBenito 98a8ea
Chris PeBenito 07efe9
type local_login_tmp_t;
Chris PeBenito c3cf66
files_tmp_file(local_login_tmp_t)
Chris PeBenito 07efe9
Chris PeBenito 5d7e8b
type sulogin_t;
Chris PeBenito 5d7e8b
type sulogin_exec_t;
Chris PeBenito 8bd678
domain_obj_id_change_exempt(sulogin_t)
Chris PeBenito 8bd678
domain_subj_id_change_exempt(sulogin_t)
Chris PeBenito 8bd678
domain_role_change_exempt(sulogin_t)
Chris PeBenito c9428d
domain_wide_inherit_fd(sulogin_t)
Chris PeBenito c9428d
init_domain(sulogin_t,sulogin_exec_t)
Chris PeBenito c9428d
init_system_domain(sulogin_t,sulogin_exec_t)
Chris PeBenito 5d7e8b
role system_r types sulogin_t;
Chris PeBenito 5d7e8b
Chris PeBenito 07efe9
########################################
Chris PeBenito 07efe9
#
Chris PeBenito 5d7e8b
# Local login local policy
Chris PeBenito 07efe9
#
Chris PeBenito 07efe9
Chris PeBenito 9d3bdc
allow local_login_t self:capability { dac_override chown fowner fsetid kill setgid setuid sys_nice sys_resource sys_tty_config };
Chris PeBenito 9d3bdc
allow local_login_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
Chris PeBenito 07efe9
allow local_login_t self:process { setrlimit setexec };
Chris PeBenito f1470e
allow local_login_t self:fd use;
Chris PeBenito 80048c
allow local_login_t self:fifo_file rw_file_perms;
Chris PeBenito 725926
allow local_login_t self:sock_file r_file_perms;
Chris PeBenito 80048c
allow local_login_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 80048c
allow local_login_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito f1470e
allow local_login_t self:unix_dgram_socket sendto;
Chris PeBenito f1470e
allow local_login_t self:unix_stream_socket connectto;
Chris PeBenito 80048c
allow local_login_t self:shm create_shm_perms;
Chris PeBenito 80048c
allow local_login_t self:sem create_sem_perms;
Chris PeBenito 80048c
allow local_login_t self:msgq create_msgq_perms;
Chris PeBenito f1470e
allow local_login_t self:msg { send receive };
Chris PeBenito 07efe9
Chris PeBenito 98a8ea
allow local_login_t local_login_lock_t:file create_file_perms;
Chris PeBenito 98a8ea
files_create_lock(local_login_t,local_login_lock_t)
Chris PeBenito 98a8ea
Chris PeBenito 80048c
allow local_login_t local_login_tmp_t:dir create_dir_perms;
Chris PeBenito 80048c
allow local_login_t local_login_tmp_t:file create_file_perms;
Chris PeBenito c9428d
files_create_tmp_files(local_login_t, local_login_tmp_t, { file dir })
Chris PeBenito 07efe9
Chris PeBenito 07efe9
kernel_read_system_state(local_login_t)
Chris PeBenito f1470e
kernel_read_kernel_sysctl(local_login_t)
Chris PeBenito d35c62
Chris PeBenito 7a2f20
dev_setattr_mouse(local_login_t)
Chris PeBenito 7a2f20
dev_getattr_mouse(local_login_t)
Chris PeBenito 7a2f20
dev_getattr_power_management(local_login_t)
Chris PeBenito 7a2f20
dev_setattr_power_management(local_login_t)
Chris PeBenito fd89e1
dev_getattr_snd_dev(local_login_t)
Chris PeBenito fd89e1
dev_setattr_snd_dev(local_login_t)
Chris PeBenito fd89e1
dev_dontaudit_getattr_apm_bios(local_login_t)
Chris PeBenito fd89e1
dev_dontaudit_setattr_apm_bios(local_login_t)
Chris PeBenito fd89e1
dev_dontaudit_read_framebuffer(local_login_t)
Chris PeBenito fd89e1
dev_dontaudit_setattr_framebuffer(local_login_t)
Chris PeBenito 7a2f20
dev_dontaudit_getattr_generic_blk_file(local_login_t)
Chris PeBenito 7a2f20
dev_dontaudit_setattr_generic_blk_file(local_login_t)
Chris PeBenito 7a2f20
dev_dontaudit_getattr_generic_chr_file(local_login_t)
Chris PeBenito 7a2f20
dev_dontaudit_setattr_generic_chr_file(local_login_t)
Chris PeBenito ae9e27
dev_dontaudit_setattr_generic_symlink(local_login_t)
Chris PeBenito 7a2f20
dev_dontaudit_getattr_misc(local_login_t)
Chris PeBenito 7a2f20
dev_dontaudit_setattr_misc(local_login_t)
Chris PeBenito 7a2f20
dev_dontaudit_getattr_scanner(local_login_t)
Chris PeBenito 7a2f20
dev_dontaudit_setattr_scanner(local_login_t)
Chris PeBenito ebdc3b
dev_dontaudit_search_sysfs(local_login_t)
Chris PeBenito fd89e1
dev_dontaudit_getattr_video_dev(local_login_t)
Chris PeBenito fd89e1
dev_dontaudit_setattr_video_dev(local_login_t)
Chris PeBenito d35c62
# for SSP/ProPolice
Chris PeBenito d35c62
dev_read_urand(local_login_t)
Chris PeBenito d35c62
Chris PeBenito ab940a
fs_search_auto_mountpoints(local_login_t)
Chris PeBenito ab940a
Chris PeBenito 5e0da6
selinux_get_fs_mount(local_login_t)
Chris PeBenito 5e0da6
selinux_validate_context(local_login_t)
Chris PeBenito 5e0da6
selinux_compute_access_vector(local_login_t)
Chris PeBenito 5e0da6
selinux_compute_create_context(local_login_t)
Chris PeBenito 5e0da6
selinux_compute_relabel_context(local_login_t)
Chris PeBenito 5e0da6
selinux_compute_user_contexts(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito d35c62
storage_dontaudit_getattr_fixed_disk(local_login_t)
Chris PeBenito d35c62
storage_dontaudit_setattr_fixed_disk(local_login_t)
Chris PeBenito 7a2f20
storage_dontaudit_getattr_removable_device(local_login_t)
Chris PeBenito 7a2f20
storage_dontaudit_setattr_removable_device(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito 0fd9dc
term_use_all_user_ttys(local_login_t)
Chris PeBenito 0fd9dc
term_use_unallocated_tty(local_login_t)
Chris PeBenito 0fd9dc
term_relabel_unallocated_ttys(local_login_t)
Chris PeBenito 0fd9dc
term_relabel_all_user_ttys(local_login_t)
Chris PeBenito 0fd9dc
term_setattr_all_user_ttys(local_login_t)
Chris PeBenito 0fd9dc
term_setattr_unallocated_ttys(local_login_t)
Chris PeBenito 1e5c2a
Chris PeBenito c9428d
auth_domtrans_chk_passwd(local_login_t)
Chris PeBenito c9428d
auth_dontaudit_read_shadow(local_login_t)
Chris PeBenito c9428d
auth_rw_login_records(local_login_t)
Chris PeBenito c9428d
auth_rw_lastlog(local_login_t)
Chris PeBenito c9428d
auth_rw_faillog(local_login_t)
Chris PeBenito c9428d
auth_exec_pam(local_login_t)
Chris PeBenito c9428d
auth_manage_pam_console_data(local_login_t)
Chris PeBenito d8636f
auth_domtrans_pam_console(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito ae9e27
corecmd_list_bin(local_login_t)
Chris PeBenito ae9e27
corecmd_list_sbin(local_login_t)
Chris PeBenito ae9e27
corecmd_read_bin_symlink(local_login_t)
Chris PeBenito ae9e27
corecmd_read_sbin_symlink(local_login_t)
Chris PeBenito ae9e27
# cjp: these are probably not needed:
Chris PeBenito ae9e27
corecmd_read_bin_file(local_login_t)
Chris PeBenito ae9e27
corecmd_read_bin_pipe(local_login_t)
Chris PeBenito ae9e27
corecmd_read_bin_socket(local_login_t)
Chris PeBenito ae9e27
corecmd_read_sbin_file(local_login_t)
Chris PeBenito ae9e27
corecmd_read_sbin_pipe(local_login_t)
Chris PeBenito ae9e27
corecmd_read_sbin_socket(local_login_t)
Chris PeBenito ae9e27
Chris PeBenito c9428d
domain_read_all_entry_files(local_login_t)
Chris PeBenito f1470e
Chris PeBenito 8fd367
files_read_etc_files(local_login_t)
Chris PeBenito c9428d
files_read_etc_runtime_files(local_login_t)
Chris PeBenito c9428d
files_read_usr_files(local_login_t)
Chris PeBenito ebdc3b
files_list_mnt(local_login_t)
Chris PeBenito ae9e27
files_list_world_readable(local_login_t)
Chris PeBenito ae9e27
files_read_world_readable_files(local_login_t)
Chris PeBenito ae9e27
files_read_world_readable_symlinks(local_login_t)
Chris PeBenito ae9e27
files_read_world_readable_pipes(local_login_t)
Chris PeBenito ae9e27
files_read_world_readable_sockets(local_login_t)
Chris PeBenito ae9e27
# for when /var/mail is a symlink
Chris PeBenito ae9e27
files_read_var_symlink(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito c9428d
init_rw_script_pid(local_login_t)
Chris PeBenito c9428d
init_dontaudit_use_fd(local_login_t)
Chris PeBenito daa0e0
Chris PeBenito c9428d
libs_use_ld_so(local_login_t)
Chris PeBenito c9428d
libs_use_shared_libs(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito c9428d
logging_send_syslog_msg(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito daa0e0
miscfiles_read_localization(local_login_t)
Chris PeBenito daa0e0
Chris PeBenito bf080a
mls_file_read_up(local_login_t)
Chris PeBenito f0574f
mls_file_write_down(local_login_t)
Chris PeBenito f0574f
mls_file_upgrade(local_login_t)
Chris PeBenito f0574f
mls_file_downgrade(local_login_t)
Chris PeBenito f0574f
mls_process_set_level(local_login_t)
Chris PeBenito f0574f
Chris PeBenito 5e0da6
seutil_read_config(local_login_t)
Chris PeBenito 5e0da6
seutil_read_default_contexts(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito c9428d
userdom_spec_domtrans_all_users(local_login_t)
Chris PeBenito c9428d
userdom_signal_all_users(local_login_t)
Chris PeBenito c9428d
userdom_search_all_users_home(local_login_t)
Chris PeBenito c9428d
userdom_use_unpriv_users_fd(local_login_t)
Chris PeBenito a77e65
userdom_sigchld_all_users(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito 4bf4ed
# Search for mail spool file.
Chris PeBenito c9428d
mta_getattr_spool(local_login_t)
Chris PeBenito 4bf4ed
Chris PeBenito a42ca7
ifdef(`targeted_policy',`
Chris PeBenito a42ca7
	unconfined_domain_template(local_login_t)
Chris PeBenito a42ca7
	unconfined_shell_domtrans(local_login_t)
Chris PeBenito a42ca7
')
Chris PeBenito a42ca7
Chris PeBenito a42ca7
tunable_policy(`read_default_t',`
Chris PeBenito a42ca7
	files_list_default(local_login_t)
Chris PeBenito a42ca7
	files_read_default_files(local_login_t)
Chris PeBenito a42ca7
	files_read_default_symlinks(local_login_t)
Chris PeBenito a42ca7
	files_read_default_sockets(local_login_t)
Chris PeBenito a42ca7
	files_read_default_pipes(local_login_t)
Chris PeBenito a42ca7
')
Chris PeBenito a42ca7
Chris PeBenito d35c62
tunable_policy(`use_nfs_home_dirs',`
Chris PeBenito d35c62
	fs_read_nfs_files(local_login_t)
Chris PeBenito d35c62
	fs_read_nfs_symlinks(local_login_t)
Chris PeBenito d35c62
')
Chris PeBenito d35c62
Chris PeBenito d35c62
tunable_policy(`use_samba_home_dirs',`
Chris PeBenito d35c62
	fs_read_cifs_files(local_login_t)
Chris PeBenito d35c62
	fs_read_cifs_symlinks(local_login_t)
Chris PeBenito d35c62
')
Chris PeBenito d35c62
Chris PeBenito 132880
optional_policy(`gpm',`
Chris PeBenito f862c3
	gpm_getattr_gpmctl(local_login_t)
Chris PeBenito f862c3
	gpm_setattr_gpmctl(local_login_t)
Chris PeBenito f862c3
')
Chris PeBenito f862c3
Chris PeBenito 132880
optional_policy(`nis',`
Chris PeBenito ab940a
	nis_use_ypbind(local_login_t)
Chris PeBenito d115b2
')
Chris PeBenito d115b2
Chris PeBenito 132880
optional_policy(`nscd',`
Chris PeBenito 493d6c
	nscd_use_socket(local_login_t)
Chris PeBenito 493d6c
')
Chris PeBenito 493d6c
Chris PeBenito 132880
optional_policy(`usermanage',`
Chris PeBenito ebdc3b
	usermanage_read_crack_db(local_login_t)
Chris PeBenito ebdc3b
')
Chris PeBenito ebdc3b
Chris PeBenito 07efe9
ifdef(`TODO',`
Chris PeBenito 98a8ea
# Login can polyinstantiate
Chris PeBenito 98a8ea
polyinstantiater(local_login_t)
Chris PeBenito d8636f
Chris PeBenito d8636f
ifdef(`alsa.te', `
Chris PeBenito d8636f
domain_auto_trans($1_login_t, alsa_exec_t, alsa_t)
Chris PeBenito d8636f
')
Chris PeBenito 07efe9
') dnl endif TODO
Chris PeBenito 5d7e8b
Chris PeBenito 5d7e8b
#################################
Chris PeBenito 5d7e8b
# 
Chris PeBenito 5d7e8b
# Sulogin local policy
Chris PeBenito 5d7e8b
#
Chris PeBenito 5d7e8b
Chris PeBenito 9d3bdc
allow sulogin_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
Chris PeBenito 5d7e8b
allow sulogin_t self:fd use;
Chris PeBenito 80048c
allow sulogin_t self:fifo_file rw_file_perms;
Chris PeBenito 80048c
allow sulogin_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 80048c
allow sulogin_t self:unix_stream_socket create_stream_socket_perms;
Chris PeBenito 5d7e8b
allow sulogin_t self:unix_dgram_socket sendto;
Chris PeBenito 5d7e8b
allow sulogin_t self:unix_stream_socket connectto;
Chris PeBenito 80048c
allow sulogin_t self:shm create_shm_perms;
Chris PeBenito 80048c
allow sulogin_t self:sem create_sem_perms;
Chris PeBenito 0fd9dc
allow sulogin_t self:msgq create_msgq_perms;
Chris PeBenito 5d7e8b
allow sulogin_t self:msg { send receive };
Chris PeBenito 5d7e8b
Chris PeBenito 5d7e8b
kernel_read_system_state(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito ab940a
fs_search_auto_mountpoints(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito 8fd367
files_read_etc_files(sulogin_t)
Chris PeBenito 3b857e
# because file systems are not mounted:
Chris PeBenito c9428d
files_dontaudit_search_isid_type_dir(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito ab940a
init_get_script_process_group(sulogin_t)
Chris PeBenito ab940a
Chris PeBenito c9428d
libs_use_ld_so(sulogin_t)
Chris PeBenito c9428d
libs_use_shared_libs(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito c9428d
logging_send_syslog_msg(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito 5e0da6
seutil_read_config(sulogin_t)
Chris PeBenito 5e0da6
seutil_read_default_contexts(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito c9428d
auth_read_shadow(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito c9428d
userdom_shell_domtrans_sysadm(sulogin_t)
Chris PeBenito c9428d
userdom_use_unpriv_users_fd(sulogin_t)
Chris PeBenito fd89e1
userdom_use_sysadm_pty(sulogin_t)
Chris PeBenito ae9e27
userdom_search_staff_home_dir(sulogin_t)
Chris PeBenito ae9e27
userdom_search_sysadm_home_dir(sulogin_t)
Chris PeBenito dc771f
Chris PeBenito 5d7e8b
# suse and debian do not use pam with sulogin...
Chris PeBenito 0e15cd
ifdef(`distro_suse', `define(`sulogin_no_pam')')
Chris PeBenito 0e15cd
ifdef(`distro_debian', `define(`sulogin_no_pam')')
Chris PeBenito 5d7e8b
Chris PeBenito 254bbc
ifdef(`sulogin_no_pam', `
Chris PeBenito 0c73cd
	allow sulogin_t self:capability sys_tty_config;
Chris PeBenito 0c73cd
	init_get_process_group(sulogin_t)
Chris PeBenito 5d7e8b
', `
Chris PeBenito 0c73cd
	allow sulogin_t self:process setexec;
Chris PeBenito 5e0da6
	selinux_get_fs_mount(sulogin_t)
Chris PeBenito 5e0da6
	selinux_validate_context(sulogin_t)
Chris PeBenito 5e0da6
	selinux_compute_access_vector(sulogin_t)
Chris PeBenito 5e0da6
	selinux_compute_create_context(sulogin_t)
Chris PeBenito 5e0da6
	selinux_compute_relabel_context(sulogin_t)
Chris PeBenito 5e0da6
	selinux_compute_user_contexts(sulogin_t)
Chris PeBenito 5d7e8b
')
Chris PeBenito 5d7e8b
Chris PeBenito 132880
optional_policy(`nis',`
Chris PeBenito ab940a
	nis_use_ypbind(sulogin_t)
Chris PeBenito 5d7e8b
')