Chris PeBenito a082484
ifdef(`enable_mcs',`
Chris PeBenito a082484
#
Chris PeBenito a082484
# Define sensitivities 
Chris PeBenito a082484
#
Chris PeBenito a082484
# MCS is single-sensitivity.
Chris PeBenito a082484
Chris PeBenito e070dd2
gen_sens(1)
Chris PeBenito a082484
Chris PeBenito a082484
#
Chris PeBenito a082484
# Define the categories
Chris PeBenito a082484
#
Chris PeBenito e070dd2
# Generate declarations
Chris PeBenito a9e03b3
Chris PeBenito e070dd2
gen_cats(mcs_num_cats)
Chris PeBenito a082484
Chris PeBenito a082484
#
Chris PeBenito a082484
# Each MCS level specifies a sensitivity and zero or more categories which may
Chris PeBenito a082484
# be associated with that sensitivity.
Chris PeBenito a082484
#
Chris PeBenito e070dd2
Chris PeBenito e070dd2
gen_levels(1,mcs_num_cats)
Chris PeBenito a082484
Chris PeBenito a082484
#
Chris PeBenito a082484
# Define the MCS policy
Chris PeBenito a082484
#
Chris PeBenito a082484
# mlsconstrain class_set perm_set expression ;
Chris PeBenito a082484
#
Chris PeBenito a082484
# mlsvalidatetrans class_set expression ;
Chris PeBenito a082484
#
Chris PeBenito a082484
# expression : ( expression )
Chris PeBenito a082484
#	     | not expression
Chris PeBenito a082484
#	     | expression and expression
Chris PeBenito a082484
#	     | expression or expression
Chris PeBenito a082484
#	     | u1 op u2
Chris PeBenito a082484
#	     | r1 role_mls_op r2
Chris PeBenito a082484
#	     | t1 op t2
Chris PeBenito a082484
#	     | l1 role_mls_op l2
Chris PeBenito a082484
#	     | l1 role_mls_op h2
Chris PeBenito a082484
#	     | h1 role_mls_op l2
Chris PeBenito a082484
#	     | h1 role_mls_op h2
Chris PeBenito a082484
#	     | l1 role_mls_op h1
Chris PeBenito a082484
#	     | l2 role_mls_op h2
Chris PeBenito a082484
#	     | u1 op names
Chris PeBenito a082484
#	     | u2 op names
Chris PeBenito a082484
#	     | r1 op names
Chris PeBenito a082484
#	     | r2 op names
Chris PeBenito a082484
#	     | t1 op names
Chris PeBenito a082484
#	     | t2 op names
Chris PeBenito a082484
#	     | u3 op names (NOTE: this is only available for mlsvalidatetrans)
Chris PeBenito a082484
#	     | r3 op names (NOTE: this is only available for mlsvalidatetrans)
Chris PeBenito a082484
#	     | t3 op names (NOTE: this is only available for mlsvalidatetrans)
Chris PeBenito a082484
#
Chris PeBenito a082484
# op : == | !=
Chris PeBenito a082484
# role_mls_op : == | != | eq | dom | domby | incomp
Chris PeBenito a082484
#
Chris PeBenito a082484
# names : name | { name_list }
Chris PeBenito a082484
# name_list : name | name_list name
Chris PeBenito a082484
#
Chris PeBenito a082484
Chris PeBenito a082484
#
Chris PeBenito a082484
# MCS policy for the file classes
Chris PeBenito a082484
#
Chris PeBenito a082484
# Constrain file access so that the high range of the process dominates
Chris PeBenito a082484
# the high range of the file.  We use the high range of the process so
Chris PeBenito a082484
# that processes can always simply run at s0.
Chris PeBenito a082484
#
Chris PeBenito 808341b
# Note:
Chris PeBenito 808341b
#  - getattr on dirs/files is not constrained.
Chris PeBenito 808341b
#  - /proc/pid operations are not constrained.
Chris PeBenito 808341b
Chris PeBenito 808341b
mlsconstrain file { read ioctl lock execute execute_no_trans }
Chris PeBenito 808341b
	(( h1 dom h2 ) or ( t1 == mcsreadall ) or ( t2 == domain ));
Chris PeBenito 8cf6714
Chris PeBenito 808341b
mlsconstrain file { write setattr append unlink link rename }
Chris PeBenito 808341b
	(( h1 dom h2 ) or ( t1 == mcswriteall ) or ( t2 == domain ));
Chris PeBenito 808341b
Chris PeBenito 808341b
mlsconstrain dir { search read ioctl lock }
Chris PeBenito 808341b
	(( h1 dom h2 ) or ( t1 == mcsreadall ) or ( t2 == domain ));
Chris PeBenito 808341b
Chris PeBenito 808341b
mlsconstrain dir { write setattr append unlink link rename add_name remove_name }
Chris PeBenito 808341b
	(( h1 dom h2 ) or ( t1 == mcswriteall ) or ( t2 == domain ));
Chris PeBenito 8708d9b
Chris PeBenito cdc86ee
# New filesystem object labels must be dominated by the relabeling subject
Chris PeBenito cdc86ee
# clearance, also the objects are single-level.
Chris PeBenito 8e788ed
mlsconstrain file { create relabelto }
Chris PeBenito 8e788ed
	(( h1 dom h2 ) and ( l2 eq h2 ));
Chris PeBenito a082484
Chris PeBenito 77f6e2c
# new file labels must be dominated by the relabeling subject clearance
3eaa993
mlsconstrain { dir lnk_file chr_file blk_file sock_file fifo_file file } { relabelfrom }
Chris PeBenito 77f6e2c
	( h1 dom h2 );
Chris PeBenito 8e788ed
3eaa993
mlsconstrain { dir lnk_file chr_file blk_file sock_file fifo_file file } { create relabelto }
Chris PeBenito 8cf6714
	(( h1 dom h2 ) and ( l2 eq h2 ));
Chris PeBenito 8cf6714
Chris PeBenito 9779f09
mlsconstrain process { transition dyntransition }
Chris PeBenito 9779f09
	(( h1 dom h2 ) or ( t1 == mcssetcats ));
Chris PeBenito 9779f09
Chris PeBenito 8e788ed
mlsconstrain process { ptrace }
Chris PeBenito 4655103
	(( h1 dom h2) or ( t1 == mcsptraceall ));
Chris PeBenito a082484
6ed3f15
mlsconstrain process { sigkill sigstop }
Chris PeBenito 8e788ed
	(( h1 dom h2 ) or ( t1 == mcskillall ));
Chris PeBenito a082484
6ed3f15
mlsconstrain process { signal }
6ed3f15
	(( h1 dom h2 ) or ( t1 != mcsuntrustedproc ));
6ed3f15
Chris PeBenito 9760cbe
#
Chris PeBenito 9760cbe
# MCS policy for SELinux-enabled databases
Chris PeBenito 9760cbe
#
Chris PeBenito 9760cbe
Chris PeBenito 9760cbe
# Any database object must be dominated by the relabeling subject
Chris PeBenito 9760cbe
# clearance, also the objects are single-level.
Chris PeBenito 9760cbe
mlsconstrain { db_database db_table db_procedure db_column db_blob } { create relabelto }
Chris PeBenito 9760cbe
	(( h1 dom h2 ) and ( l2 eq h2 ));
Chris PeBenito 9760cbe
Chris PeBenito 9760cbe
mlsconstrain { db_tuple } { insert relabelto }
Chris PeBenito 9760cbe
	(( h1 dom h2 ) and ( l2 eq h2 ));
Chris PeBenito 9760cbe
Chris PeBenito 9760cbe
# Access control for any database objects based on MCS rules.
Chris PeBenito 350ed89
mlsconstrain db_database { drop getattr setattr relabelfrom access install_module load_module get_param set_param }
Chris PeBenito 9760cbe
	( h1 dom h2 );
Chris PeBenito 9760cbe
Chris PeBenito 350ed89
mlsconstrain db_table { drop getattr setattr relabelfrom select update insert delete use lock }
Chris PeBenito 9760cbe
	( h1 dom h2 );
Chris PeBenito 9760cbe
Chris PeBenito 350ed89
mlsconstrain db_column { drop getattr setattr relabelfrom select update insert use }
Chris PeBenito 9760cbe
	( h1 dom h2 );
Chris PeBenito 9760cbe
Chris PeBenito 9760cbe
mlsconstrain db_tuple { relabelfrom select update delete use }
Chris PeBenito 9760cbe
	( h1 dom h2 );
Chris PeBenito 9760cbe
Chris PeBenito 350ed89
mlsconstrain db_procedure { drop getattr setattr execute install }
Chris PeBenito 9760cbe
	( h1 dom h2 );
Chris PeBenito 9760cbe
Chris PeBenito 350ed89
mlsconstrain db_blob { drop getattr setattr relabelfrom read write import export }
Chris PeBenito 9760cbe
	( h1 dom h2 );
Chris PeBenito 9760cbe
Chris PeBenito a082484
') dnl end enable_mcs