2005-05-05 14:01:59 +00:00
|
|
|
|
|
|
|
policy_module(locallogin,1.0)
|
|
|
|
|
2005-04-28 19:50:58 +00:00
|
|
|
########################################
|
|
|
|
#
|
|
|
|
# Declarations
|
|
|
|
#
|
|
|
|
|
2005-05-09 18:50:20 +00:00
|
|
|
type local_login_t; #, nscd_client_domain;
|
2005-05-09 17:41:29 +00:00
|
|
|
kernel_make_object_identity_change_constraint_exception(local_login_t)
|
|
|
|
kernel_make_process_identity_change_constraint_exception(local_login_t)
|
|
|
|
kernel_make_role_change_constraint_exception(local_login_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
authlogin_make_login_program_entrypoint(local_login_t)
|
2005-04-28 19:50:58 +00:00
|
|
|
domain_make_domain(local_login_t)
|
2005-05-04 17:01:46 +00:00
|
|
|
domain_make_file_descriptors_widely_inheritable(local_login_t)
|
2005-04-28 19:50:58 +00:00
|
|
|
role system_r types local_login_t;
|
|
|
|
|
|
|
|
type local_login_tmp_t;
|
|
|
|
files_make_file(local_login_tmp_t)
|
|
|
|
|
2005-05-09 15:38:06 +00:00
|
|
|
type sulogin_t;
|
|
|
|
type sulogin_exec_t;
|
2005-05-09 21:05:01 +00:00
|
|
|
kernel_make_object_identity_change_constraint_exception(sulogin_t)
|
|
|
|
kernel_make_process_identity_change_constraint_exception(sulogin_t)
|
|
|
|
kernel_make_role_change_constraint_exception(sulogin_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
domain_make_file_descriptors_widely_inheritable(sulogin_t)
|
2005-05-13 20:21:50 +00:00
|
|
|
init_make_init_domain(sulogin_t,sulogin_exec_t)
|
|
|
|
init_make_system_domain(sulogin_t,sulogin_exec_t)
|
2005-05-09 15:38:06 +00:00
|
|
|
role system_r types sulogin_t;
|
|
|
|
|
2005-04-28 19:50:58 +00:00
|
|
|
########################################
|
|
|
|
#
|
2005-05-09 15:38:06 +00:00
|
|
|
# Local login local policy
|
2005-04-28 19:50:58 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
allow local_login_t self:capability { dac_override chown fowner fsetid kill setgid setuid net_bind_service sys_nice sys_resource sys_tty_config };
|
2005-05-04 21:44:51 +00:00
|
|
|
allow local_login_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
|
2005-04-28 19:50:58 +00:00
|
|
|
allow local_login_t self:process { setrlimit setexec };
|
2005-05-04 21:44:51 +00:00
|
|
|
allow local_login_t self:fd use;
|
2005-06-09 14:26:05 +00:00
|
|
|
allow local_login_t self:fifo_file rw_file_perms;
|
|
|
|
allow local_login_t self:unix_dgram_socket create_socket_perms;
|
|
|
|
allow local_login_t self:unix_stream_socket create_stream_socket_perms;
|
2005-05-04 21:44:51 +00:00
|
|
|
allow local_login_t self:unix_dgram_socket sendto;
|
|
|
|
allow local_login_t self:unix_stream_socket connectto;
|
2005-06-09 14:26:05 +00:00
|
|
|
allow local_login_t self:shm create_shm_perms;
|
|
|
|
allow local_login_t self:sem create_sem_perms;
|
|
|
|
allow local_login_t self:msgq create_msgq_perms;
|
2005-05-04 21:44:51 +00:00
|
|
|
allow local_login_t self:msg { send receive };
|
2005-04-28 19:50:58 +00:00
|
|
|
|
2005-06-09 14:26:05 +00:00
|
|
|
allow local_login_t local_login_tmp_t:dir create_dir_perms;
|
|
|
|
allow local_login_t local_login_tmp_t:file create_file_perms;
|
2005-04-28 19:50:58 +00:00
|
|
|
files_create_private_tmp_data(local_login_t, local_login_tmp_t, { file dir })
|
|
|
|
|
|
|
|
kernel_read_system_state(local_login_t)
|
2005-05-04 21:44:51 +00:00
|
|
|
kernel_read_kernel_sysctl(local_login_t)
|
2005-04-28 19:50:58 +00:00
|
|
|
kernel_get_selinuxfs_mount_point(local_login_t)
|
2005-06-10 01:01:13 +00:00
|
|
|
kernel_validate_context(local_login_t)
|
|
|
|
kernel_compute_access_vector(local_login_t)
|
|
|
|
kernel_compute_create_context(local_login_t)
|
|
|
|
kernel_compute_relabel_context(local_login_t)
|
|
|
|
kernel_compute_reachable_user_contexts(local_login_t)
|
2005-04-28 19:50:58 +00:00
|
|
|
|
|
|
|
# for SSP/ProPolice
|
2005-06-13 16:22:32 +00:00
|
|
|
dev_read_urand(local_login_t)
|
2005-04-28 19:50:58 +00:00
|
|
|
|
2005-06-10 01:01:13 +00:00
|
|
|
term_use_all_user_ttys(local_login_t)
|
|
|
|
term_use_unallocated_tty(local_login_t)
|
|
|
|
term_relabel_unallocated_ttys(local_login_t)
|
|
|
|
term_relabel_all_user_ttys(local_login_t)
|
|
|
|
term_setattr_all_user_ttys(local_login_t)
|
|
|
|
term_setattr_unallocated_ttys(local_login_t)
|
2005-05-04 17:01:46 +00:00
|
|
|
|
2005-05-19 21:06:06 +00:00
|
|
|
authlogin_check_password_transition(local_login_t)
|
|
|
|
authlogin_ignore_read_shadow_passwords(local_login_t)
|
|
|
|
authlogin_modify_login_records(local_login_t)
|
|
|
|
authlogin_modify_last_login_log(local_login_t)
|
2005-05-31 19:52:57 +00:00
|
|
|
authlogin_modify_login_failure_records(local_login_t)
|
2005-05-19 21:06:06 +00:00
|
|
|
authlogin_pam_execute(local_login_t)
|
|
|
|
authlogin_pam_console_manage_runtime_data(local_login_t)
|
2005-04-28 19:50:58 +00:00
|
|
|
|
2005-05-04 21:44:51 +00:00
|
|
|
domain_read_all_entrypoint_programs(local_login_t)
|
|
|
|
|
2005-04-28 19:50:58 +00:00
|
|
|
files_read_general_system_config(local_login_t)
|
|
|
|
files_read_runtime_system_config(local_login_t)
|
2005-05-04 21:44:51 +00:00
|
|
|
files_read_general_application_resources(local_login_t)
|
2005-05-31 19:52:57 +00:00
|
|
|
files_manage_system_lock_files(var_lock_t)
|
2005-04-28 19:50:58 +00:00
|
|
|
|
2005-05-19 21:06:06 +00:00
|
|
|
init_script_modify_runtime_data(local_login_t)
|
|
|
|
init_ignore_use_file_descriptors(local_login_t)
|
|
|
|
|
2005-04-28 19:50:58 +00:00
|
|
|
libraries_use_dynamic_loader(local_login_t)
|
2005-05-17 15:32:52 +00:00
|
|
|
libraries_use_shared_libraries(local_login_t)
|
2005-04-28 19:50:58 +00:00
|
|
|
|
|
|
|
logging_send_system_log_message(local_login_t)
|
|
|
|
|
2005-05-19 21:06:06 +00:00
|
|
|
miscfiles_read_localization(local_login_t)
|
|
|
|
|
2005-04-28 19:50:58 +00:00
|
|
|
selinux_read_config(local_login_t)
|
|
|
|
selinux_read_default_contexts(local_login_t)
|
|
|
|
|
2005-05-31 19:52:57 +00:00
|
|
|
userdomain_all_users_explicit_transition(local_login_t)
|
|
|
|
userdomain_signal_all_userdomains(local_login_t)
|
|
|
|
userdomain_search_all_users_home_dirs(local_login_t)
|
2005-05-24 15:55:57 +00:00
|
|
|
userdomain_use_all_unprivileged_users_file_descriptors(local_login_t)
|
2005-04-28 19:50:58 +00:00
|
|
|
|
2005-05-31 19:52:57 +00:00
|
|
|
# Search for mail spool file.
|
|
|
|
mta_get_mail_spool_attributes(local_login_t)
|
|
|
|
|
2005-05-31 23:02:11 +00:00
|
|
|
# Red Hat systems seem to have a stray
|
|
|
|
# fd open from the initrd
|
|
|
|
optional_policy(`distro_redhat',`
|
2005-06-10 01:01:13 +00:00
|
|
|
kernel_dontaudit_use_fd(local_login_t)
|
2005-05-31 23:02:11 +00:00
|
|
|
files_ignore_read_rootfs_file(local_login_t)
|
|
|
|
')
|
|
|
|
|
2005-04-28 19:50:58 +00:00
|
|
|
ifdef(`TODO',`
|
2005-05-24 15:55:57 +00:00
|
|
|
|
2005-05-04 21:44:51 +00:00
|
|
|
can_ypbind(local_login_t)
|
|
|
|
ifdef(`automount.te', `
|
2005-06-03 12:25:14 +00:00
|
|
|
allow local_login_t autofs_t:dir { search getattr };
|
2005-05-04 21:44:51 +00:00
|
|
|
')
|
2005-04-28 19:50:58 +00:00
|
|
|
|
2005-05-04 21:44:51 +00:00
|
|
|
allow local_login_t bin_t:dir r_dir_perms;
|
|
|
|
allow local_login_t bin_t:notdevfile_class_set r_file_perms;
|
|
|
|
allow local_login_t sbin_t:dir r_dir_perms;
|
|
|
|
allow local_login_t sbin_t:notdevfile_class_set r_file_perms;
|
|
|
|
if (read_default_t) {
|
2005-06-03 12:25:14 +00:00
|
|
|
allow local_login_t default_t:dir r_dir_perms;
|
|
|
|
allow local_login_t default_t:notdevfile_class_set r_file_perms;
|
2005-05-04 21:44:51 +00:00
|
|
|
}
|
2005-04-28 19:50:58 +00:00
|
|
|
|
|
|
|
# Read directories and files with the readable_t type.
|
|
|
|
# This type is a general type for "world"-readable files.
|
|
|
|
allow local_login_t readable_t:dir r_dir_perms;
|
|
|
|
allow local_login_t readable_t:notdevfile_class_set r_file_perms;
|
|
|
|
|
|
|
|
# for when /var/mail is a sym-link
|
|
|
|
allow local_login_t var_t:lnk_file read;
|
|
|
|
|
|
|
|
dontaudit local_login_t sysfs_t:dir search;
|
|
|
|
|
2005-06-09 14:26:05 +00:00
|
|
|
allow local_login_t autofs_t:dir r_dir_perms;
|
2005-04-28 19:50:58 +00:00
|
|
|
allow local_login_t mnt_t:dir r_dir_perms;
|
|
|
|
|
|
|
|
# FIXME: what is this for?
|
2005-05-02 19:22:58 +00:00
|
|
|
optional_policy(`xdm.te', `
|
2005-06-03 12:25:14 +00:00
|
|
|
allow xdm_t local_login_t:process signull;
|
2005-04-28 19:50:58 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
ifdef(`crack.te', `
|
2005-06-03 12:25:14 +00:00
|
|
|
allow local_login_t crack_db_t:file r_file_perms;
|
2005-04-28 19:50:58 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
allow local_login_t mouse_device_t:chr_file { getattr setattr };
|
|
|
|
|
2005-06-08 13:12:00 +00:00
|
|
|
ifdef(`targeted_policy',`
|
2005-06-03 12:25:14 +00:00
|
|
|
unconfined_domain(local_login_t)
|
|
|
|
domain_auto_trans(local_login_t, shell_exec_t, unconfined_t)
|
2005-04-28 19:50:58 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
# Do not audit denied attempts to access devices.
|
|
|
|
dontaudit local_login_t fixed_disk_device_t:blk_file { getattr setattr };
|
|
|
|
dontaudit local_login_t removable_device_t:blk_file { getattr setattr };
|
|
|
|
dontaudit local_login_t device_t:{ chr_file blk_file lnk_file } { getattr setattr };
|
|
|
|
dontaudit local_login_t misc_device_t:{ chr_file blk_file } { getattr setattr };
|
|
|
|
dontaudit local_login_t framebuf_device_t:chr_file { getattr setattr read };
|
|
|
|
dontaudit local_login_t apm_bios_t:chr_file { getattr setattr };
|
|
|
|
dontaudit local_login_t v4l_device_t:chr_file { getattr setattr read };
|
|
|
|
dontaudit local_login_t removable_device_t:chr_file { getattr setattr };
|
|
|
|
dontaudit local_login_t scanner_device_t:chr_file { getattr setattr };
|
|
|
|
|
|
|
|
# Do not audit denied attempts to access /mnt.
|
|
|
|
dontaudit local_login_t mnt_t:dir r_dir_perms;
|
|
|
|
|
2005-05-02 19:22:58 +00:00
|
|
|
optional_policy(`gpm.te',`
|
2005-06-03 12:25:14 +00:00
|
|
|
allow local_login_t gpmctl_t:sock_file { getattr setattr };
|
2005-05-02 19:22:58 +00:00
|
|
|
')
|
2005-04-28 19:50:58 +00:00
|
|
|
|
|
|
|
# Allow setting of attributes on sound devices.
|
|
|
|
allow local_login_t sound_device_t:chr_file { getattr setattr };
|
|
|
|
|
|
|
|
# Allow setting of attributes on power management devices.
|
|
|
|
allow local_login_t power_device_t:chr_file { getattr setattr };
|
|
|
|
|
|
|
|
#if (use_nfs_home_dirs) {
|
|
|
|
#r_dir_file(local_login_t, nfs_t)
|
|
|
|
#}
|
|
|
|
|
|
|
|
#if (use_samba_home_dirs) {
|
|
|
|
#r_dir_file(local_login_t, cifs_t)
|
|
|
|
#}
|
|
|
|
') dnl endif TODO
|
2005-05-09 15:38:06 +00:00
|
|
|
|
|
|
|
#################################
|
|
|
|
#
|
|
|
|
# Sulogin local policy
|
|
|
|
#
|
|
|
|
|
|
|
|
allow sulogin_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
|
|
|
|
allow sulogin_t self:fd use;
|
2005-06-09 14:26:05 +00:00
|
|
|
allow sulogin_t self:fifo_file rw_file_perms;
|
|
|
|
allow sulogin_t self:unix_dgram_socket create_socket_perms;
|
|
|
|
allow sulogin_t self:unix_stream_socket create_stream_socket_perms;
|
2005-05-09 15:38:06 +00:00
|
|
|
allow sulogin_t self:unix_dgram_socket sendto;
|
|
|
|
allow sulogin_t self:unix_stream_socket connectto;
|
2005-06-09 14:26:05 +00:00
|
|
|
allow sulogin_t self:shm create_shm_perms;
|
|
|
|
allow sulogin_t self:sem create_sem_perms;
|
2005-06-10 01:01:13 +00:00
|
|
|
allow sulogin_t self:msgq create_msgq_perms;
|
2005-05-09 15:38:06 +00:00
|
|
|
allow sulogin_t self:msg { send receive };
|
|
|
|
|
|
|
|
kernel_read_system_state(sulogin_t)
|
|
|
|
|
|
|
|
init_script_get_process_group(sulogin_t)
|
|
|
|
|
|
|
|
files_read_general_system_config(sulogin_t)
|
2005-05-31 21:25:45 +00:00
|
|
|
# because file systems are not mounted:
|
|
|
|
files_ignore_search_isid_type_dir(sulogin_t)
|
2005-05-09 15:38:06 +00:00
|
|
|
|
|
|
|
libraries_use_dynamic_loader(sulogin_t)
|
2005-05-17 15:32:52 +00:00
|
|
|
libraries_use_shared_libraries(sulogin_t)
|
2005-05-09 15:38:06 +00:00
|
|
|
|
|
|
|
logging_send_system_log_message(sulogin_t)
|
|
|
|
|
|
|
|
selinux_read_config(sulogin_t)
|
|
|
|
selinux_read_default_contexts(sulogin_t)
|
|
|
|
|
|
|
|
authlogin_read_shadow_passwords(sulogin_t)
|
|
|
|
|
2005-05-31 19:52:57 +00:00
|
|
|
userdomain_sysadm_shell_transition(sulogin_t)
|
2005-05-24 15:55:57 +00:00
|
|
|
userdomain_use_all_unprivileged_users_file_descriptors(sulogin_t)
|
|
|
|
|
2005-05-09 15:38:06 +00:00
|
|
|
# suse and debian do not use pam with sulogin...
|
|
|
|
ifdef(`monolithic_policy',`
|
2005-06-03 12:25:14 +00:00
|
|
|
ifdef(`distro_suse', `define(`sulogin_no_pam')')
|
|
|
|
ifdef(`distro_debian', `define(`sulogin_no_pam')')
|
2005-05-09 15:38:06 +00:00
|
|
|
') dnl end monolithic_policy
|
|
|
|
|
2005-06-07 18:45:47 +00:00
|
|
|
ifdef(`sulogin_no_pam', `
|
2005-06-03 12:25:14 +00:00
|
|
|
allow sulogin_t self:capability sys_tty_config;
|
|
|
|
init_get_process_group(sulogin_t)
|
2005-05-09 15:38:06 +00:00
|
|
|
', `
|
2005-06-03 12:25:14 +00:00
|
|
|
allow sulogin_t self:process setexec;
|
|
|
|
kernel_get_selinuxfs_mount_point(sulogin_t)
|
2005-06-10 01:01:13 +00:00
|
|
|
kernel_validate_context(sulogin_t)
|
|
|
|
kernel_compute_access_vector(sulogin_t)
|
|
|
|
kernel_compute_create_context(sulogin_t)
|
|
|
|
kernel_compute_relabel_context(sulogin_t)
|
|
|
|
kernel_compute_reachable_user_contexts(sulogin_t)
|
2005-05-09 15:38:06 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
ifdef(`TODO',`
|
2005-05-24 15:55:57 +00:00
|
|
|
|
|
|
|
allow sulogin_t sysadm_devpts_t:chr_file { getattr ioctl read write };
|
|
|
|
|
2005-05-09 15:38:06 +00:00
|
|
|
can_ypbind(sulogin_t)
|
|
|
|
ifdef(`automount.te', `
|
2005-06-03 12:25:14 +00:00
|
|
|
allow sulogin_t autofs_t:dir { search getattr };
|
2005-05-09 15:38:06 +00:00
|
|
|
')
|
|
|
|
|
|
|
|
allow sulogin_t { staff_home_dir_t sysadm_home_dir_t }:dir search;
|
|
|
|
') dnl endif TODO
|