Chris PeBenito 849380
# Copyright (C) 2005 Tresys Technology, LLC
Chris PeBenito 849380
Chris PeBenito 849380
policy_module(usermanage,1.0)
Chris PeBenito 849380
Chris PeBenito 849380
########################################
Chris PeBenito 849380
#
Chris PeBenito 849380
# Declarations
Chris PeBenito 849380
#
Chris PeBenito 849380
Chris PeBenito 849380
type admin_passwd_exec_t;
Chris PeBenito 849380
files_make_file(admin_passwd_exec_t)
Chris PeBenito 849380
Chris PeBenito a1f94a
type chfn_t;
Chris PeBenito 18f25a
kernel_make_object_identity_change_constraint_exception(chfn_t)
Chris PeBenito 849380
domain_make_domain(chfn_t)
Chris PeBenito 849380
role system_r types chfn_t;
Chris PeBenito 849380
Chris PeBenito 849380
type chfn_exec_t;
Chris PeBenito 849380
domain_make_entrypoint_file(chfn_t,chfn_exec_t)
Chris PeBenito 849380
Chris PeBenito 849380
type crack_t;
Chris PeBenito 849380
role system_r types crack_t;
Chris PeBenito 849380
Chris PeBenito 849380
type crack_exec_t;
Chris PeBenito 849380
domain_make_entrypoint_file(crack_t,crack_exec_t)
Chris PeBenito 849380
Chris PeBenito 849380
type crack_db_t; #, usercanread;
Chris PeBenito 849380
files_make_file(crack_db_t)
Chris PeBenito 849380
Chris PeBenito 849380
type crack_tmp_t;
Chris PeBenito 38e24a
files_make_temporary_file(crack_tmp_t)
Chris PeBenito 849380
Chris PeBenito 18f25a
type groupadd_t; #, nscd_client_domain;
Chris PeBenito 849380
type groupadd_exec_t;
Chris PeBenito 18f25a
kernel_make_object_identity_change_constraint_exception(groupadd_t)
Chris PeBenito ff3138
init_make_system_domain(groupadd_t,groupadd_exec_t)
Chris PeBenito bbd6a6
role system_r types groupadd_t;
Chris PeBenito 849380
Chris PeBenito a1f94a
type passwd_t;
Chris PeBenito 18f25a
kernel_make_object_identity_change_constraint_exception(passwd_t)
Chris PeBenito 849380
domain_make_domain(passwd_t)
Chris PeBenito 849380
role system_r types passwd_t;
Chris PeBenito 849380
Chris PeBenito 849380
type passwd_exec_t;
Chris PeBenito 849380
domain_make_entrypoint_file(passwd_t,passwd_exec_t)
Chris PeBenito 849380
Chris PeBenito a1f94a
type sysadm_passwd_t;
Chris PeBenito 18f25a
kernel_make_object_identity_change_constraint_exception(sysadm_passwd_t)
Chris PeBenito 849380
domain_make_domain(sysadm_passwd_t)
Chris PeBenito 849380
domain_make_entrypoint_file(sysadm_passwd_t,admin_passwd_exec_t)
Chris PeBenito 849380
Chris PeBenito 849380
type sysadm_passwd_tmp_t;
Chris PeBenito 849380
files_make_file(sysadm_passwd_tmp_t)
Chris PeBenito 849380
Chris PeBenito 18f25a
type useradd_t; # nscd_client_domain;
Chris PeBenito 849380
type useradd_exec_t;
Chris PeBenito 18f25a
kernel_make_object_identity_change_constraint_exception(useradd_t)
Chris PeBenito ff3138
init_make_system_domain(useradd_t,useradd_exec_t)
Chris PeBenito bbd6a6
role system_r types useradd_t;
Chris PeBenito 849380
Chris PeBenito 849380
########################################
Chris PeBenito 849380
#
Chris PeBenito 849380
# Chfn local policy
Chris PeBenito 849380
#
Chris PeBenito 849380
Chris PeBenito 849380
allow chfn_t self:capability { chown dac_override fsetid setuid setgid sys_resource };
Chris PeBenito 849380
allow chfn_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
Chris PeBenito 849380
allow chfn_t self:process { setrlimit setfscreate };
Chris PeBenito 849380
allow chfn_t self:fd use;
Chris PeBenito 849380
allow chfn_t self:fifo_file { read getattr lock ioctl write append };
Chris PeBenito 849380
allow chfn_t self:unix_dgram_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
Chris PeBenito 849380
allow chfn_t self:unix_stream_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown listen accept };
Chris PeBenito 849380
allow chfn_t self:unix_dgram_socket sendto;
Chris PeBenito 849380
allow chfn_t self:unix_stream_socket connectto;
Chris PeBenito 849380
allow chfn_t self:shm { associate getattr setattr create destroy read write lock unix_read unix_write };
Chris PeBenito 849380
allow chfn_t self:sem { associate getattr setattr create destroy read write unix_read unix_write };
Chris PeBenito 849380
allow chfn_t self:msgq { associate getattr setattr create destroy read write enqueue unix_read unix_write };
Chris PeBenito 849380
allow chfn_t self:msg { send receive };
Chris PeBenito 849380
Chris PeBenito 849380
kernel_read_system_state(chfn_t)
Chris PeBenito 849380
kernel_get_selinuxfs_mount_point(chfn_t)
Chris PeBenito 849380
kernel_validate_selinux_context(chfn_t)
Chris PeBenito 178607
kernel_compute_selinux_access_vector(chfn_t)
Chris PeBenito 178607
kernel_compute_selinux_create_context(chfn_t)
Chris PeBenito 178607
kernel_compute_selinux_relabel_context(chfn_t)
Chris PeBenito 178607
kernel_compute_selinux_reachable_user_contexts(chfn_t)
Chris PeBenito 849380
Chris PeBenito b16c6b
terminal_use_all_private_physical_terminals(chfn_t)
Chris PeBenito b16c6b
terminal_use_all_private_pseudoterminals(chfn_t)
Chris PeBenito 849380
Chris PeBenito 849380
filesystem_get_persistent_filesystem_attributes(chfn_t)
Chris PeBenito 849380
Chris PeBenito 849380
# for SSP
Chris PeBenito 849380
devices_get_pseudorandom_data(chfn_t)
Chris PeBenito 849380
Chris PeBenito 849380
# /usr/bin/passwd asks for w access to utmp, but it will operate
Chris PeBenito 849380
# correctly without it.  Do not audit write denials to utmp.
Chris PeBenito 849380
init_script_ignore_modify_runtime_data(chfn_t)
Chris PeBenito 849380
Chris PeBenito 849380
domain_use_widely_inheritable_file_descriptors(chfn_t)
Chris PeBenito 849380
Chris PeBenito 849380
files_manage_general_system_config(chfn_t)
Chris PeBenito 849380
files_read_runtime_system_config(chfn_t)
Chris PeBenito 849380
Chris PeBenito 849380
libraries_use_dynamic_loader(chfn_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(chfn_t)
Chris PeBenito 849380
Chris PeBenito 849380
miscfiles_read_localization(chfn_t)
Chris PeBenito 849380
Chris PeBenito 849380
logging_send_system_log_message(chfn_t)
Chris PeBenito 849380
Chris PeBenito a1f94a
authlogin_check_password_transition(chfn_t)
Chris PeBenito 849380
authlogin_ignore_read_shadow_passwords(chfn_t)
Chris PeBenito 849380
Chris PeBenito 849380
ifdef(`TODO',`
Chris PeBenito 849380
role sysadm_r types chfn_t;
Chris PeBenito 849380
in_user_role(chfn_t)
Chris PeBenito 849380
Chris PeBenito 849380
domain_auto_trans({ userdomain ifdef(`firstboot.te', `firstboot_t') }, chfn_exec_t, chfn_t)
Chris PeBenito 849380
Chris PeBenito 849380
dontaudit chfn_t var_t:dir search;
Chris PeBenito 849380
Chris PeBenito 849380
allow chfn_t unpriv_userdomain:fd use;
Chris PeBenito 849380
can_ypbind(chfn_t)
Chris PeBenito 849380
ifdef(`automount.te', `
Chris PeBenito 849380
allow chfn_t autofs_t:dir { search getattr };
Chris PeBenito 849380
')
Chris PeBenito 849380
Chris PeBenito 849380
ifdef(`gnome-pty-helper.te', `allow chfn_t gphdomain:fd use;')
Chris PeBenito 849380
Chris PeBenito 849380
# allow checking if a shell is executable
Chris PeBenito 849380
allow chfn_t shell_exec_t:file execute;
Chris PeBenito 849380
Chris PeBenito 849380
# user generally runs this from their home directory, so do not audit a search
Chris PeBenito 849380
# on user home dir
Chris PeBenito 849380
dontaudit chfn_t { user_home_dir_type user_home_type }:dir search;
Chris PeBenito 849380
Chris PeBenito 849380
# can exec /sbin/unix_chkpwd
Chris PeBenito 849380
allow chfn_t { bin_t sbin_t }:dir search;
Chris PeBenito 849380
Chris PeBenito 849380
# uses unix_chkpwd for checking passwords
Chris PeBenito 849380
dontaudit chfn_t selinux_config_t:dir search;
Chris PeBenito 849380
') dnl endif TODO
Chris PeBenito 849380
Chris PeBenito 849380
########################################
Chris PeBenito 849380
#
Chris PeBenito 849380
# Crack local policy
Chris PeBenito 849380
#
Chris PeBenito 849380
Chris PeBenito 849380
allow crack_t self:process { sigkill sigstop signull signal };
Chris PeBenito 849380
allow crack_t self:fifo_file { read write getattr };
Chris PeBenito 849380
Chris PeBenito 849380
allow crack_t crack_db_t:dir { read getattr lock search ioctl add_name remove_name write };
Chris PeBenito 849380
allow crack_t crack_db_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 849380
allow crack_t crack_db_t:lnk_file { create read getattr setattr link unlink rename };
Chris PeBenito 849380
files_search_system_state_data_directory(crack_t)
Chris PeBenito 849380
Chris PeBenito 849380
allow crack_t crack_tmp_t:dir { create read getattr lock setattr ioctl link unlink rename search add_name remove_name reparent write rmdir };
Chris PeBenito 849380
allow crack_t crack_tmp_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 849380
files_create_private_tmp_data(crack_t, crack_tmp_t, { file dir })
Chris PeBenito 849380
Chris PeBenito 849380
kernel_read_system_state(crack_t)
Chris PeBenito 849380
Chris PeBenito 849380
# for SSP
Chris PeBenito 849380
devices_get_pseudorandom_data(crack_t)
Chris PeBenito 849380
Chris PeBenito 849380
filesystem_get_persistent_filesystem_attributes(crack_t)
Chris PeBenito 849380
Chris PeBenito 849380
files_read_general_system_config(crack_t)
Chris PeBenito 849380
files_read_runtime_system_config(crack_t)
Chris PeBenito 849380
# for dictionaries
Chris PeBenito 849380
files_read_general_application_resources(crack_t)
Chris PeBenito 849380
Chris PeBenito 849380
corecommands_execute_general_programs(crack_t)
Chris PeBenito 849380
Chris PeBenito 849380
libraries_use_dynamic_loader(crack_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(crack_t)
Chris PeBenito 849380
Chris PeBenito 849380
logging_send_system_log_message(crack_t)
Chris PeBenito 849380
Chris PeBenito 849380
ifdef(`TODO',`
Chris PeBenito 849380
ifdef(`crond.te', `
Chris PeBenito 849380
domain_auto_trans(system_crond_t, crack_exec_t, crack_t)
Chris PeBenito 849380
allow crack_t crond_t:fifo_file { getattr read write ioctl };
Chris PeBenito 849380
# a rule for privfd may make this obsolete
Chris PeBenito 849380
allow crack_t crond_t:fd use;
Chris PeBenito 849380
allow crack_t crond_t:process sigchld;
Chris PeBenito 849380
')
Chris PeBenito 849380
Chris PeBenito 849380
dontaudit crack_t sysadm_home_dir_t:dir { getattr search };
Chris PeBenito 849380
') dnl endif TODO
Chris PeBenito 849380
Chris PeBenito 849380
########################################
Chris PeBenito 849380
#
Chris PeBenito 849380
# Groupadd local policy
Chris PeBenito 849380
#
Chris PeBenito 849380
Chris PeBenito 849380
allow groupadd_t self:capability { dac_override chown kill setuid sys_resource };
Chris PeBenito 849380
dontaudit groupadd_t self:capability fsetid;
Chris PeBenito 849380
allow groupadd_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
Chris PeBenito 849380
allow groupadd_t self:process { setrlimit setfscreate };
Chris PeBenito 849380
allow groupadd_t self:fd use;
Chris PeBenito 849380
allow groupadd_t self:fifo_file { read getattr lock ioctl write append };
Chris PeBenito 849380
allow groupadd_t self:unix_dgram_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
Chris PeBenito 849380
allow groupadd_t self:unix_stream_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown listen accept };
Chris PeBenito 849380
allow groupadd_t self:unix_dgram_socket sendto;
Chris PeBenito 849380
allow groupadd_t self:unix_stream_socket connectto;
Chris PeBenito 849380
allow groupadd_t self:shm { associate getattr setattr create destroy read write lock unix_read unix_write };
Chris PeBenito 849380
allow groupadd_t self:sem { associate getattr setattr create destroy read write unix_read unix_write };
Chris PeBenito 849380
allow groupadd_t self:msgq { associate getattr setattr create destroy read write enqueue unix_read unix_write };
Chris PeBenito 849380
allow groupadd_t self:msg { send receive };
Chris PeBenito 849380
Chris PeBenito 849380
# Allow access to context for shadow file
Chris PeBenito 849380
kernel_get_selinuxfs_mount_point(groupadd_t)
Chris PeBenito 849380
kernel_validate_selinux_context(groupadd_t)
Chris PeBenito 178607
kernel_compute_selinux_access_vector(groupadd_t)
Chris PeBenito 178607
kernel_compute_selinux_create_context(groupadd_t)
Chris PeBenito 178607
kernel_compute_selinux_relabel_context(groupadd_t)
Chris PeBenito 178607
kernel_compute_selinux_reachable_user_contexts(groupadd_t)
Chris PeBenito 849380
Chris PeBenito 849380
filesystem_get_persistent_filesystem_attributes(groupadd_t)
Chris PeBenito 849380
Chris PeBenito b16c6b
terminal_use_all_private_physical_terminals(groupadd_t)
Chris PeBenito b16c6b
terminal_use_all_private_pseudoterminals(groupadd_t)
Chris PeBenito 849380
Chris PeBenito 849380
init_use_file_descriptors(groupadd_t)
Chris PeBenito 849380
init_script_read_runtime_data(groupadd_t)
Chris PeBenito 849380
Chris PeBenito 849380
domain_use_widely_inheritable_file_descriptors(groupadd_t)
Chris PeBenito 849380
Chris PeBenito 849380
files_manage_general_system_config(groupadd_t)
Chris PeBenito 849380
Chris PeBenito 849380
libraries_use_dynamic_loader(groupadd_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(groupadd_t)
Chris PeBenito 849380
Chris PeBenito 849380
# Execute /usr/bin/{passwd,chfn,chsh} and /usr/sbin/{useradd,vipw}.
Chris PeBenito 849380
corecommands_execute_general_programs(groupadd_t)
Chris PeBenito 849380
corecommands_execute_system_programs(groupadd_t)
Chris PeBenito 849380
Chris PeBenito 849380
logging_send_system_log_message(groupadd_t)
Chris PeBenito 849380
Chris PeBenito 849380
miscfiles_read_localization(groupadd_t)
Chris PeBenito 849380
Chris PeBenito 13e94c
authlogin_manage_shadow_passwords(groupadd_t)
Chris PeBenito 849380
authlogin_modify_last_login_log(groupadd_t)
Chris PeBenito 849380
Chris PeBenito 849380
selinux_read_config(groupadd_t)
Chris PeBenito 849380
Chris PeBenito 849380
ifdef(`TODO',`
Chris PeBenito 849380
role sysadm_r types groupadd_t;
Chris PeBenito 849380
domain_auto_trans(sysadm_t, groupadd_exec_t, groupadd_t)
Chris PeBenito 849380
Chris PeBenito 849380
allow groupadd_t unpriv_userdomain:fd use;
Chris PeBenito 849380
can_ypbind(groupadd_t)
Chris PeBenito 849380
ifdef(`automount.te', `
Chris PeBenito 849380
allow groupadd_t autofs_t:dir { search getattr };
Chris PeBenito 849380
')
Chris PeBenito 849380
Chris PeBenito 849380
# Update /etc/shadow and /etc/passwd
Chris PeBenito 849380
allow groupadd_t { etc_t shadow_t }:file { relabelfrom relabelto };
Chris PeBenito 849380
Chris PeBenito 849380
# Access terminals.
Chris PeBenito 849380
ifdef(`gnome-pty-helper.te', `allow groupadd_t gphdomain:fd use;')
Chris PeBenito 849380
Chris PeBenito 849380
# for when /root is the cwd
Chris PeBenito 849380
dontaudit groupadd_t sysadm_home_dir_t:dir search;
Chris PeBenito 849380
dontaudit groupadd_t initrc_var_run_t:file write;
Chris PeBenito 849380
') dnl end TODO
Chris PeBenito 849380
Chris PeBenito 849380
########################################
Chris PeBenito 849380
#
Chris PeBenito 849380
# Passwd local policy
Chris PeBenito 849380
#
Chris PeBenito 849380
Chris PeBenito 849380
allow passwd_t self:capability { chown dac_override fsetid setuid setgid sys_resource };
Chris PeBenito 849380
allow passwd_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
Chris PeBenito 849380
allow passwd_t self:process { setrlimit setfscreate };
Chris PeBenito 849380
allow passwd_t self:fd use;
Chris PeBenito 849380
allow passwd_t self:fifo_file { read getattr lock ioctl write append };
Chris PeBenito 849380
allow passwd_t self:unix_dgram_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
Chris PeBenito 849380
allow passwd_t self:unix_stream_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown listen accept };
Chris PeBenito 849380
allow passwd_t self:unix_dgram_socket sendto;
Chris PeBenito 849380
allow passwd_t self:unix_stream_socket connectto;
Chris PeBenito 849380
allow passwd_t self:shm { associate getattr setattr create destroy read write lock unix_read unix_write };
Chris PeBenito 849380
allow passwd_t self:sem { associate getattr setattr create destroy read write unix_read unix_write };
Chris PeBenito 849380
allow passwd_t self:msgq { associate getattr setattr create destroy read write enqueue unix_read unix_write };
Chris PeBenito 849380
allow passwd_t self:msg { send receive };
Chris PeBenito 849380
Chris PeBenito 849380
kernel_get_selinuxfs_mount_point(passwd_t)
Chris PeBenito 849380
kernel_validate_selinux_context(passwd_t)
Chris PeBenito 178607
kernel_compute_selinux_access_vector(passwd_t)
Chris PeBenito 178607
kernel_compute_selinux_create_context(passwd_t)
Chris PeBenito 178607
kernel_compute_selinux_relabel_context(passwd_t)
Chris PeBenito 178607
kernel_compute_selinux_reachable_user_contexts(passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
# for SSP
Chris PeBenito 849380
devices_get_pseudorandom_data(passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
filesystem_get_persistent_filesystem_attributes(passwd_t)
Chris PeBenito 849380
Chris PeBenito b16c6b
terminal_use_all_private_physical_terminals(passwd_t)
Chris PeBenito b16c6b
terminal_use_all_private_pseudoterminals(passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
# /usr/bin/passwd asks for w access to utmp, but it will operate
Chris PeBenito 849380
# correctly without it.  Do not audit write denials to utmp.
Chris PeBenito 849380
init_script_ignore_modify_runtime_data(passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
domain_use_widely_inheritable_file_descriptors(passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
files_read_runtime_system_config(passwd_t)
Chris PeBenito 849380
files_manage_general_system_config(passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
libraries_use_dynamic_loader(passwd_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
logging_send_system_log_message(passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
miscfiles_read_localization(passwd_t)
Chris PeBenito 849380
Chris PeBenito a1f94a
authlogin_manage_shadow_passwords(passwd_t)
Chris PeBenito a1f94a
Chris PeBenito 849380
ifdef(`TODO',`
Chris PeBenito 849380
role sysadm_r types passwd_t;
Chris PeBenito 849380
Chris PeBenito 849380
# Update /etc/shadow and /etc/passwd
Chris PeBenito 849380
allow passwd_t { etc_t shadow_t }:file { relabelfrom relabelto };
Chris PeBenito 849380
Chris PeBenito 849380
allow passwd_t unpriv_userdomain:fd use;
Chris PeBenito 849380
can_ypbind(passwd_t)
Chris PeBenito 849380
ifdef(`automount.te', `
Chris PeBenito 849380
allow passwd_t autofs_t:dir { search getattr };
Chris PeBenito 849380
')
Chris PeBenito 849380
Chris PeBenito 849380
# Inherit and use descriptors from login.
Chris PeBenito 849380
ifdef(`gnome-pty-helper.te', `allow passwd_t gphdomain:fd use;')
Chris PeBenito 849380
Chris PeBenito 849380
# allow checking if a shell is executable
Chris PeBenito 849380
allow passwd_t shell_exec_t:file execute;
Chris PeBenito 849380
Chris PeBenito 849380
# user generally runs this from their home directory, so do not audit a search
Chris PeBenito 849380
# on user home dir
Chris PeBenito 849380
dontaudit passwd_t { user_home_dir_type user_home_type }:dir search;
Chris PeBenito 849380
in_user_role(passwd_t)
Chris PeBenito 849380
# make sure that getcon succeeds
Chris PeBenito 849380
allow passwd_t userdomain:dir search;
Chris PeBenito 849380
allow passwd_t userdomain:file read;
Chris PeBenito 849380
allow passwd_t userdomain:process getattr;
Chris PeBenito 849380
Chris PeBenito 849380
dontaudit passwd_t selinux_config_t:dir search;
Chris PeBenito 849380
Chris PeBenito 849380
ifdef(`crack.te', `
Chris PeBenito 849380
allow passwd_t var_t:dir search;
Chris PeBenito 849380
dontaudit passwd_t var_run_t:dir search;
Chris PeBenito 849380
allow passwd_t crack_db_t:dir r_dir_perms;
Chris PeBenito 849380
allow passwd_t crack_db_t:file r_file_perms;
Chris PeBenito 849380
', `
Chris PeBenito 849380
dontaudit passwd_t var_t:dir search;
Chris PeBenito 849380
')
Chris PeBenito 849380
domain_auto_trans({ userdomain ifdef(`firstboot.te', `firstboot_t') }, passwd_exec_t, passwd_t)
Chris PeBenito 849380
') dnl endif TODO
Chris PeBenito 849380
Chris PeBenito 849380
########################################
Chris PeBenito 849380
#
Chris PeBenito 849380
# Password admin local policy
Chris PeBenito 849380
#
Chris PeBenito 849380
Chris PeBenito 849380
allow sysadm_passwd_t self:capability { chown dac_override fsetid setuid setgid sys_resource };
Chris PeBenito 849380
allow sysadm_passwd_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
Chris PeBenito 849380
allow sysadm_passwd_t self:process { setrlimit setfscreate };
Chris PeBenito 849380
allow sysadm_passwd_t self:fd use;
Chris PeBenito 849380
allow sysadm_passwd_t self:fifo_file { read getattr lock ioctl write append };
Chris PeBenito 849380
allow sysadm_passwd_t self:unix_dgram_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
Chris PeBenito 849380
allow sysadm_passwd_t self:unix_stream_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown listen accept };
Chris PeBenito 849380
allow sysadm_passwd_t self:unix_dgram_socket sendto;
Chris PeBenito 849380
allow sysadm_passwd_t self:unix_stream_socket connectto;
Chris PeBenito 849380
allow sysadm_passwd_t self:shm { associate getattr setattr create destroy read write lock unix_read unix_write };
Chris PeBenito 849380
allow sysadm_passwd_t self:sem { associate getattr setattr create destroy read write unix_read unix_write };
Chris PeBenito 849380
allow sysadm_passwd_t self:msgq { associate getattr setattr create destroy read write enqueue unix_read unix_write };
Chris PeBenito 849380
allow sysadm_passwd_t self:msg { send receive };
Chris PeBenito 849380
Chris PeBenito 849380
# allow vipw to create temporary files under /var/tmp/vi.recover
Chris PeBenito 849380
allow sysadm_passwd_t sysadm_passwd_tmp_t:dir { create read getattr lock setattr ioctl link unlink rename search add_name remove_name reparent write rmdir };
Chris PeBenito 849380
allow sysadm_passwd_t sysadm_passwd_tmp_t:file { create ioctl read getattr lock write setattr append link unlink rename };
Chris PeBenito 849380
files_create_private_tmp_data(sysadm_passwd_t, sysadm_passwd_tmp_t, { file dir })
Chris PeBenito 849380
files_search_system_state_data_directory(sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
kernel_get_selinuxfs_mount_point(sysadm_passwd_t)
Chris PeBenito 849380
kernel_validate_selinux_context(sysadm_passwd_t)
Chris PeBenito 178607
kernel_compute_selinux_access_vector(sysadm_passwd_t)
Chris PeBenito 178607
kernel_compute_selinux_create_context(sysadm_passwd_t)
Chris PeBenito 178607
kernel_compute_selinux_relabel_context(sysadm_passwd_t)
Chris PeBenito 178607
kernel_compute_selinux_reachable_user_contexts(sysadm_passwd_t)
Chris PeBenito 849380
# for /proc/meminfo
Chris PeBenito 849380
kernel_read_system_state(sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
# for SSP
Chris PeBenito 849380
devices_get_pseudorandom_data(sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
filesystem_get_persistent_filesystem_attributes(sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito b16c6b
terminal_use_all_private_physical_terminals(sysadm_passwd_t)
Chris PeBenito b16c6b
terminal_use_all_private_pseudoterminals(sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
# /usr/bin/passwd asks for w access to utmp, but it will operate
Chris PeBenito 849380
# correctly without it.  Do not audit write denials to utmp.
Chris PeBenito 849380
init_script_ignore_modify_runtime_data(sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
domain_use_widely_inheritable_file_descriptors(sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
files_manage_general_system_config(sysadm_passwd_t)
Chris PeBenito 849380
files_read_runtime_system_config(sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
# allow vipw to exec the editor
Chris PeBenito 849380
corecommands_execute_general_programs(sysadm_passwd_t)
Chris PeBenito 849380
corecommands_execute_shell(sysadm_passwd_t)
Chris PeBenito 849380
files_read_general_application_resources(sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
libraries_use_dynamic_loader(sysadm_passwd_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
miscfiles_read_localization(sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
logging_send_system_log_message(sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito a1f94a
authlogin_manage_shadow_passwords(sysadm_passwd_t)
Chris PeBenito a1f94a
Chris PeBenito 849380
ifdef(`TODO',`
Chris PeBenito 849380
role sysadm_r types sysadm_passwd_t;
Chris PeBenito 849380
domain_auto_trans(sysadm_t, admin_passwd_exec_t, sysadm_passwd_t)
Chris PeBenito 849380
Chris PeBenito 849380
allow sysadm_passwd_t unpriv_userdomain:fd use;
Chris PeBenito 849380
can_ypbind(sysadm_passwd_t)
Chris PeBenito 849380
ifdef(`automount.te', `
Chris PeBenito 849380
allow sysadm_passwd_t autofs_t:dir { search getattr };
Chris PeBenito 849380
')
Chris PeBenito 849380
Chris PeBenito 849380
# Inherit and use descriptors from login.
Chris PeBenito 849380
ifdef(`gnome-pty-helper.te', `allow sysadm_passwd_t gphdomain:fd use;')
Chris PeBenito 849380
Chris PeBenito 849380
# allow checking if a shell is executable
Chris PeBenito 849380
allow sysadm_passwd_t shell_exec_t:file execute;
Chris PeBenito 849380
Chris PeBenito 849380
# user generally runs this from their home directory, so do not audit a search
Chris PeBenito 849380
# on user home dir
Chris PeBenito 849380
dontaudit sysadm_passwd_t { user_home_dir_type user_home_type }:dir search;
Chris PeBenito 849380
Chris PeBenito 849380
# Update /etc/shadow and /etc/passwd
Chris PeBenito 849380
allow sysadm_passwd_t { etc_t shadow_t }:file { relabelfrom relabelto };
Chris PeBenito 849380
Chris PeBenito 849380
# for vipw - vi looks in the root home directory for config
Chris PeBenito 849380
dontaudit sysadm_passwd_t sysadm_home_dir_t:dir { getattr search };
Chris PeBenito 849380
Chris PeBenito 849380
# for nscd lookups
Chris PeBenito 849380
dontaudit sysadm_passwd_t var_run_t:dir search;
Chris PeBenito 849380
Chris PeBenito 849380
dontaudit sysadm_passwd_t selinux_config_t:dir search;
Chris PeBenito 849380
') dnl endif TODO
Chris PeBenito 849380
Chris PeBenito 849380
########################################
Chris PeBenito 849380
#
Chris PeBenito 849380
# Useradd local policy
Chris PeBenito 849380
#
Chris PeBenito 849380
Chris PeBenito 849380
allow useradd_t self:capability { dac_override chown kill fowner fsetid setuid sys_resource };
Chris PeBenito 849380
allow useradd_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem dyntransition };
Chris PeBenito 849380
allow useradd_t self:process setfscreate;
Chris PeBenito 849380
allow useradd_t self:fd use;
Chris PeBenito 849380
allow useradd_t self:fifo_file { read getattr lock ioctl write append };
Chris PeBenito 849380
allow useradd_t self:unix_dgram_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown };
Chris PeBenito 849380
allow useradd_t self:unix_stream_socket { create ioctl read getattr write setattr append bind connect getopt setopt shutdown listen accept };
Chris PeBenito 849380
allow useradd_t self:unix_dgram_socket sendto;
Chris PeBenito 849380
allow useradd_t self:unix_stream_socket connectto;
Chris PeBenito 849380
allow useradd_t self:shm { associate getattr setattr create destroy read write lock unix_read unix_write };
Chris PeBenito 849380
allow useradd_t self:sem { associate getattr setattr create destroy read write unix_read unix_write };
Chris PeBenito 849380
allow useradd_t self:msgq { associate getattr setattr create destroy read write enqueue unix_read unix_write };
Chris PeBenito 849380
allow useradd_t self:msg { send receive };
Chris PeBenito 849380
Chris PeBenito 849380
# Allow access to context for shadow file
Chris PeBenito 849380
kernel_get_selinuxfs_mount_point(useradd_t)
Chris PeBenito 849380
kernel_validate_selinux_context(useradd_t)
Chris PeBenito 178607
kernel_compute_selinux_access_vector(useradd_t)
Chris PeBenito 178607
kernel_compute_selinux_create_context(useradd_t)
Chris PeBenito 178607
kernel_compute_selinux_relabel_context(useradd_t)
Chris PeBenito 178607
kernel_compute_selinux_reachable_user_contexts(useradd_t)
Chris PeBenito 849380
# for getting the number of groups
Chris PeBenito 849380
kernel_read_kernel_sysctl(useradd_t)
Chris PeBenito 849380
Chris PeBenito 849380
filesystem_get_persistent_filesystem_attributes(useradd_t)
Chris PeBenito 849380
Chris PeBenito b16c6b
terminal_use_all_private_physical_terminals(useradd_t)
Chris PeBenito b16c6b
terminal_use_all_private_pseudoterminals(useradd_t)
Chris PeBenito 849380
Chris PeBenito 849380
init_use_file_descriptors(useradd_t)
Chris PeBenito 849380
init_script_modify_runtime_data(useradd_t)
Chris PeBenito 849380
Chris PeBenito 849380
domain_use_widely_inheritable_file_descriptors(useradd_t)
Chris PeBenito 849380
Chris PeBenito 849380
files_manage_general_system_config(useradd_t)
Chris PeBenito 849380
Chris PeBenito 849380
libraries_use_dynamic_loader(useradd_t)
Chris PeBenito dd14d0
libraries_use_shared_libraries(useradd_t)
Chris PeBenito 849380
Chris PeBenito 849380
corecommands_execute_shell(useradd_t)
Chris PeBenito 849380
# Execute /usr/bin/{passwd,chfn,chsh} and /usr/sbin/{useradd,vipw}.
Chris PeBenito 849380
corecommands_execute_general_programs(useradd_t)
Chris PeBenito 849380
corecommands_execute_system_programs(useradd_t)
Chris PeBenito 849380
Chris PeBenito 849380
miscfiles_read_localization(useradd_t)
Chris PeBenito 849380
Chris PeBenito 849380
selinux_read_config(useradd_t)
Chris PeBenito 849380
Chris PeBenito 849380
logging_send_system_log_message(useradd_t)
Chris PeBenito 849380
Chris PeBenito 13e94c
authlogin_manage_shadow_passwords(useradd_t)
Chris PeBenito 849380
authlogin_modify_last_login_log(useradd_t)
Chris PeBenito 849380
Chris PeBenito 849380
ifdef(`TODO',`
Chris PeBenito 849380
Chris PeBenito 849380
role sysadm_r types useradd_t;
Chris PeBenito 849380
domain_auto_trans(sysadm_t, useradd_exec_t, useradd_t)
Chris PeBenito 849380
Chris PeBenito 849380
allow useradd_t unpriv_userdomain:fd use;
Chris PeBenito 849380
can_ypbind(useradd_t)
Chris PeBenito 849380
ifdef(`automount.te', `
Chris PeBenito 849380
allow useradd_t autofs_t:dir { search getattr };
Chris PeBenito 849380
')
Chris PeBenito 849380
Chris PeBenito 849380
# Update /etc/shadow and /etc/passwd
Chris PeBenito 849380
allow useradd_t { etc_t shadow_t }:file { relabelfrom relabelto };
Chris PeBenito 849380
Chris PeBenito 849380
# Access terminals.
Chris PeBenito 849380
ifdef(`gnome-pty-helper.te', `allow useradd_t gphdomain:fd use;')
Chris PeBenito 849380
Chris PeBenito 849380
# for when /root is the cwd
Chris PeBenito 849380
dontaudit useradd_t sysadm_home_dir_t:dir search;
Chris PeBenito 849380
Chris PeBenito 849380
# Add/remove user home directories
Chris PeBenito 849380
file_type_auto_trans(useradd_t, home_root_t, user_home_dir_t, dir)
Chris PeBenito 849380
file_type_auto_trans(useradd_t, user_home_dir_t, user_home_t)
Chris PeBenito 849380
Chris PeBenito 849380
# create/delete mail spool file in /var/mail
Chris PeBenito 849380
allow useradd_t var_spool_t:dir search;
Chris PeBenito 849380
allow useradd_t mail_spool_t:dir { search write add_name remove_name };
Chris PeBenito 849380
allow useradd_t mail_spool_t:file create_file_perms;
Chris PeBenito 849380
# /var/mail is a link to /var/spool/mail
Chris PeBenito 849380
allow useradd_t mail_spool_t:lnk_file read;
Chris PeBenito 849380
') dnl end TODO