|
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 |
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 |
07efe9 |
type local_login_tmp_t;
|
|
Chris PeBenito |
8fd367 |
files_type(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 |
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 |
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_snd_dev(local_login_t)
|
|
Chris PeBenito |
7a2f20 |
dev_setattr_snd_dev(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 |
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 |
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 |
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 |
07efe9 |
|
|
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 |
8fd367 |
files_manage_generic_locks(var_lock_t)
|
|
Chris PeBenito |
ebdc3b |
files_list_mnt(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 |
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 |
07efe9 |
|
|
Chris PeBenito |
4bf4ed |
# Search for mail spool file.
|
|
Chris PeBenito |
c9428d |
mta_getattr_spool(local_login_t)
|
|
Chris PeBenito |
4bf4ed |
|
|
Chris PeBenito |
ab940a |
# Red Hat systems seem to have a stray
|
|
Chris PeBenito |
ab940a |
# fd open from the initrd
|
|
Chris PeBenito |
ab940a |
ifdef(`distro_redhat',`
|
|
Chris PeBenito |
ab940a |
kernel_dontaudit_use_fd(local_login_t)
|
|
Chris PeBenito |
ab940a |
files_dontaudit_read_root_file(local_login_t)
|
|
Chris PeBenito |
ab940a |
')
|
|
Chris PeBenito |
ab940a |
|
|
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 |
ab940a |
optional_policy(`nis.te',`
|
|
Chris PeBenito |
ab940a |
nis_use_ypbind(local_login_t)
|
|
Chris PeBenito |
d115b2 |
')
|
|
Chris PeBenito |
d115b2 |
|
|
Chris PeBenito |
ebdc3b |
optional_policy(`usermanage.te',`
|
|
Chris PeBenito |
ebdc3b |
usermanage_read_crack_db(local_login_t)
|
|
Chris PeBenito |
ebdc3b |
')
|
|
Chris PeBenito |
ebdc3b |
|
|
Chris PeBenito |
07efe9 |
ifdef(`TODO',`
|
|
Chris PeBenito |
dc771f |
|
|
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 |
3eed10 |
|
|
Chris PeBenito |
3eed10 |
tunable_policy(`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 |
3eed10 |
')
|
|
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 |
ebdc3b |
# Do not audit denied attempts to access devices.
|
|
Chris PeBenito |
ebdc3b |
dontaudit local_login_t device_t:lnk_file { getattr setattr };
|
|
Chris PeBenito |
ebdc3b |
dontaudit local_login_t framebuf_device_t:chr_file { getattr setattr read };
|
|
Chris PeBenito |
ebdc3b |
dontaudit local_login_t apm_bios_t:chr_file { getattr setattr };
|
|
Chris PeBenito |
ebdc3b |
dontaudit local_login_t v4l_device_t:chr_file { getattr setattr read };
|
|
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 |
|
|
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 |
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 |
') 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 |
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 |
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 |
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 |
ab940a |
optional_policy(`nis.te',`
|
|
Chris PeBenito |
ab940a |
nis_use_ypbind(sulogin_t)
|
|
Chris PeBenito |
5d7e8b |
')
|
|
Chris PeBenito |
5d7e8b |
|
|
Chris PeBenito |
ab940a |
ifdef(`TODO',`
|
|
Chris PeBenito |
ab940a |
allow sulogin_t sysadm_devpts_t:chr_file { getattr ioctl read write };
|
|
Chris PeBenito |
5d7e8b |
allow sulogin_t { staff_home_dir_t sysadm_home_dir_t }:dir search;
|
|
Chris PeBenito |
5d7e8b |
') dnl endif TODO
|