]> git.ipfire.org Git - people/stevee/selinux-policy.git/blobdiff - policy/modules/admin/usermanage.te
Revert "Add files_add_entry_var_lib_dirs() interface"
[people/stevee/selinux-policy.git] / policy / modules / admin / usermanage.te
index a3934428fc7a95a53040e294e75bfaa6a8bf5034..6bcfc8cebe3d86df107ae31658640afc458706b7 100644 (file)
@@ -1,5 +1,4 @@
-
-policy_module(usermanage,1.7.1)
+policy_module(usermanage, 1.16.0)
 
 ########################################
 #
@@ -12,12 +11,12 @@ files_type(admin_passwd_exec_t)
 type chfn_t;
 type chfn_exec_t;
 domain_obj_id_change_exemption(chfn_t)
-application_domain(chfn_t,chfn_exec_t)
+application_domain(chfn_t, chfn_exec_t)
 role system_r types chfn_t;
 
 type crack_t;
 type crack_exec_t;
-application_domain(crack_t,crack_exec_t)
+application_domain(crack_t, crack_exec_t)
 role system_r types crack_t;
 
 type crack_db_t;
@@ -29,18 +28,17 @@ files_tmp_file(crack_tmp_t)
 type groupadd_t;
 type groupadd_exec_t;
 domain_obj_id_change_exemption(groupadd_t)
-init_system_domain(groupadd_t,groupadd_exec_t)
-role system_r types groupadd_t;
+init_system_domain(groupadd_t, groupadd_exec_t)
 
 type passwd_t;
 type passwd_exec_t;
 domain_obj_id_change_exemption(passwd_t)
-application_domain(passwd_t,passwd_exec_t)
+application_domain(passwd_t, passwd_exec_t)
 role system_r types passwd_t;
 
 type sysadm_passwd_t;
 domain_obj_id_change_exemption(sysadm_passwd_t)
-application_domain(sysadm_passwd_t,admin_passwd_exec_t)
+application_domain(sysadm_passwd_t, admin_passwd_exec_t)
 role system_r types sysadm_passwd_t;
 
 type sysadm_passwd_tmp_t;
@@ -49,8 +47,7 @@ files_tmp_file(sysadm_passwd_tmp_t)
 type useradd_t;
 type useradd_exec_t;
 domain_obj_id_change_exemption(useradd_t)
-init_system_domain(useradd_t,useradd_exec_t)
-role system_r types useradd_t;
+init_system_domain(useradd_t, useradd_exec_t)
 
 ########################################
 #
@@ -74,6 +71,7 @@ allow chfn_t self:unix_stream_socket connectto;
 
 kernel_read_system_state(chfn_t)
 kernel_read_kernel_sysctls(chfn_t)
+kernel_dontaudit_getattr_core_if(chfn_t)
 
 selinux_get_fs_mount(chfn_t)
 selinux_validate_context(chfn_t)
@@ -82,24 +80,25 @@ selinux_compute_create_context(chfn_t)
 selinux_compute_relabel_context(chfn_t)
 selinux_compute_user_contexts(chfn_t)
 
-term_use_all_user_ttys(chfn_t)
-term_use_all_user_ptys(chfn_t)
+term_use_all_inherited_ttys(chfn_t)
+term_use_all_inherited_ptys(chfn_t)
+term_getattr_all_ptys(chfn_t)
 
 fs_getattr_xattr_fs(chfn_t)
 fs_search_auto_mountpoints(chfn_t)
 
 # for SSP
 dev_read_urand(chfn_t)
+dev_dontaudit_getattr_all(chfn_t)
 
-auth_domtrans_chk_passwd(chfn_t)
-auth_dontaudit_read_shadow(chfn_t)
+auth_manage_passwd(chfn_t)
+auth_use_pam(chfn_t)
 
 # allow checking if a shell is executable
 corecmd_check_exec_shell(chfn_t)
 
 domain_use_interactive_fds(chfn_t)
 
