Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Macros for chkpwd domains.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# chkpwd_domain(domain_prefix)
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# Define a derived domain for the *_chkpwd program when executed
Chris PeBenito 0fbfa5
# by a user domain.
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
# The type declaration for the executable type for this program is
Chris PeBenito 0fbfa5
# provided separately in domains/program/su.te. 
Chris PeBenito 0fbfa5
#
Chris PeBenito 0fbfa5
undefine(`chkpwd_domain')
Chris PeBenito 0fbfa5
ifdef(`chkpwd.te', `
Chris PeBenito 0fbfa5
define(`chkpwd_domain',`
Chris PeBenito 0fbfa5
# Derived domain based on the calling user domain and the program.
Chris PeBenito 0fbfa5
type $1_chkpwd_t, domain, privlog, nscd_client_domain, auth;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# is_selinux_enabled
Chris PeBenito 0fbfa5
allow $1_chkpwd_t proc_t:file read;
Chris PeBenito 0fbfa5
can_getcon($1_chkpwd_t)
Chris PeBenito 0fbfa5
can_ypbind($1_chkpwd_t)
Chris PeBenito 0fbfa5
can_kerberos($1_chkpwd_t)
Chris PeBenito 0fbfa5
can_ldap($1_chkpwd_t)
Chris PeBenito 0fbfa5
can_resolve($1_chkpwd_t)
Chris PeBenito 0fbfa5
# Transition from the user domain to this domain.
Chris PeBenito 0fbfa5
ifelse($1, system, `
Chris PeBenito 0fbfa5
domain_auto_trans(auth_chkpwd, chkpwd_exec_t, system_chkpwd_t)
Chris PeBenito 0fbfa5
role system_r types system_chkpwd_t;
Chris PeBenito 0fbfa5
dontaudit auth_chkpwd shadow_t:file { getattr read };
Chris PeBenito 0fbfa5
allow auth_chkpwd sbin_t:dir search;
Chris PeBenito 0fbfa5
dontaudit $1_chkpwd_t { user_tty_type tty_device_t }:chr_file rw_file_perms;
Chris PeBenito 0fbfa5
can_ypbind(auth_chkpwd)
Chris PeBenito 0fbfa5
can_kerberos(auth_chkpwd)
Chris PeBenito 0fbfa5
can_ldap(auth_chkpwd)
Chris PeBenito 0fbfa5
can_resolve(auth_chkpwd)
Chris PeBenito 0fbfa5
', `
Chris PeBenito 0fbfa5
domain_auto_trans($1_t, chkpwd_exec_t, $1_chkpwd_t)
Chris PeBenito 0fbfa5
allow $1_t sbin_t:dir search;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# The user role is authorized for this domain.
Chris PeBenito 0fbfa5
role $1_r types $1_chkpwd_t;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Write to the user domain tty.
Chris PeBenito 0fbfa5
access_terminal($1_chkpwd_t, $1)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
allow $1_chkpwd_t privfd:fd use;
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Inherit and use descriptors from gnome-pty-helper.
Chris PeBenito 0fbfa5
ifdef(`gnome-pty-helper.te',`allow $1_chkpwd_t $1_gph_t:fd use;')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Inherit and use descriptors from newrole.
Chris PeBenito 0fbfa5
ifdef(`newrole.te', `allow $1_chkpwd_t newrole_t:fd use;')
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
uses_shlib($1_chkpwd_t)
Chris PeBenito 0fbfa5
allow $1_chkpwd_t etc_t:file { getattr read };
Chris PeBenito 0fbfa5
allow $1_chkpwd_t self:unix_dgram_socket create_socket_perms;
Chris PeBenito 0fbfa5
allow $1_chkpwd_t self:unix_stream_socket create_socket_perms;
Chris PeBenito 0fbfa5
read_locale($1_chkpwd_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# Use capabilities.
Chris PeBenito 0fbfa5
allow $1_chkpwd_t self:capability setuid;
Chris PeBenito 0fbfa5
r_dir_file($1_chkpwd_t, selinux_config_t)
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
# for nscd
Chris PeBenito 0fbfa5
ifdef(`nscd.te', `', `
Chris PeBenito 0fbfa5
dontaudit $1_chkpwd_t var_t:dir search;
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
dontaudit $1_chkpwd_t fs_t:filesystem getattr;
Chris PeBenito 0fbfa5
')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
', `
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
define(`chkpwd_domain',`')
Chris PeBenito 0fbfa5
Chris PeBenito 0fbfa5
')