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 808341
# Note:
Chris PeBenito 808341
#  - getattr on dirs/files is not constrained.
Chris PeBenito 808341
#  - /proc/pid operations are not constrained.
Chris PeBenito 808341
Chris PeBenito 808341
mlsconstrain file { read ioctl lock execute execute_no_trans }
Chris PeBenito 808341
	(( h1 dom h2 ) or ( t1 == mcsreadall ) or ( t2 == domain ));
Chris PeBenito 8cf671
Chris PeBenito 808341
mlsconstrain file { write setattr append unlink link rename }
Chris PeBenito 808341
	(( h1 dom h2 ) or ( t1 == mcswriteall ) or ( t2 == domain ));
Chris PeBenito 808341
Chris PeBenito 808341
mlsconstrain dir { search read ioctl lock }
Chris PeBenito 808341
	(( h1 dom h2 ) or ( t1 == mcsreadall ) or ( t2 == domain ));
Chris PeBenito 808341
Chris PeBenito 808341
mlsconstrain dir { write setattr append unlink link rename add_name remove_name }
Chris PeBenito 808341
	(( h1 dom h2 ) or ( t1 == mcswriteall ) or ( t2 == domain ));
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 77f6e2
# new file labels must be dominated by the relabeling subject clearance
Dan Walsh 3eaa99
mlsconstrain { dir lnk_file chr_file blk_file sock_file fifo_file file } { relabelfrom }
Chris PeBenito 77f6e2
	( h1 dom h2 );
Chris PeBenito 8e788e
Dan Walsh 3eaa99
mlsconstrain { dir lnk_file chr_file blk_file sock_file fifo_file 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
Dan Walsh 6ed3f1
mlsconstrain process { sigkill sigstop }
Chris PeBenito 8e788e
	(( h1 dom h2 ) or ( t1 == mcskillall ));
Chris PeBenito a08248
Dan Walsh 6ed3f1
mlsconstrain process { signal }
Dan Walsh 6ed3f1
	(( h1 dom h2 ) or ( t1 != mcsuntrustedproc ));
Dan Walsh 6ed3f1
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 350ed8
mlsconstrain db_database { drop getattr setattr relabelfrom access install_module load_module get_param set_param }
Chris PeBenito 9760cb
	( h1 dom h2 );
Chris PeBenito 9760cb
Chris PeBenito 350ed8
mlsconstrain db_table { drop getattr setattr relabelfrom select update insert delete use lock }
Chris PeBenito 9760cb
	( h1 dom h2 );
Chris PeBenito 9760cb
Chris PeBenito 350ed8
mlsconstrain db_column { drop getattr 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 350ed8
mlsconstrain db_procedure { drop getattr setattr execute install }
Chris PeBenito 9760cb
	( h1 dom h2 );
Chris PeBenito 9760cb
Chris PeBenito 350ed8
mlsconstrain db_blob { drop getattr setattr relabelfrom read write import export }
Chris PeBenito 9760cb
	( h1 dom h2 );
Chris PeBenito 9760cb
Chris PeBenito a08248
') dnl end enable_mcs