Chris PeBenito a08248
ifdef(`enable_mcs',`
Chris PeBenito a08248
#
Chris PeBenito a08248
# Define sensitivities 
Chris PeBenito a08248
#
Chris PeBenito a08248
# MCS is single-sensitivity.
Chris PeBenito a08248
Chris PeBenito e070dd
gen_sens(1)
Chris PeBenito a08248
Chris PeBenito a08248
#
Chris PeBenito a08248
# Define the categories
Chris PeBenito a08248
#
Chris PeBenito e070dd
# Generate declarations
Chris PeBenito a9e03b
Chris PeBenito e070dd
gen_cats(mcs_num_cats)
Chris PeBenito a08248
Chris PeBenito a08248
#
Chris PeBenito a08248
# Each MCS level specifies a sensitivity and zero or more categories which may
Chris PeBenito a08248
# be associated with that sensitivity.
Chris PeBenito a08248
#
Chris PeBenito e070dd
Chris PeBenito e070dd
gen_levels(1,mcs_num_cats)
Chris PeBenito a08248
Chris PeBenito a08248
#
Chris PeBenito a08248
# Define the MCS policy
Chris PeBenito a08248
#
Chris PeBenito a08248
# mlsconstrain class_set perm_set expression ;
Chris PeBenito a08248
#
Chris PeBenito a08248
# mlsvalidatetrans class_set expression ;
Chris PeBenito a08248
#
Chris PeBenito a08248
# expression : ( expression )
Chris PeBenito a08248
#	     | not expression
Chris PeBenito a08248
#	     | expression and expression
Chris PeBenito a08248
#	     | expression or expression
Chris PeBenito a08248
#	     | u1 op u2
Chris PeBenito a08248
#	     | r1 role_mls_op r2
Chris PeBenito a08248
#	     | t1 op t2
Chris PeBenito a08248
#	     | l1 role_mls_op l2
Chris PeBenito a08248
#	     | l1 role_mls_op h2
Chris PeBenito a08248
#	     | h1 role_mls_op l2
Chris PeBenito a08248
#	     | h1 role_mls_op h2
Chris PeBenito a08248
#	     | l1 role_mls_op h1
Chris PeBenito a08248
#	     | l2 role_mls_op h2
Chris PeBenito a08248
#	     | u1 op names
Chris PeBenito a08248
#	     | u2 op names
Chris PeBenito a08248
#	     | r1 op names
Chris PeBenito a08248
#	     | r2 op names
Chris PeBenito a08248
#	     | t1 op names
Chris PeBenito a08248
#	     | t2 op names
Chris PeBenito a08248
#	     | u3 op names (NOTE: this is only available for mlsvalidatetrans)
Chris PeBenito a08248
#	     | r3 op names (NOTE: this is only available for mlsvalidatetrans)
Chris PeBenito a08248
#	     | t3 op names (NOTE: this is only available for mlsvalidatetrans)
Chris PeBenito a08248
#
Chris PeBenito a08248
# op : == | !=
Chris PeBenito a08248
# role_mls_op : == | != | eq | dom | domby | incomp
Chris PeBenito a08248
#
Chris PeBenito a08248
# names : name | { name_list }
Chris PeBenito a08248
# name_list : name | name_list name
Chris PeBenito a08248
#
Chris PeBenito a08248
Chris PeBenito a08248
#
Chris PeBenito a08248
# MCS policy for the file classes
Chris PeBenito a08248
#
Chris PeBenito a08248
# Constrain file access so that the high range of the process dominates
Chris PeBenito a08248
# the high range of the file.  We use the high range of the process so
Chris PeBenito a08248
# that processes can always simply run at s0.
Chris PeBenito a08248
#
Chris PeBenito cdc86e
# Note that getattr on files is always permitted.
Chris PeBenito a08248
#
Chris PeBenito 8e788e
mlsconstrain file { write setattr append unlink link rename ioctl lock execute relabelfrom }
Chris PeBenito 8e788e
	( h1 dom h2 );
Chris PeBenito 8cf671
Chris PeBenito 8708d9
mlsconstrain dir { create getattr setattr read write link unlink rename search add_name remove_name reparent rmdir lock ioctl }
Chris PeBenito 8708d9
	(( h1 dom h2 ) or ( t2 == domain ) or ( t1 == mlsfileread ));
Chris PeBenito 8708d9
Chris PeBenito cdc86e
# New filesystem object labels must be dominated by the relabeling subject
Chris PeBenito cdc86e
# clearance, also the objects are single-level.
Chris PeBenito 8e788e
mlsconstrain file { create relabelto }
Chris PeBenito 8e788e
	(( h1 dom h2 ) and ( l2 eq h2 ));
Chris PeBenito a08248
Chris PeBenito cdc86e
# At this time we do not restrict "ps" type operations via MCS.  This
Chris PeBenito cdc86e
# will probably change in future.
Chris PeBenito 8e788e
mlsconstrain file { read }
Chris PeBenito 8e788e
	(( h1 dom h2 ) or ( t2 == domain ) or ( t1 == mlsfileread ));
Chris PeBenito 77f6e2
Chris PeBenito 77f6e2
# new file labels must be dominated by the relabeling subject clearance
Chris PeBenito 8cf671
mlsconstrain { dir lnk_file chr_file blk_file sock_file fifo_file } { relabelfrom }
Chris PeBenito 77f6e2
	( h1 dom h2 );
Chris PeBenito 8e788e
Chris PeBenito 8cf671
mlsconstrain { dir lnk_file chr_file blk_file sock_file fifo_file } { create relabelto }
Chris PeBenito 8cf671
	(( h1 dom h2 ) and ( l2 eq h2 ));
Chris PeBenito 8cf671
Chris PeBenito 9779f0
mlsconstrain process { transition dyntransition }
Chris PeBenito 9779f0
	(( h1 dom h2 ) or ( t1 == mcssetcats ));
Chris PeBenito 9779f0
Chris PeBenito 8e788e
mlsconstrain process { ptrace }
Chris PeBenito 465510
	(( h1 dom h2) or ( t1 == mcsptraceall ));
Chris PeBenito a08248
Chris PeBenito 8e788e
mlsconstrain process { sigkill sigstop }
Chris PeBenito 8e788e
	(( h1 dom h2 ) or ( t1 == mcskillall ));
Chris PeBenito a08248
Chris PeBenito a08248
') dnl end enable_mcs