|
Chris PeBenito |
17de1b |
## <summary>device locking policy for lockdev</summary>
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
#######################################
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
bbcd3c |
## The per role template for the lockdev module.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## <desc>
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
## This template creates derived domains which are used
|
|
Chris PeBenito |
17de1b |
## for lockdev. A derived type is also created to protect
|
|
Chris PeBenito |
17de1b |
## the user's device locks.
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
## This template is invoked automatically for each user, and
|
|
Chris PeBenito |
17de1b |
## generally does not need to be invoked directly
|
|
Chris PeBenito |
17de1b |
## by policy writers.
|
|
Chris PeBenito |
17de1b |
##
|
|
Chris PeBenito |
17de1b |
## </desc>
|
|
Chris PeBenito |
17de1b |
## <param name="userdomain_prefix">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The prefix of the user domain (e.g., user
|
|
Chris PeBenito |
17de1b |
## is the prefix for user_t).
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
## <param name="user_domain">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The type of the user domain.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
## <param name="user_role">
|
|
Chris PeBenito |
17de1b |
## <summary>
|
|
Chris PeBenito |
17de1b |
## The role associated with the user domain.
|
|
Chris PeBenito |
17de1b |
## </summary>
|
|
Chris PeBenito |
17de1b |
## </param>
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
bbcd3c |
template(`lockdev_per_role_template',`
|
|
Chris PeBenito |
17de1b |
gen_require(`
|
|
Chris PeBenito |
17de1b |
type lockdev_exec_t;
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Declarations
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
type $1_lockdev_t;
|
|
Chris PeBenito |
17de1b |
domain_type($1_lockdev_t)
|
|
Chris PeBenito |
17de1b |
domain_entry_file($1_lockdev_t,lockdev_exec_t)
|
|
Chris PeBenito |
17de1b |
role $3 types $1_lockdev_t;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
type $1_lockdev_lock_t;
|
|
Chris PeBenito |
17de1b |
files_lock_file($1_lockdev_lock_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
########################################
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
# Local policy
|
|
Chris PeBenito |
17de1b |
#
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Use capabilities.
|
|
Chris PeBenito |
17de1b |
allow $1_lockdev_t self:capability setgid;
|
|
Chris PeBenito |
17de1b |
allow $1_lockdev_t $2:process signull;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
# Transition from the user domain to the derived domain.
|
|
Chris PeBenito |
17de1b |
domain_auto_trans($2, lockdev_exec_t, $1_lockdev_t)
|
|
Chris PeBenito |
17de1b |
allow $2 $1_lockdev_t:fd use;
|
|
Chris PeBenito |
17de1b |
allow $1_lockdev_t $2:fd use;
|
|
Chris PeBenito |
17de1b |
allow $1_lockdev_t $2:fifo_file rw_file_perms;
|
|
Chris PeBenito |
17de1b |
allow $1_lockdev_t $2:process sigchld;
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
allow $1_lockdev_t $1_lockdev_lock_t:file create_file_perms;
|
|
Chris PeBenito |
17de1b |
files_lock_filetrans($1_lockdev_t,$1_lockdev_lock_t,file)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
files_read_all_locks($1_lockdev_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
fs_getattr_xattr_fs($1_lockdev_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
libs_use_ld_so($1_lockdev_t)
|
|
Chris PeBenito |
17de1b |
libs_use_shared_libs($1_lockdev_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
logging_send_syslog_msg($1_lockdev_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
userdom_use_user_terminals($1, $1_lockdev_t)
|
|
Chris PeBenito |
17de1b |
|
|
Chris PeBenito |
17de1b |
optional_policy(`
|
|
Chris PeBenito |
17de1b |
logging_send_syslog_msg($1_t)
|
|
Chris PeBenito |
17de1b |
')
|
|
Chris PeBenito |
17de1b |
')
|