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 2e863f
	( u1 == u2
Chris PeBenito c98340
Chris PeBenito c98340
ifdef(`targeted_policy',`
Chris PeBenito 2e863f
	or t1 == can_change_process_identity
Chris PeBenito c98340
',`
Chris PeBenito 2e863f
	or ( t1 == can_change_process_identity and t2 == process_user_target )
Chris PeBenito c98340
Chris PeBenito 2e863f
       	or ( t1 == cron_source_domain
Chris PeBenito 2e863f
		and ( t2 == cron_job_domain or u2 == system_u )
Chris PeBenito 2e863f
	   )
Chris PeBenito 2e863f
Chris PeBenito 2e863f
	or (t1 == process_uncond_exempt)
Chris PeBenito c98340
Chris PeBenito 2e863f
	or (t1 == can_system_change and u2 == system_u )
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 2e863f
	( r1 == r2
Chris PeBenito 2e863f
Chris PeBenito c98340
ifdef(`targeted_policy',`
Chris PeBenito 2e863f
	or t1 == can_change_process_role
Chris PeBenito c98340
',`
Chris PeBenito 2e863f
	or ( t1 == can_change_process_role and t2 == process_user_target )
Chris PeBenito c98340
Chris PeBenito 2e863f
       	or ( t1 == cron_source_domain and t2 == cron_job_domain )
Chris PeBenito c98340
Chris PeBenito 2e863f
	or ( t1 == process_uncond_exempt )
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 2e863f
	or (t1 == can_system_change and r2 == system_r )
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 2e863f
	( 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 );