2005-09-16 13:36:26 +00:00
|
|
|
ifdef(`enable_mcs',`
|
|
|
|
#
|
|
|
|
# Define sensitivities
|
|
|
|
#
|
|
|
|
# MCS is single-sensitivity.
|
|
|
|
|
2006-10-04 17:25:34 +00:00
|
|
|
gen_sens(1)
|
2005-09-16 13:36:26 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Define the categories
|
|
|
|
#
|
2006-10-04 17:25:34 +00:00
|
|
|
# Generate declarations
|
2006-09-21 15:48:15 +00:00
|
|
|
|
2006-10-04 17:25:34 +00:00
|
|
|
gen_cats(mcs_num_cats)
|
2005-09-16 13:36:26 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Each MCS level specifies a sensitivity and zero or more categories which may
|
|
|
|
# be associated with that sensitivity.
|
|
|
|
#
|
2006-10-04 17:25:34 +00:00
|
|
|
|
|
|
|
gen_levels(1,mcs_num_cats)
|
2005-09-16 13:36:26 +00:00
|
|
|
|
|
|
|
#
|
|
|
|
# Define the MCS policy
|
|
|
|
#
|
|
|
|
# mlsconstrain class_set perm_set expression ;
|
|
|
|
#
|
|
|
|
# mlsvalidatetrans class_set expression ;
|
|
|
|
#
|
|
|
|
# expression : ( expression )
|
|
|
|
# | not expression
|
|
|
|
# | expression and expression
|
|
|
|
# | expression or expression
|
|
|
|
# | u1 op u2
|
|
|
|
# | r1 role_mls_op r2
|
|
|
|
# | t1 op t2
|
|
|
|
# | l1 role_mls_op l2
|
|
|
|
# | l1 role_mls_op h2
|
|
|
|
# | h1 role_mls_op l2
|
|
|
|
# | h1 role_mls_op h2
|
|
|
|
# | l1 role_mls_op h1
|
|
|
|
# | l2 role_mls_op h2
|
|
|
|
# | u1 op names
|
|
|
|
# | u2 op names
|
|
|
|
# | r1 op names
|
|
|
|
# | r2 op names
|
|
|
|
# | t1 op names
|
|
|
|
# | t2 op names
|
|
|
|
# | u3 op names (NOTE: this is only available for mlsvalidatetrans)
|
|
|
|
# | r3 op names (NOTE: this is only available for mlsvalidatetrans)
|
|
|
|
# | t3 op names (NOTE: this is only available for mlsvalidatetrans)
|
|
|
|
#
|
|
|
|
# op : == | !=
|
|
|
|
# role_mls_op : == | != | eq | dom | domby | incomp
|
|
|
|
#
|
|
|
|
# names : name | { name_list }
|
|
|
|
# name_list : name | name_list name
|
|
|
|
#
|
|
|
|
|
|
|
|
#
|
|
|
|
# MCS policy for the file classes
|
|
|
|
#
|
|
|
|
# Constrain file access so that the high range of the process dominates
|
|
|
|
# the high range of the file. We use the high range of the process so
|
|
|
|
# that processes can always simply run at s0.
|
|
|
|
#
|
2009-10-07 15:48:14 +00:00
|
|
|
# Note:
|
|
|
|
# - getattr on dirs/files is not constrained.
|
|
|
|
# - /proc/pid operations are not constrained.
|
|
|
|
|
|
|
|
mlsconstrain file { read ioctl lock execute execute_no_trans }
|
|
|
|
(( h1 dom h2 ) or ( t1 == mcsreadall ) or ( t2 == domain ));
|
2006-02-16 19:32:13 +00:00
|
|
|
|
2009-10-07 15:48:14 +00:00
|
|
|
mlsconstrain file { write setattr append unlink link rename }
|
|
|
|
(( h1 dom h2 ) or ( t1 == mcswriteall ) or ( t2 == domain ));
|
|
|
|
|
|
|
|
mlsconstrain dir { search read ioctl lock }
|
|
|
|
(( h1 dom h2 ) or ( t1 == mcsreadall ) or ( t2 == domain ));
|
|
|
|
|
|
|
|
mlsconstrain dir { write setattr append unlink link rename add_name remove_name }
|
|
|
|
(( h1 dom h2 ) or ( t1 == mcswriteall ) or ( t2 == domain ));
|
2006-09-22 17:14:35 +00:00
|
|
|
|
2006-04-17 17:32:54 +00:00
|
|
|
# New filesystem object labels must be dominated by the relabeling subject
|
|
|
|
# clearance, also the objects are single-level.
|
2006-03-29 14:51:49 +00:00
|
|
|
mlsconstrain file { create relabelto }
|
|
|
|
(( h1 dom h2 ) and ( l2 eq h2 ));
|
2005-09-16 13:36:26 +00:00
|
|
|
|
2005-10-13 20:59:36 +00:00
|
|
|
# new file labels must be dominated by the relabeling subject clearance
|
2010-08-26 13:41:21 +00:00
|
|
|
mlsconstrain { dir lnk_file chr_file blk_file sock_file fifo_file file } { relabelfrom }
|
2005-10-13 20:59:36 +00:00
|
|
|
( h1 dom h2 );
|
2006-03-29 14:51:49 +00:00
|
|
|
|
2010-08-26 13:41:21 +00:00
|
|
|
mlsconstrain { dir lnk_file chr_file blk_file sock_file fifo_file file } { create relabelto }
|
2006-02-16 19:32:13 +00:00
|
|
|
(( h1 dom h2 ) and ( l2 eq h2 ));
|
|
|
|
|
2006-03-29 16:23:17 +00:00
|
|
|
mlsconstrain process { transition dyntransition }
|
|
|
|
(( h1 dom h2 ) or ( t1 == mcssetcats ));
|
|
|
|
|
2006-03-29 14:51:49 +00:00
|
|
|
mlsconstrain process { ptrace }
|
2006-07-28 15:13:58 +00:00
|
|
|
(( h1 dom h2) or ( t1 == mcsptraceall ));
|
2005-09-16 13:36:26 +00:00
|
|
|
|
2010-09-22 20:42:32 +00:00
|
|
|
mlsconstrain process { sigkill sigstop }
|
2006-03-29 14:51:49 +00:00
|
|
|
(( h1 dom h2 ) or ( t1 == mcskillall ));
|
2005-09-16 13:36:26 +00:00
|
|
|
|
2010-09-22 20:42:32 +00:00
|
|
|
mlsconstrain process { signal }
|
|
|
|
(( h1 dom h2 ) or ( t1 != mcsuntrustedproc ));
|
|
|
|
|
2007-08-09 13:15:07 +00:00
|
|
|
#
|
|
|
|
# MCS policy for SELinux-enabled databases
|
|
|
|
#
|
|
|
|
|
|
|
|
# Any database object must be dominated by the relabeling subject
|
|
|
|
# clearance, also the objects are single-level.
|
|
|
|
mlsconstrain { db_database db_table db_procedure db_column db_blob } { create relabelto }
|
|
|
|
(( h1 dom h2 ) and ( l2 eq h2 ));
|
|
|
|
|
|
|
|
mlsconstrain { db_tuple } { insert relabelto }
|
|
|
|
(( h1 dom h2 ) and ( l2 eq h2 ));
|
|
|
|
|
|
|
|
# Access control for any database objects based on MCS rules.
|
2009-05-07 12:35:32 +00:00
|
|
|
mlsconstrain db_database { drop getattr setattr relabelfrom access install_module load_module get_param set_param }
|
2007-08-09 13:15:07 +00:00
|
|
|
( h1 dom h2 );
|
|
|
|
|
2009-05-07 12:35:32 +00:00
|
|
|
mlsconstrain db_table { drop getattr setattr relabelfrom select update insert delete use lock }
|
2007-08-09 13:15:07 +00:00
|
|
|
( h1 dom h2 );
|
|
|
|
|
2009-05-07 12:35:32 +00:00
|
|
|
mlsconstrain db_column { drop getattr setattr relabelfrom select update insert use }
|
2007-08-09 13:15:07 +00:00
|
|
|
( h1 dom h2 );
|
|
|
|
|
|
|
|
mlsconstrain db_tuple { relabelfrom select update delete use }
|
|
|
|
( h1 dom h2 );
|
|
|
|
|
2009-05-07 12:35:32 +00:00
|
|
|
mlsconstrain db_procedure { drop getattr setattr execute install }
|
2007-08-09 13:15:07 +00:00
|
|
|
( h1 dom h2 );
|
|
|
|
|
2009-05-07 12:35:32 +00:00
|
|
|
mlsconstrain db_blob { drop getattr setattr relabelfrom read write import export }
|
2007-08-09 13:15:07 +00:00
|
|
|
( h1 dom h2 );
|
|
|
|
|
2005-09-16 13:36:26 +00:00
|
|
|
') dnl end enable_mcs
|