290 lines
8.8 KiB
Plaintext
290 lines
8.8 KiB
Plaintext
|
|
policy_module(locallogin,1.0)
|
|
|
|
########################################
|
|
#
|
|
# Declarations
|
|
#
|
|
|
|
type local_login_t;
|
|
auth_login_entry_type(local_login_t)
|
|
domain_type(local_login_t)
|
|
domain_obj_id_change_exempt(local_login_t)
|
|
domain_subj_id_change_exempt(local_login_t)
|
|
domain_role_change_exempt(local_login_t)
|
|
domain_wide_inherit_fd(local_login_t)
|
|
role system_r types local_login_t;
|
|
|
|
type local_login_lock_t;
|
|
files_lock_file(local_login_lock_t)
|
|
|
|
type local_login_tmp_t;
|
|
files_tmp_file(local_login_tmp_t)
|
|
|
|
type sulogin_t;
|
|
type sulogin_exec_t;
|
|
domain_obj_id_change_exempt(sulogin_t)
|
|
domain_subj_id_change_exempt(sulogin_t)
|
|
domain_role_change_exempt(sulogin_t)
|
|
domain_wide_inherit_fd(sulogin_t)
|
|
init_domain(sulogin_t,sulogin_exec_t)
|
|
init_system_domain(sulogin_t,sulogin_exec_t)
|
|
role system_r types sulogin_t;
|
|
|
|
########################################
|
|
#
|
|
# Local login local policy
|
|
#
|
|
|
|
allow local_login_t self:capability { dac_override chown fowner fsetid kill setgid setuid sys_nice sys_resource sys_tty_config };
|
|
allow local_login_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
|
|
allow local_login_t self:process { setrlimit setexec };
|
|
allow local_login_t self:fd use;
|
|
allow local_login_t self:fifo_file rw_file_perms;
|
|
allow local_login_t self:sock_file r_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;
|
|
allow local_login_t self:unix_dgram_socket sendto;
|
|
allow local_login_t self:unix_stream_socket connectto;
|
|
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;
|
|
allow local_login_t self:msg { send receive };
|
|
|
|
allow local_login_t local_login_lock_t:file create_file_perms;
|
|
files_create_lock(local_login_t,local_login_lock_t)
|
|
|
|
allow local_login_t local_login_tmp_t:dir create_dir_perms;
|
|
allow local_login_t local_login_tmp_t:file create_file_perms;
|
|
files_create_tmp_files(local_login_t, local_login_tmp_t, { file dir })
|
|
|
|
kernel_read_system_state(local_login_t)
|
|
kernel_read_kernel_sysctl(local_login_t)
|
|
|
|
dev_setattr_mouse(local_login_t)
|
|
dev_getattr_mouse(local_login_t)
|
|
dev_getattr_power_management(local_login_t)
|
|
dev_setattr_power_management(local_login_t)
|
|
dev_getattr_snd_dev(local_login_t)
|
|
dev_setattr_snd_dev(local_login_t)
|
|
dev_dontaudit_getattr_apm_bios(local_login_t)
|
|
dev_dontaudit_setattr_apm_bios(local_login_t)
|
|
dev_dontaudit_read_framebuffer(local_login_t)
|
|
dev_dontaudit_setattr_framebuffer(local_login_t)
|
|
dev_dontaudit_getattr_generic_blk_file(local_login_t)
|
|
dev_dontaudit_setattr_generic_blk_file(local_login_t)
|
|
dev_dontaudit_getattr_generic_chr_file(local_login_t)
|
|
dev_dontaudit_setattr_generic_chr_file(local_login_t)
|
|
dev_dontaudit_setattr_generic_symlink(local_login_t)
|
|
dev_dontaudit_getattr_misc(local_login_t)
|
|
dev_dontaudit_setattr_misc(local_login_t)
|
|
dev_dontaudit_getattr_scanner(local_login_t)
|
|
dev_dontaudit_setattr_scanner(local_login_t)
|
|
dev_dontaudit_search_sysfs(local_login_t)
|
|
dev_dontaudit_getattr_video_dev(local_login_t)
|
|
dev_dontaudit_setattr_video_dev(local_login_t)
|
|
# for SSP/ProPolice
|
|
dev_read_urand(local_login_t)
|
|
|
|
fs_search_auto_mountpoints(local_login_t)
|
|
|
|
selinux_get_fs_mount(local_login_t)
|
|
selinux_validate_context(local_login_t)
|
|
selinux_compute_access_vector(local_login_t)
|
|
selinux_compute_create_context(local_login_t)
|
|
selinux_compute_relabel_context(local_login_t)
|
|
selinux_compute_user_contexts(local_login_t)
|
|
|
|
storage_dontaudit_getattr_fixed_disk(local_login_t)
|
|
storage_dontaudit_setattr_fixed_disk(local_login_t)
|
|
storage_dontaudit_getattr_removable_device(local_login_t)
|
|
storage_dontaudit_setattr_removable_device(local_login_t)
|
|
|
|
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)
|
|
|
|
auth_domtrans_chk_passwd(local_login_t)
|
|
auth_dontaudit_read_shadow(local_login_t)
|
|
auth_rw_login_records(local_login_t)
|
|
auth_rw_lastlog(local_login_t)
|
|
auth_rw_faillog(local_login_t)
|
|
auth_exec_pam(local_login_t)
|
|
auth_manage_pam_console_data(local_login_t)
|
|
auth_domtrans_pam_console(local_login_t)
|
|
|
|
corecmd_list_bin(local_login_t)
|
|
corecmd_list_sbin(local_login_t)
|
|
corecmd_read_bin_symlink(local_login_t)
|
|
corecmd_read_sbin_symlink(local_login_t)
|
|
# cjp: these are probably not needed:
|
|
corecmd_read_bin_file(local_login_t)
|
|
corecmd_read_bin_pipe(local_login_t)
|
|
corecmd_read_bin_socket(local_login_t)
|
|
corecmd_read_sbin_file(local_login_t)
|
|
corecmd_read_sbin_pipe(local_login_t)
|
|
corecmd_read_sbin_socket(local_login_t)
|
|
|
|
domain_read_all_entry_files(local_login_t)
|
|
|
|
files_read_etc_files(local_login_t)
|
|
files_read_etc_runtime_files(local_login_t)
|
|
files_read_usr_files(local_login_t)
|
|
files_list_mnt(local_login_t)
|
|
files_list_world_readable(local_login_t)
|
|
files_read_world_readable_files(local_login_t)
|
|
files_read_world_readable_symlinks(local_login_t)
|
|
files_read_world_readable_pipes(local_login_t)
|
|
files_read_world_readable_sockets(local_login_t)
|
|
# for when /var/mail is a symlink
|
|
files_read_var_symlink(local_login_t)
|
|
|
|
init_rw_script_pid(local_login_t)
|
|
init_dontaudit_use_fd(local_login_t)
|
|
|
|
libs_use_ld_so(local_login_t)
|
|
libs_use_shared_libs(local_login_t)
|
|
|
|
logging_send_syslog_msg(local_login_t)
|
|
|
|
miscfiles_read_localization(local_login_t)
|
|
|
|
mls_file_write_down(local_login_t)
|
|
mls_file_upgrade(local_login_t)
|
|
mls_file_downgrade(local_login_t)
|
|
mls_process_set_level(local_login_t)
|
|
|
|
seutil_read_config(local_login_t)
|
|
seutil_read_default_contexts(local_login_t)
|
|
|
|
userdom_spec_domtrans_all_users(local_login_t)
|
|
userdom_signal_all_users(local_login_t)
|
|
userdom_search_all_users_home(local_login_t)
|
|
userdom_use_unpriv_users_fd(local_login_t)
|
|
|
|
# Search for mail spool file.
|
|
mta_getattr_spool(local_login_t)
|
|
|
|
# Red Hat systems seem to have a stray
|
|
# fd open from the initrd
|
|
ifdef(`distro_redhat',`
|
|
kernel_dontaudit_use_fd(local_login_t)
|
|
files_dontaudit_read_root_file(local_login_t)
|
|
')
|
|
|
|
ifdef(`targeted_policy',`
|
|
unconfined_domain_template(local_login_t)
|
|
unconfined_shell_domtrans(local_login_t)
|
|
')
|
|
|
|
tunable_policy(`read_default_t',`
|
|
files_list_default(local_login_t)
|
|
files_read_default_files(local_login_t)
|
|
files_read_default_symlinks(local_login_t)
|
|
files_read_default_sockets(local_login_t)
|
|
files_read_default_pipes(local_login_t)
|
|
')
|
|
|
|
tunable_policy(`use_nfs_home_dirs',`
|
|
fs_read_nfs_files(local_login_t)
|
|
fs_read_nfs_symlinks(local_login_t)
|
|
')
|
|
|
|
tunable_policy(`use_samba_home_dirs',`
|
|
fs_read_cifs_files(local_login_t)
|
|
fs_read_cifs_symlinks(local_login_t)
|
|
')
|
|
|
|
optional_policy(`gpm.te',`
|
|
gpm_getattr_gpmctl(local_login_t)
|
|
gpm_setattr_gpmctl(local_login_t)
|
|
')
|
|
|
|
optional_policy(`nis.te',`
|
|
nis_use_ypbind(local_login_t)
|
|
')
|
|
|
|
optional_policy(`nscd.te',`
|
|
nscd_use_socket(local_login_t)
|
|
')
|
|
|
|
optional_policy(`usermanage.te',`
|
|
usermanage_read_crack_db(local_login_t)
|
|
')
|
|
|
|
ifdef(`TODO',`
|
|
# Login can polyinstantiate
|
|
polyinstantiater(local_login_t)
|
|
|
|
ifdef(`alsa.te', `
|
|
domain_auto_trans($1_login_t, alsa_exec_t, alsa_t)
|
|
')
|
|
') dnl endif TODO
|
|
|
|
#################################
|
|
#
|
|
# Sulogin local policy
|
|
#
|
|
|
|
allow sulogin_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
|
|
allow sulogin_t self:fd use;
|
|
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;
|
|
allow sulogin_t self:unix_dgram_socket sendto;
|
|
allow sulogin_t self:unix_stream_socket connectto;
|
|
allow sulogin_t self:shm create_shm_perms;
|
|
allow sulogin_t self:sem create_sem_perms;
|
|
allow sulogin_t self:msgq create_msgq_perms;
|
|
allow sulogin_t self:msg { send receive };
|
|
|
|
kernel_read_system_state(sulogin_t)
|
|
|
|
fs_search_auto_mountpoints(sulogin_t)
|
|
|
|
files_read_etc_files(sulogin_t)
|
|
# because file systems are not mounted:
|
|
files_dontaudit_search_isid_type_dir(sulogin_t)
|
|
|
|
init_get_script_process_group(sulogin_t)
|
|
|
|
libs_use_ld_so(sulogin_t)
|
|
libs_use_shared_libs(sulogin_t)
|
|
|
|
logging_send_syslog_msg(sulogin_t)
|
|
|
|
seutil_read_config(sulogin_t)
|
|
seutil_read_default_contexts(sulogin_t)
|
|
|
|
auth_read_shadow(sulogin_t)
|
|
|
|
userdom_shell_domtrans_sysadm(sulogin_t)
|
|
userdom_use_unpriv_users_fd(sulogin_t)
|
|
userdom_use_sysadm_pty(sulogin_t)
|
|
userdom_search_staff_home_dir(sulogin_t)
|
|
userdom_search_sysadm_home_dir(sulogin_t)
|
|
|
|
# suse and debian do not use pam with sulogin...
|
|
ifdef(`distro_suse', `define(`sulogin_no_pam')')
|
|
ifdef(`distro_debian', `define(`sulogin_no_pam')')
|
|
|
|
ifdef(`sulogin_no_pam', `
|
|
allow sulogin_t self:capability sys_tty_config;
|
|
init_get_process_group(sulogin_t)
|
|
', `
|
|
allow sulogin_t self:process setexec;
|
|
selinux_get_fs_mount(sulogin_t)
|
|
selinux_validate_context(sulogin_t)
|
|
selinux_compute_access_vector(sulogin_t)
|
|
selinux_compute_create_context(sulogin_t)
|
|
selinux_compute_relabel_context(sulogin_t)
|
|
selinux_compute_user_contexts(sulogin_t)
|
|
')
|
|
|
|
optional_policy(`nis.te',`
|
|
nis_use_ypbind(sulogin_t)
|
|
')
|