Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Macros for lockdev domains.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Authors:  Daniel Walsh <dwalsh@redhat.com> 
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# lockdev_domain(domain_prefix)
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Define a derived domain for the lockdev programs when executed
Chris PeBenito 31b7c0
# by a user domain.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# The type declaration for the executable type for this program is
Chris PeBenito 31b7c0
# provided separately in domains/program/lockdev.te. 
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
undefine(`lockdev_domain')
Chris PeBenito 31b7c0
define(`lockdev_domain',`
Chris PeBenito 31b7c0
# Derived domain based on the calling user domain and the program
Chris PeBenito 31b7c0
type $1_lockdev_t, domain, privlog;
Chris PeBenito 31b7c0
# Transition from the user domain to the derived domain.
Chris PeBenito 31b7c0
domain_auto_trans($1_t, lockdev_exec_t, $1_lockdev_t)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
# The user role is authorized for this domain.
Chris PeBenito 31b7c0
role $1_r types $1_lockdev_t;
Chris PeBenito 31b7c0
# Use capabilities.
Chris PeBenito 31b7c0
allow $1_lockdev_t self:capability setgid;
Chris PeBenito 31b7c0
allow $1_lockdev_t $1_t:process signull;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow $1_lockdev_t var_t:dir search;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
lock_domain($1_lockdev)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
r_dir_file($1_lockdev_t, lockfile)
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
allow $1_lockdev_t device_t:dir search;
Chris PeBenito 31b7c0
allow $1_lockdev_t null_device_t:chr_file rw_file_perms;
Chris PeBenito 31b7c0
access_terminal($1_lockdev_t, $1)
Chris PeBenito 31b7c0
dontaudit $1_lockdev_t root_t:dir search;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
uses_shlib($1_lockdev_t)
Chris PeBenito 31b7c0
allow $1_lockdev_t fs_t:filesystem getattr;
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
')dnl end macro definition
Chris PeBenito 31b7c0