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