Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Define m4 macros for the constraints
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Define the constraints
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# constrain class_set perm_set expression ;
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# validatetrans class_set expression ;
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# expression : ( expression )
Chris PeBenito 31b7c0
#	     | not expression
Chris PeBenito 31b7c0
#	     | expression and expression
Chris PeBenito 31b7c0
#	     | expression or expression
Chris PeBenito 31b7c0
#	     | u1 op u2
Chris PeBenito 31b7c0
#	     | r1 role_mls_op r2
Chris PeBenito 31b7c0
#	     | t1 op t2
Chris PeBenito 31b7c0
#	     | l1 role_mls_op l2
Chris PeBenito 31b7c0
#	     | l1 role_mls_op h2
Chris PeBenito 31b7c0
#	     | h1 role_mls_op l2
Chris PeBenito 31b7c0
#	     | h1 role_mls_op h2
Chris PeBenito 31b7c0
#	     | l1 role_mls_op h1
Chris PeBenito 31b7c0
#	     | l2 role_mls_op h2
Chris PeBenito 31b7c0
#	     | u1 op names
Chris PeBenito 31b7c0
#	     | u2 op names
Chris PeBenito 31b7c0
#	     | r1 op names
Chris PeBenito 31b7c0
#	     | r2 op names
Chris PeBenito 31b7c0
#	     | t1 op names
Chris PeBenito 31b7c0
#	     | t2 op names
Chris PeBenito 31b7c0
#	     | u3 op names (NOTE: this is only available for validatetrans)
Chris PeBenito 31b7c0
#	     | r3 op names (NOTE: this is only available for validatetrans)
Chris PeBenito 31b7c0
#	     | t3 op names (NOTE: this is only available for validatetrans)
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# op : == | !=
Chris PeBenito 31b7c0
# role_mls_op : == | != | eq | dom | domby | incomp
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# names : name | { name_list }
Chris PeBenito 31b7c0
# name_list : name | name_list name#
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Restrict the ability to transition to other users
Chris PeBenito 31b7c0
# or roles to a few privileged types.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
constrain process transition
Chris PeBenito 31b7c0
	( u1 == u2 or ( t1 == privuser and t2 == userdomain )
Chris PeBenito 31b7c0
ifdef(`crond.te', `
Chris PeBenito 31b7c0
         or (t1 == crond_t and (t2 == user_crond_domain or u2 == system_u))
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
ifdef(`userhelper.te', 
Chris PeBenito 31b7c0
	`or (t1 == userhelperdomain)')
Chris PeBenito 31b7c0
	 or (t1 == priv_system_role and u2 == system_u )
Chris PeBenito 31b7c0
        );
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
constrain process transition 
Chris PeBenito 31b7c0
	( r1 == r2 or ( t1 == privrole and t2 == userdomain )
Chris PeBenito 31b7c0
ifdef(`crond.te', `
Chris PeBenito 31b7c0
         or (t1 == crond_t and t2 == user_crond_domain)
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
ifdef(`userhelper.te', 
Chris PeBenito 31b7c0
	`or (t1 == userhelperdomain)')
Chris PeBenito 31b7c0
ifdef(`postfix.te', `
Chris PeBenito 31b7c0
ifdef(`direct_sysadm_daemon',
Chris PeBenito 31b7c0
	`or (t1 == sysadm_mail_t and t2 == system_mail_t and r2 == system_r )')
Chris PeBenito 31b7c0
')
Chris PeBenito 31b7c0
	 or (t1 == priv_system_role and r2 == system_r )
Chris PeBenito 31b7c0
        );
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
constrain process dyntransition
Chris PeBenito 31b7c0
	( u1 == u2 and r1 == r2);
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
# Restrict the ability to label objects with other
Chris PeBenito 31b7c0
# user identities to a few privileged types.
Chris PeBenito 31b7c0
#
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
constrain dir_file_class_set { create relabelto relabelfrom } 
Chris PeBenito 31b7c0
	( u1 == u2 or t1 == privowner );
Chris PeBenito 31b7c0
Chris PeBenito 31b7c0
constrain socket_class_set { create relabelto relabelfrom } 
Chris PeBenito 31b7c0
	( u1 == u2 or t1 == privowner );