Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 134191
# Define m4 macros for the constraints
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 134191
# Define the constraints
Chris PeBenito 134191
#
Chris PeBenito 134191
# constrain class_set perm_set expression ;
Chris PeBenito 134191
#
Chris PeBenito 134191
# expression : ( expression ) 
Chris PeBenito 134191
#	     | not expression
Chris PeBenito 134191
#	     | expression and expression
Chris PeBenito 134191
#	     | expression or expression
Chris PeBenito 134191
#	     | u1 op u2
Chris PeBenito 134191
#	     | r1 role_op r2
Chris PeBenito 134191
#	     | t1 op t2
Chris PeBenito 134191
#	     | u1 op names
Chris PeBenito 134191
#	     | u2 op names
Chris PeBenito 134191
#	     | r1 op names
Chris PeBenito 134191
#	     | r2 op names
Chris PeBenito 134191
#	     | t1 op names
Chris PeBenito 134191
#	     | t2 op names
Chris PeBenito 134191
#
Chris PeBenito 134191
# op : == | != 
Chris PeBenito 134191
# role_op : == | != | eq | dom | domby | incomp
Chris PeBenito 134191
#
Chris PeBenito 134191
# names : name | { name_list }
Chris PeBenito 134191
# name_list : name | name_list name		
Chris PeBenito 134191
#
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 134191
# SELinux process identity change constraint:
Chris PeBenito 134191
#
Chris PeBenito 134191
constrain process transition
Chris PeBenito 134191
	( u1 == u2 or ( t1 == can_change_process_identity and t2 == userdomain )
Chris PeBenito 134191
ifdef(`crond.te', `
Chris PeBenito 134191
         or (t1 == crond_t and (t2 == user_crond_domain or u2 == system_u))
Chris PeBenito 134191
')
Chris PeBenito 134191
ifdef(`userhelper.te', 
Chris PeBenito 96ce00
	`or (t1 == userhelperdomain)
Chris PeBenito 96ce00
')
Chris PeBenito 96ce00
ifdef(`TODO',`
Chris PeBenito 134191
	 or (t1 == priv_system_role and u2 == system_u )
Chris PeBenito 134191
') dnl end TODO
Chris PeBenito 134191
        );
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 134191
# SELinux process role change constraint:
Chris PeBenito 134191
#
Chris PeBenito 134191
constrain process transition 
Chris PeBenito 134191
	( r1 == r2 or ( t1 == can_change_process_role and t2 == userdomain )
Chris PeBenito 134191
ifdef(`crond.te', `
Chris PeBenito 134191
         or (t1 == crond_t and t2 == user_crond_domain)
Chris PeBenito 134191
')
Chris PeBenito 134191
ifdef(`userhelper.te', 
Chris PeBenito 96ce00
	`or (t1 == userhelperdomain)
Chris PeBenito 96ce00
')
Chris PeBenito 134191
ifdef(`postfix.te', `
Chris PeBenito 134191
ifdef(`direct_sysadm_daemon',
Chris PeBenito 96ce00
	`or (t1 == sysadm_mail_t and t2 == system_mail_t and r2 == system_r )
Chris PeBenito 96ce00
')
Chris PeBenito 134191
')
Chris PeBenito 96ce00
ifdef(`TODO',`
Chris PeBenito 134191
	 or (t1 == priv_system_role and r2 == system_r )
Chris PeBenito 134191
') dnl end TODO
Chris PeBenito 134191
        );
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 134191
# SELinux dynamic transition constraint:
Chris PeBenito 134191
#
Chris PeBenito 134191
constrain process dyntransition
Chris PeBenito 134191
	( u1 == u2 and r1 == r2);
Chris PeBenito 134191
Chris PeBenito 134191
#
Chris PeBenito 134191
# SElinux object identity change constraint:
Chris PeBenito 134191
#
Chris PeBenito 134191
constrain dir_file_class_set { create relabelto relabelfrom } 
Chris PeBenito 134191
	( u1 == u2 or t1 == can_change_object_identity );
Chris PeBenito 134191
Chris PeBenito 134191
constrain socket_class_set { create relabelto relabelfrom } 
Chris PeBenito 134191
	( u1 == u2 or t1 == can_change_object_identity );