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 c98340
	( u1 == u2 or 
Chris PeBenito c98340
Chris PeBenito c98340
ifdef(`targeted_policy',`
Chris PeBenito c98340
	t1 == can_change_process_identity
Chris PeBenito c98340
',`
Chris PeBenito c98340
	( t1 == can_change_process_identity and t2 == userdomain )
Chris PeBenito c98340
	ifdef(`crond.te',`
Chris PeBenito c98340
        	or (
Chris PeBenito c98340
			t1 == crond_t
Chris PeBenito c98340
			and (
Chris PeBenito c98340
				t2 == user_crond_domain
Chris PeBenito c98340
				or u2 == system_u
Chris PeBenito c98340
			)
Chris PeBenito c98340
		)
Chris PeBenito c98340
	')
Chris PeBenito c98340
Chris PeBenito c98340
	ifdef(`userhelper.te',`
Chris PeBenito c98340
		or (t1 == userhelperdomain)
Chris PeBenito c98340
	')
Chris PeBenito c98340
Chris PeBenito c98340
	ifdef(`TODO',`
Chris PeBenito c98340
	or (t1 == priv_system_role and u2 == system_u )
Chris PeBenito c98340
	') dnl end TODO
Chris PeBenito 96ce00
')
Chris PeBenito c98340
);
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 c98340
	( r1 == r2 or
Chris PeBenito c98340
ifdef(`targeted_policy',`
Chris PeBenito c98340
	t1 == can_change_process_role
Chris PeBenito c98340
',`
Chris PeBenito c98340
	( t1 == can_change_process_role and t2 == userdomain )
Chris PeBenito c98340
Chris PeBenito c98340
	ifdef(`crond.te',`
Chris PeBenito c98340
        	or (t1 == crond_t and t2 == user_crond_domain)
Chris PeBenito c98340
	')
Chris PeBenito c98340
Chris PeBenito c98340
	ifdef(`userhelper.te',`
Chris PeBenito c98340
		or (t1 == userhelperdomain)
Chris PeBenito c98340
	')
Chris PeBenito c98340
Chris PeBenito c98340
	ifdef(`postfix.te',`
Chris PeBenito c98340
		ifdef(`direct_sysadm_daemon',`
Chris PeBenito c98340
			or (
Chris PeBenito c98340
				t1 == sysadm_mail_t
Chris PeBenito c98340
				and t2 == system_mail_t
Chris PeBenito c98340
				and r2 == system_r
Chris PeBenito c98340
			)
Chris PeBenito c98340
		')
Chris PeBenito c98340
	')
Chris PeBenito c98340
Chris PeBenito c98340
	ifdef(`TODO',`
Chris PeBenito c98340
	or (t1 == priv_system_role and r2 == system_r )
Chris PeBenito c98340
	') dnl end TODO
Chris PeBenito 134191
')
Chris PeBenito c98340
);
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 );