-files_manage_etc_files(chfn_t)
 files_read_etc_runtime_files(chfn_t)
 files_dontaudit_search_var(chfn_t)
 files_dontaudit_search_home(chfn_t)
@@ -107,9 +106,7 @@ files_dontaudit_search_home(chfn_t)
 # /usr/bin/passwd asks for w access to utmp, but it will operate
 # correctly without it.  Do not audit write denials to utmp.
 init_dontaudit_rw_utmp(chfn_t)
-
-libs_use_ld_so(chfn_t)
-libs_use_shared_libs(chfn_t)
+init_dontaudit_getattr_initctl(chfn_t)
 
 miscfiles_read_localization(chfn_t)
 
@@ -121,14 +118,10 @@ seutil_dontaudit_search_config(chfn_t)
 userdom_use_unpriv_users_fds(chfn_t)
 # user generally runs this from their home directory, so do not audit a search
 # on user home dir
-userdom_dontaudit_search_all_users_home_content(chfn_t)
+userdom_dontaudit_search_user_home_content(chfn_t)
 
 optional_policy(`
-       nis_use_ypbind(chfn_t)
-')
-
-optional_policy(`
-       nscd_socket_use(chfn_t)
+       rssh_exec(chfn_t)
 ')
 
 ########################################
@@ -136,15 +129,15 @@ optional_policy(`
 # Crack local policy
 #
 
-allow crack_t self:process { sigkill sigstop signull signal };
+allow crack_t self:process signal_perms;
 allow crack_t self:fifo_file rw_fifo_file_perms;
 
-manage_files_pattern(crack_t,crack_db_t,crack_db_t)
-manage_lnk_files_pattern(crack_t,crack_db_t,crack_db_t)
+manage_files_pattern(crack_t, crack_db_t, crack_db_t)
+manage_lnk_files_pattern(crack_t, crack_db_t, crack_db_t)
 files_search_var(crack_t)
 
-manage_dirs_pattern(crack_t,crack_tmp_t,crack_tmp_t)
-manage_files_pattern(crack_t,crack_tmp_t,crack_tmp_t)
+manage_dirs_pattern(crack_t, crack_tmp_t, crack_tmp_t)
+manage_files_pattern(crack_t, crack_tmp_t, crack_tmp_t)
 files_tmp_filetrans(crack_t, crack_tmp_t, { file dir })
 
 kernel_read_system_state(crack_t)
@@ -161,15 +154,19 @@ files_read_usr_files(crack_t)
 
 corecmd_exec_bin(crack_t)
 
-libs_use_ld_so(crack_t)
-libs_use_shared_libs(crack_t)
-
 logging_send_syslog_msg(crack_t)
 
-userdom_dontaudit_search_sysadm_home_dirs(crack_t)
+userdom_dontaudit_search_user_home_dirs(crack_t)
+
+ifdef(`distro_debian',`
+       # the package cracklib-runtime on Debian contains a daily maintenance
+       # script /etc/cron.daily/cracklib-runtime, that calls
+       # update-cracklib and that calls crack_mkdict, which is a shell script.
+       corecmd_exec_shell(crack_t)
+')
 
 optional_policy(`
-       cron_system_entry(crack_t,crack_exec_t)
+       cron_system_entry(crack_t, crack_exec_t)
 ')
 
 ########################################
@@ -191,7 +188,6 @@ allow groupadd_t self:unix_dgram_socket create_socket_perms;
 allow groupadd_t self:unix_stream_socket create_stream_socket_perms;
 allow groupadd_t self:unix_dgram_socket sendto;
 allow groupadd_t self:unix_stream_socket connectto;
-allow groupadd_t self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
 
 fs_getattr_xattr_fs(groupadd_t)
 fs_search_auto_mountpoints(groupadd_t)
@@ -204,8 +200,8 @@ selinux_compute_create_context(groupadd_t)
 selinux_compute_relabel_context(groupadd_t)
 selinux_compute_user_contexts(groupadd_t)
 
-term_use_all_user_ttys(groupadd_t)
-term_use_all_user_ptys(groupadd_t)
+term_use_all_inherited_terms(groupadd_t)
+term_getattr_all_ptys(groupadd_t)
 
 init_use_fds(groupadd_t)
 init_read_utmp(groupadd_t)
@@ -213,37 +209,48 @@ init_dontaudit_write_utmp(groupadd_t)
 
 domain_use_interactive_fds(groupadd_t)
 
-files_manage_etc_files(groupadd_t)
 files_relabel_etc_files(groupadd_t)
+files_read_etc_files(groupadd_t)
 files_read_etc_runtime_files(groupadd_t)
+files_read_usr_symlinks(groupadd_t)
 
-libs_use_ld_so(groupadd_t)
-libs_use_shared_libs(groupadd_t)
-
-# Execute /usr/bin/{passwd,chfn,chsh} and /usr/sbin/{useradd,vipw}.
+# Execute /usr/bin/{passwd, chfn, chsh} and /usr/sbin/{useradd, vipw}.
 corecmd_exec_bin(groupadd_t)
 
+logging_send_audit_msgs(groupadd_t)
 logging_send_syslog_msg(groupadd_t)
 
 miscfiles_read_localization(groupadd_t)
 
+auth_domtrans_chk_passwd(groupadd_t)
+auth_rw_lastlog(groupadd_t)
+auth_use_nsswitch(groupadd_t)
+auth_manage_passwd(groupadd_t)
 auth_manage_shadow(groupadd_t)
+# these may be unnecessary due to the above
+# domtrans_chk_passwd() call.
 auth_relabel_shadow(groupadd_t)
 auth_etc_filetrans_shadow(groupadd_t)
-auth_rw_lastlog(groupadd_t)
-auth_use_nsswitch(groupadd_t)
 
 seutil_read_config(groupadd_t)
 
 userdom_use_unpriv_users_fds(groupadd_t)
 # for when /root is the cwd
-userdom_dontaudit_search_sysadm_home_dirs(groupadd_t)
+userdom_dontaudit_search_user_home_dirs(groupadd_t)
 
 optional_policy(`
        dpkg_use_fds(groupadd_t)
        dpkg_rw_pipes(groupadd_t)
 ')
 
+optional_policy(`
+       nscd_domtrans(groupadd_t)
+')
+
+optional_policy(`
+       puppet_rw_tmp(groupadd_t)
+')
+
 optional_policy(`
        rpm_use_fds(groupadd_t)
        rpm_rw_pipes(groupadd_t)
@@ -254,7 +261,8 @@ optional_policy(`
 # Passwd local policy
 #
 
-allow passwd_t self:capability { chown dac_override fsetid setuid setgid sys_resource audit_control audit_write };
+allow passwd_t self:capability { chown dac_override fsetid setuid setgid sys_nice sys_resource };
+dontaudit passwd_t self:capability sys_tty_config;
 allow passwd_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
 allow passwd_t self:process { setrlimit setfscreate };
 allow passwd_t self:fd use;
@@ -264,19 +272,19 @@ allow passwd_t self:unix_dgram_socket create_socket_perms;
 allow passwd_t self:unix_stream_socket create_stream_socket_perms;
 allow passwd_t self:unix_dgram_socket sendto;
 allow passwd_t self:unix_stream_socket connectto;
-allow passwd_t self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
 allow passwd_t self:shm create_shm_perms;
 allow passwd_t self:sem create_sem_perms;
 allow passwd_t self:msgq create_msgq_perms;
 allow passwd_t self:msg { send receive };
 
 allow passwd_t crack_db_t:dir list_dir_perms;
-read_files_pattern(passwd_t,crack_db_t,crack_db_t)
+read_files_pattern(passwd_t, crack_db_t, crack_db_t)
 
 kernel_read_kernel_sysctls(passwd_t)
 
 # for SSP
 dev_read_urand(passwd_t)
+dev_dontaudit_getattr_all(passwd_t)
 
 fs_getattr_xattr_fs(passwd_t)
 fs_search_auto_mountpoints(passwd_t)
@@ -291,51 +299,55 @@ selinux_compute_create_context(passwd_t)
 selinux_compute_relabel_context(passwd_t)
 selinux_compute_user_contexts(passwd_t)
 
-term_use_all_user_ttys(passwd_t)
-term_use_all_user_ptys(passwd_t)
+term_use_all_inherited_terms(passwd_t)
+term_getattr_all_ptys(passwd_t)
 
+auth_manage_passwd(passwd_t)
 auth_manage_shadow(passwd_t)
 auth_relabel_shadow(passwd_t)
 auth_etc_filetrans_shadow(passwd_t)
+auth_use_pam(passwd_t)
 
 # allow checking if a shell is executable
 corecmd_check_exec_shell(passwd_t)
+corecmd_exec_bin(passwd_t)
+
+corenet_tcp_connect_kerberos_password_port(passwd_t)
 
 domain_use_interactive_fds(passwd_t)
 
 files_read_etc_runtime_files(passwd_t)
-files_manage_etc_files(passwd_t)
 files_search_var(passwd_t)
 files_dontaudit_search_pids(passwd_t)
 files_relabel_etc_files(passwd_t)
 
+term_search_ptys(passwd_t)
+
 # /usr/bin/passwd asks for w access to utmp, but it will operate
 # correctly without it.  Do not audit write denials to utmp.
 init_dontaudit_rw_utmp(passwd_t)
+init_use_fds(passwd_t)
 
-libs_use_ld_so(passwd_t)
-libs_use_shared_libs(passwd_t)
-
+logging_send_audit_msgs(passwd_t)
 logging_send_syslog_msg(passwd_t)
 
 miscfiles_read_localization(passwd_t)
 
 seutil_dontaudit_search_config(passwd_t)
 
+userdom_use_inherited_user_terminals(passwd_t)
 userdom_use_unpriv_users_fds(passwd_t)
 # make sure that getcon succeeds
 userdom_getattr_all_users(passwd_t)
 userdom_read_all_users_state(passwd_t)
+userdom_read_user_tmp_files(passwd_t)
 # user generally runs this from their home directory, so do not audit a search
 # on user home dir
-userdom_dontaudit_search_all_users_home_content(passwd_t)
-
-optional_policy(`
-       nis_use_ypbind(passwd_t)
-')
+userdom_dontaudit_search_user_home_content(passwd_t)
+userdom_stream_connect(passwd_t)
 
 optional_policy(`
-       nscd_socket_use(passwd_t)
+       nscd_domtrans(passwd_t)
 ')
 
 ########################################
@@ -359,8 +371,8 @@ allow sysadm_passwd_t self:msgq create_msgq_perms;
 allow sysadm_passwd_t self:msg { send receive };
 
 # allow vipw to create temporary files under /var/tmp/vi.recover
-manage_dirs_pattern(sysadm_passwd_t,sysadm_passwd_tmp_t,sysadm_passwd_tmp_t)
-manage_files_pattern(sysadm_passwd_t,sysadm_passwd_tmp_t,sysadm_passwd_tmp_t)
+manage_dirs_pattern(sysadm_passwd_t, sysadm_passwd_tmp_t, sysadm_passwd_tmp_t)
+manage_files_pattern(sysadm_passwd_t, sysadm_passwd_tmp_t, sysadm_passwd_tmp_t)
 files_tmp_filetrans(sysadm_passwd_t, sysadm_passwd_tmp_t, { file dir })
 files_search_var(sysadm_passwd_t)
 files_dontaudit_search_home(sysadm_passwd_t)
@@ -382,12 +394,14 @@ dev_read_urand(sysadm_passwd_t)
 fs_getattr_xattr_fs(sysadm_passwd_t)
 fs_search_auto_mountpoints(sysadm_passwd_t)
 
-term_use_all_user_ttys(sysadm_passwd_t)
-term_use_all_user_ptys(sysadm_passwd_t)
+term_use_all_inherited_terms(sysadm_passwd_t)
+term_getattr_all_ptys(sysadm_passwd_t)
 
+auth_manage_passwd(sysadm_passwd_t)
 auth_manage_shadow(sysadm_passwd_t)
 auth_relabel_shadow(sysadm_passwd_t)
 auth_etc_filetrans_shadow(sysadm_passwd_t)
+auth_use_nsswitch(sysadm_passwd_t)
 
 # allow vipw to exec the editor
 corecmd_exec_bin(sysadm_passwd_t)
@@ -396,7 +410,6 @@ files_read_usr_files(sysadm_passwd_t)
 
 domain_use_interactive_fds(sysadm_passwd_t)
 
-files_manage_etc_files(sysadm_passwd_t)
 files_relabel_etc_files(sysadm_passwd_t)
 files_read_etc_runtime_files(sysadm_passwd_t)
 # for nscd lookups
@@ -406,9 +419,6 @@ files_dontaudit_search_pids(sysadm_passwd_t)
 # correctly without it.  Do not audit write denials to utmp.
 init_dontaudit_rw_utmp(sysadm_passwd_t)
 
-libs_use_ld_so(sysadm_passwd_t)
-libs_use_shared_libs(sysadm_passwd_t)
-
 miscfiles_read_localization(sysadm_passwd_t)
 
 logging_send_syslog_msg(sysadm_passwd_t)
@@ -418,14 +428,10 @@ seutil_dontaudit_search_config(sysadm_passwd_t)
 userdom_use_unpriv_users_fds(sysadm_passwd_t)
 # user generally runs this from their home directory, so do not audit a search
 # on user home dir
-userdom_dontaudit_search_all_users_home_content(sysadm_passwd_t)
-
-optional_policy(`
-       nis_use_ypbind(sysadm_passwd_t)
-')
+userdom_dontaudit_search_user_home_content(sysadm_passwd_t)
 
 optional_policy(`
-       nscd_socket_use(sysadm_passwd_t)
+       nscd_domtrans(sysadm_passwd_t)
 ')
 
 ########################################
@@ -433,7 +439,8 @@ optional_policy(`
 # Useradd local policy
 #
 
-allow useradd_t self:capability { dac_override chown kill fowner fsetid setuid sys_resource audit_write };
+allow useradd_t self:capability { dac_override chown kill fowner fsetid setuid sys_resource };
+
 dontaudit useradd_t self:capability sys_tty_config;
 allow useradd_t self:process ~{ ptrace setcurrent setexec setfscreate setrlimit execmem execstack execheap };
 allow useradd_t self:process setfscreate;
@@ -447,7 +454,6 @@ allow useradd_t self:unix_dgram_socket create_socket_perms;
 allow useradd_t self:unix_stream_socket create_stream_socket_perms;
 allow useradd_t self:unix_dgram_socket sendto;
 allow useradd_t self:unix_stream_socket connectto;
-allow useradd_t self:netlink_audit_socket { create_netlink_socket_perms nlmsg_relay };
 
 # for getting the number of groups
 kernel_read_kernel_sysctls(useradd_t)
@@ -456,9 +462,13 @@ corecmd_exec_shell(useradd_t)
 # Execute /usr/bin/{passwd,chfn,chsh} and /usr/sbin/{useradd,vipw}.
 corecmd_exec_bin(useradd_t)
 
+kernel_getattr_core_if(useradd_t)
+dev_dontaudit_getattr_all(useradd_t)
+
 domain_use_interactive_fds(useradd_t)
+domain_read_all_domains_state(useradd_t)
+domain_dontaudit_read_all_domains_state(useradd_t)
 
-files_manage_etc_files(useradd_t)
 files_search_var_lib(useradd_t)
 files_relabel_etc_files(useradd_t)
 files_read_etc_runtime_files(useradd_t)
@@ -467,6 +477,7 @@ fs_search_auto_mountpoints(useradd_t)
 fs_getattr_xattr_fs(useradd_t)
 
 mls_file_upgrade(useradd_t)
+mls_process_read_to_clearance(useradd_t)
 
 # Allow access to context for shadow file
 selinux_get_fs_mount(useradd_t)
@@ -476,22 +487,24 @@ selinux_compute_create_context(useradd_t)
 selinux_compute_relabel_context(useradd_t)
 selinux_compute_user_contexts(useradd_t)
 
-term_use_all_user_ttys(useradd_t)
-term_use_all_user_ptys(useradd_t)
+term_use_all_inherited_terms(useradd_t)
+term_getattr_all_ptys(useradd_t)
 
-auth_manage_shadow(useradd_t)
-auth_relabel_shadow(useradd_t)
-auth_etc_filetrans_shadow(useradd_t)
+auth_domtrans_chk_passwd(useradd_t)
 auth_rw_lastlog(useradd_t)
 auth_rw_faillog(useradd_t)
 auth_use_nsswitch(useradd_t)
+# these may be unnecessary due to the above
+# domtrans_chk_passwd() call.
+auth_manage_passwd(useradd_t)
+auth_manage_shadow(useradd_t)
+auth_relabel_shadow(useradd_t)
+auth_etc_filetrans_shadow(useradd_t)
 
 init_use_fds(useradd_t)
 init_rw_utmp(useradd_t)
 
-libs_use_ld_so(useradd_t)
-libs_use_shared_libs(useradd_t)
-
+logging_send_audit_msgs(useradd_t)
 logging_send_syslog_msg(useradd_t)
 
 miscfiles_read_localization(useradd_t)
@@ -501,23 +514,42 @@ seutil_read_file_contexts(useradd_t)
 seutil_read_default_contexts(useradd_t)
 seutil_domtrans_semanage(useradd_t)
 seutil_domtrans_setfiles(useradd_t)
+seutil_domtrans_loadpolicy(useradd_t)
+seutil_manage_bin_policy(useradd_t)
+seutil_manage_module_store(useradd_t)
+seutil_get_semanage_trans_lock(useradd_t)
+seutil_get_semanage_read_lock(useradd_t)
 
 userdom_use_unpriv_users_fds(useradd_t)
-# for when /root is the cwd
-userdom_dontaudit_search_sysadm_home_dirs(useradd_t)
 # Add/remove user home directories
-userdom_home_filetrans_generic_user_home_dir(useradd_t)
-userdom_manage_all_users_home_content_dirs(useradd_t)
-userdom_manage_all_users_home_content_files(useradd_t)
-userdom_generic_user_home_dir_filetrans_generic_user_home_content(useradd_t,notdevfile_class_set)
+userdom_home_filetrans_user_home_dir(useradd_t)
+userdom_manage_home_role(system_r, useradd_t)
 
 mta_manage_spool(useradd_t)
 
+optional_policy(`
+       apache_manage_all_user_content(useradd_t)
+')
+
 optional_policy(`
        dpkg_use_fds(useradd_t)
        dpkg_rw_pipes(useradd_t)
 ')
 
+optional_policy(`
+       nscd_domtrans(useradd_t)
+')
+
+optional_policy(`
+       puppet_rw_tmp(useradd_t)
+')
+
+optional_policy(`
+       tunable_policy(`samba_domain_controller',`
+               samba_append_log(useradd_t)
+       ')
+')
+
 optional_policy(`
        rpm_use_fds(useradd_t)
        rpm_rw_pipes(useradd_t)