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 9760cb
#
Chris PeBenito 9760cb
# MCS policy for SELinux-enabled databases
Chris PeBenito 9760cb
#
Chris PeBenito 9760cb
Chris PeBenito 9760cb
# Any database object must be dominated by the relabeling subject
Chris PeBenito 9760cb
# clearance, also the objects are single-level.
Chris PeBenito 9760cb
mlsconstrain { db_database db_table db_procedure db_column db_blob } { create relabelto }
Chris PeBenito 9760cb
	(( h1 dom h2 ) and ( l2 eq h2 ));
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain { db_tuple } { insert relabelto }
Chris PeBenito 9760cb
	(( h1 dom h2 ) and ( l2 eq h2 ));
Chris PeBenito 9760cb
Chris PeBenito 9760cb
# Access control for any database objects based on MCS rules.
Chris PeBenito 9760cb
mlsconstrain db_database { drop setattr relabelfrom access install_module load_module get_param set_param }
Chris PeBenito 9760cb
	( h1 dom h2 );
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain db_table { drop setattr relabelfrom select update insert delete use }
Chris PeBenito 9760cb
	( h1 dom h2 );
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain db_column { drop setattr relabelfrom select update insert use }
Chris PeBenito 9760cb
	( h1 dom h2 );
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain db_tuple { relabelfrom select update delete use }
Chris PeBenito 9760cb
	( h1 dom h2 );
Chris PeBenito 9760cb
Chris PeBenito 466e22
mlsconstrain db_procedure { execute install }
Chris PeBenito 9760cb
	( h1 dom h2 );
Chris PeBenito 9760cb
Chris PeBenito 9760cb
mlsconstrain db_blob { drop setattr relabelfrom read write }
Chris PeBenito 9760cb
	( h1 dom h2 );
Chris PeBenito 9760cb
Chris PeBenito a08248
') dnl end enable_mcs