Chris PeBenito df431c
Chris PeBenito df431c
policy_module(locallogin,1.0)
Chris PeBenito df431c
Chris PeBenito 07efe9
########################################
Chris PeBenito 07efe9
#
Chris PeBenito 07efe9
# Declarations
Chris PeBenito 07efe9
#
Chris PeBenito 07efe9
Chris PeBenito a1f94a
type local_login_t; #, nscd_client_domain;
Chris PeBenito 18f25a
kernel_make_object_identity_change_constraint_exception(local_login_t)
Chris PeBenito 18f25a
kernel_make_process_identity_change_constraint_exception(local_login_t)
Chris PeBenito 18f25a
kernel_make_role_change_constraint_exception(local_login_t)
Chris PeBenito daa0e0
authlogin_make_login_program_entrypoint(local_login_t)
Chris PeBenito 07efe9
domain_make_domain(local_login_t)
Chris PeBenito 1e5c2a
domain_make_file_descriptors_widely_inheritable(local_login_t)
Chris PeBenito 07efe9
role system_r types local_login_t;
Chris PeBenito 07efe9
Chris PeBenito 07efe9
type local_login_tmp_t;
Chris PeBenito 07efe9
files_make_file(local_login_tmp_t)
Chris PeBenito 07efe9
Chris PeBenito 5d7e8b
type sulogin_t;
Chris PeBenito 5d7e8b
type sulogin_exec_t;
Chris PeBenito cb2873
kernel_make_object_identity_change_constraint_exception(sulogin_t)
Chris PeBenito cb2873
kernel_make_process_identity_change_constraint_exception(sulogin_t)
Chris PeBenito cb2873
kernel_make_role_change_constraint_exception(sulogin_t)
Chris PeBenito daa0e0
domain_make_file_descriptors_widely_inheritable(sulogin_t)
Chris PeBenito ff3138
init_make_init_domain(sulogin_t,sulogin_exec_t)
Chris PeBenito ff3138
init_make_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 07efe9
allow local_login_t self:capability { dac_override chown fowner fsetid kill setgid setuid net_bind_service sys_nice sys_resource sys_tty_config };
Chris PeBenito f1470e
allow local_login_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
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 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 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 07efe9
files_create_private_tmp_data(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 07efe9
kernel_get_selinuxfs_mount_point(local_login_t)
Chris PeBenito 07efe9
kernel_validate_selinux_context(local_login_t)
Chris PeBenito 178607
kernel_compute_selinux_access_vector(local_login_t)
Chris PeBenito 178607
kernel_compute_selinux_create_context(local_login_t)
Chris PeBenito 178607
kernel_compute_selinux_relabel_context(local_login_t)
Chris PeBenito 178607
kernel_compute_selinux_reachable_user_contexts(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito 07efe9
# for SSP/ProPolice
Chris PeBenito 07efe9
devices_get_pseudorandom_data(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito b16c6b
terminal_use_all_private_physical_terminals(local_login_t)
Chris PeBenito 1e5c2a
terminal_use_general_physical_terminal(local_login_t)
Chris PeBenito 4bf4ed
terminal_relabel_general_physical_terminal(local_login_t)
Chris PeBenito 4bf4ed
terminal_relabel_all_private_physical_terminals(local_login_t)
Chris PeBenito 4bf4ed
terminal_set_all_private_physical_terminal_attributes(local_login_t)
Chris PeBenito 4bf4ed
terminal_set_general_physical_terminal_attributes(local_login_t)
Chris PeBenito 1e5c2a
Chris PeBenito daa0e0
authlogin_check_password_transition(local_login_t)
Chris PeBenito daa0e0
authlogin_ignore_read_shadow_passwords(local_login_t)
Chris PeBenito daa0e0
authlogin_modify_login_records(local_login_t)
Chris PeBenito daa0e0
authlogin_modify_last_login_log(local_login_t)
Chris PeBenito 4bf4ed
authlogin_modify_login_failure_records(local_login_t)
Chris PeBenito daa0e0
authlogin_pam_execute(local_login_t)
Chris PeBenito daa0e0
authlogin_pam_console_manage_runtime_data(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito f1470e
domain_read_all_entrypoint_programs(local_login_t)
Chris PeBenito f1470e
Chris PeBenito 07efe9
files_read_general_system_config(local_login_t)
Chris PeBenito 07efe9
files_read_runtime_system_config(local_login_t)
Chris PeBenito f1470e
files_read_general_application_resources(local_login_t)
Chris PeBenito 4bf4ed
files_manage_system_lock_files(var_lock_t)
Chris PeBenito 07efe9
Chris PeBenito daa0e0
init_script_modify_runtime_data(local_login_t)
Chris PeBenito daa0e0
init_ignore_use_file_descriptors(local_login_t)
Chris PeBenito daa0e0
Chris PeBenito 07efe9
libraries_use_dynamic_loader(local_login_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito 07efe9
logging_send_system_log_message(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito daa0e0
miscfiles_read_localization(local_login_t)
Chris PeBenito daa0e0
Chris PeBenito 07efe9
selinux_read_config(local_login_t)
Chris PeBenito 07efe9
selinux_read_default_contexts(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito 4bf4ed
userdomain_all_users_explicit_transition(local_login_t)
Chris PeBenito 4bf4ed
userdomain_signal_all_userdomains(local_login_t)
Chris PeBenito 4bf4ed
userdomain_search_all_users_home_dirs(local_login_t)
Chris PeBenito dc771f
userdomain_use_all_unprivileged_users_file_descriptors(local_login_t)
Chris PeBenito 07efe9
Chris PeBenito 4bf4ed
# Search for mail spool file.
Chris PeBenito 4bf4ed
mta_get_mail_spool_attributes(local_login_t)
Chris PeBenito 4bf4ed
Chris PeBenito d115b2
# Red Hat systems seem to have a stray
Chris PeBenito d115b2
# fd open from the initrd
Chris PeBenito d115b2
optional_policy(`distro_redhat',`
Chris PeBenito d115b2
	kernel_ignore_use_file_descriptors(local_login_t)
Chris PeBenito d115b2
	files_ignore_read_rootfs_file(local_login_t)
Chris PeBenito d115b2
')
Chris PeBenito d115b2
Chris PeBenito 07efe9
ifdef(`TODO',`
Chris PeBenito dc771f
Chris PeBenito f1470e
can_ypbind(local_login_t)
Chris PeBenito f1470e
ifdef(`automount.te', `
Chris PeBenito 0c73cd
	allow local_login_t autofs_t:dir { search getattr };
Chris PeBenito f1470e
')
Chris PeBenito 07efe9
Chris PeBenito f1470e
allow local_login_t bin_t:dir r_dir_perms;
Chris PeBenito f1470e
allow local_login_t bin_t:notdevfile_class_set r_file_perms;
Chris PeBenito f1470e
allow local_login_t sbin_t:dir r_dir_perms;
Chris PeBenito f1470e
allow local_login_t sbin_t:notdevfile_class_set r_file_perms;
Chris PeBenito f1470e
if (read_default_t) {
Chris PeBenito 0c73cd
	allow local_login_t default_t:dir r_dir_perms;
Chris PeBenito 0c73cd
	allow local_login_t default_t:notdevfile_class_set r_file_perms;
Chris PeBenito f1470e
}
Chris PeBenito 07efe9
Chris PeBenito 07efe9
# Read directories and files with the readable_t type.
Chris PeBenito 07efe9
# This type is a general type for "world"-readable files.
Chris PeBenito 07efe9
allow local_login_t readable_t:dir r_dir_perms;
Chris PeBenito 07efe9
allow local_login_t readable_t:notdevfile_class_set r_file_perms;
Chris PeBenito 07efe9
Chris PeBenito 07efe9
# for when /var/mail is a sym-link
Chris PeBenito 07efe9
allow local_login_t var_t:lnk_file read;
Chris PeBenito 07efe9
Chris PeBenito 07efe9
dontaudit local_login_t sysfs_t:dir search;
Chris PeBenito 07efe9
Chris PeBenito 80048c
allow local_login_t autofs_t:dir r_dir_perms;
Chris PeBenito 07efe9
allow local_login_t mnt_t:dir r_dir_perms;
Chris PeBenito 07efe9
Chris PeBenito 07efe9
# FIXME: what is this for?
Chris PeBenito 25baab
optional_policy(`xdm.te', `
Chris PeBenito 0c73cd
	allow xdm_t local_login_t:process signull;
Chris PeBenito 07efe9
')
Chris PeBenito 07efe9
Chris PeBenito 07efe9
ifdef(`crack.te', `
Chris PeBenito 0c73cd
	allow local_login_t crack_db_t:file r_file_perms;
Chris PeBenito 07efe9
')
Chris PeBenito 07efe9
Chris PeBenito 07efe9
allow local_login_t mouse_device_t:chr_file { getattr setattr };
Chris PeBenito 07efe9
Chris PeBenito 763c44
ifdef(`targeted_policy',`
Chris PeBenito 0c73cd
	unconfined_domain(local_login_t)
Chris PeBenito 0c73cd
	domain_auto_trans(local_login_t, shell_exec_t, unconfined_t)
Chris PeBenito 07efe9
')
Chris PeBenito 07efe9
Chris PeBenito 07efe9
# Do not audit denied attempts to access devices.
Chris PeBenito 07efe9
dontaudit local_login_t fixed_disk_device_t:blk_file { getattr setattr };
Chris PeBenito 07efe9
dontaudit local_login_t removable_device_t:blk_file { getattr setattr };
Chris PeBenito 07efe9
dontaudit local_login_t device_t:{ chr_file blk_file lnk_file } { getattr setattr };
Chris PeBenito 07efe9
dontaudit local_login_t misc_device_t:{ chr_file blk_file } { getattr setattr };
Chris PeBenito 07efe9
dontaudit local_login_t framebuf_device_t:chr_file { getattr setattr read };
Chris PeBenito 07efe9
dontaudit local_login_t apm_bios_t:chr_file { getattr setattr };
Chris PeBenito 07efe9
dontaudit local_login_t v4l_device_t:chr_file { getattr setattr read };
Chris PeBenito 07efe9
dontaudit local_login_t removable_device_t:chr_file { getattr setattr };
Chris PeBenito 07efe9
dontaudit local_login_t scanner_device_t:chr_file { getattr setattr };
Chris PeBenito 07efe9
Chris PeBenito 07efe9
# Do not audit denied attempts to access /mnt.
Chris PeBenito 07efe9
dontaudit local_login_t mnt_t:dir r_dir_perms;
Chris PeBenito 07efe9
Chris PeBenito 25baab
optional_policy(`gpm.te',`
Chris PeBenito 0c73cd
	allow local_login_t gpmctl_t:sock_file { getattr setattr };
Chris PeBenito 25baab
')
Chris PeBenito 07efe9
Chris PeBenito 07efe9
# Allow setting of attributes on sound devices.
Chris PeBenito 07efe9
allow local_login_t sound_device_t:chr_file { getattr setattr };
Chris PeBenito 07efe9
Chris PeBenito 07efe9
# Allow setting of attributes on power management devices.
Chris PeBenito 07efe9
allow local_login_t power_device_t:chr_file { getattr setattr };
Chris PeBenito 07efe9
Chris PeBenito 07efe9
#if (use_nfs_home_dirs) {
Chris PeBenito 07efe9
#r_dir_file(local_login_t, nfs_t)
Chris PeBenito 07efe9
#}
Chris PeBenito 07efe9
Chris PeBenito 07efe9
#if (use_samba_home_dirs) {
Chris PeBenito 07efe9
#r_dir_file(local_login_t, cifs_t)
Chris PeBenito 07efe9
#}
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 5d7e8b
allow sulogin_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
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 80048c
allow sulogin_t self:msgq createmsgq_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 5d7e8b
init_script_get_process_group(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito 5d7e8b
files_read_general_system_config(sulogin_t)
Chris PeBenito 3b857e
# because file systems are not mounted:
Chris PeBenito 3b857e
files_ignore_search_isid_type_dir(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito 5d7e8b
libraries_use_dynamic_loader(sulogin_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito 5d7e8b
logging_send_system_log_message(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito 5d7e8b
selinux_read_config(sulogin_t)
Chris PeBenito 5d7e8b
selinux_read_default_contexts(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito 5d7e8b
authlogin_read_shadow_passwords(sulogin_t)
Chris PeBenito 5d7e8b
Chris PeBenito 4bf4ed
userdomain_sysadm_shell_transition(sulogin_t)
Chris PeBenito dc771f
userdomain_use_all_unprivileged_users_file_descriptors(sulogin_t)
Chris PeBenito dc771f
Chris PeBenito 5d7e8b
# suse and debian do not use pam with sulogin...
Chris PeBenito 5d7e8b
ifdef(`monolithic_policy',`
Chris PeBenito 0c73cd
	ifdef(`distro_suse', `define(`sulogin_no_pam')')
Chris PeBenito 0c73cd
	ifdef(`distro_debian', `define(`sulogin_no_pam')')
Chris PeBenito 5d7e8b
') dnl end monolithic_policy
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 0c73cd
	kernel_get_selinuxfs_mount_point(sulogin_t)
Chris PeBenito 0c73cd
	kernel_validate_selinux_context(sulogin_t)
Chris PeBenito 0c73cd
	kernel_compute_selinux_access_vector(sulogin_t)
Chris PeBenito 0c73cd
	kernel_compute_selinux_create_context(sulogin_t)
Chris PeBenito 0c73cd
	kernel_compute_selinux_relabel_context(sulogin_t)
Chris PeBenito 0c73cd
	kernel_compute_selinux_reachable_user_contexts(sulogin_t)
Chris PeBenito 5d7e8b
')
Chris PeBenito 5d7e8b
Chris PeBenito 5d7e8b
ifdef(`TODO',`
Chris PeBenito dc771f
Chris PeBenito dc771f
allow sulogin_t sysadm_devpts_t:chr_file { getattr ioctl read write };
Chris PeBenito dc771f
Chris PeBenito 5d7e8b
can_ypbind(sulogin_t)
Chris PeBenito 5d7e8b
ifdef(`automount.te', `
Chris PeBenito 0c73cd
	allow sulogin_t autofs_t:dir { search getattr };
Chris PeBenito 5d7e8b
')
Chris PeBenito 5d7e8b
Chris PeBenito 5d7e8b
allow sulogin_t { staff_home_dir_t sysadm_home_dir_t }:dir search;
Chris PeBenito 5d7e8b
') dnl endif TODO