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