]> git.ipfire.org Git - people/stevee/selinux-policy.git/blob - policy/mcs
Merge branch 'master' of ssh://git.fedorahosted.org/git/selinux-policy; branch 'maste...
[people/stevee/selinux-policy.git] / policy / mcs
1 ifdef(`enable_mcs',`
2 #
3 # Define sensitivities
4 #
5 # MCS is single-sensitivity.
6
7 gen_sens(1)
8
9 #
10 # Define the categories
11 #
12 # Generate declarations
13
14 gen_cats(mcs_num_cats)
15
16 #
17 # Each MCS level specifies a sensitivity and zero or more categories which may
18 # be associated with that sensitivity.
19 #
20
21 gen_levels(1,mcs_num_cats)
22
23 #
24 # Define the MCS policy
25 #
26 # mlsconstrain class_set perm_set expression ;
27 #
28 # mlsvalidatetrans class_set expression ;
29 #
30 # expression : ( expression )
31 # | not expression
32 # | expression and expression
33 # | expression or expression
34 # | u1 op u2
35 # | r1 role_mls_op r2
36 # | t1 op t2
37 # | l1 role_mls_op l2
38 # | l1 role_mls_op h2
39 # | h1 role_mls_op l2
40 # | h1 role_mls_op h2
41 # | l1 role_mls_op h1
42 # | l2 role_mls_op h2
43 # | u1 op names
44 # | u2 op names
45 # | r1 op names
46 # | r2 op names
47 # | t1 op names
48 # | t2 op names
49 # | u3 op names (NOTE: this is only available for mlsvalidatetrans)
50 # | r3 op names (NOTE: this is only available for mlsvalidatetrans)
51 # | t3 op names (NOTE: this is only available for mlsvalidatetrans)
52 #
53 # op : == | !=
54 # role_mls_op : == | != | eq | dom | domby | incomp
55 #
56 # names : name | { name_list }
57 # name_list : name | name_list name
58 #
59
60 #
61 # MCS policy for the file classes
62 #
63 # Constrain file access so that the high range of the process dominates
64 # the high range of the file. We use the high range of the process so
65 # that processes can always simply run at s0.
66 #
67 # Note:
68 # - getattr on dirs/files is not constrained.
69 # - /proc/pid operations are not constrained.
70
71 mlsconstrain file { read ioctl lock execute execute_no_trans }
72 (( h1 dom h2 ) or ( t1 == mcsreadall ) or ( t2 == domain ));
73
74 mlsconstrain file { write setattr append unlink link rename }
75 (( h1 dom h2 ) or ( t1 == mcswriteall ) or ( t2 == domain ));
76
77 mlsconstrain dir { search read ioctl lock }
78 (( h1 dom h2 ) or ( t1 == mcsreadall ) or ( t2 == domain ));
79
80 mlsconstrain dir { write setattr append unlink link rename add_name remove_name }
81 (( h1 dom h2 ) or ( t1 == mcswriteall ) or ( t2 == domain ));
82
83 # New filesystem object labels must be dominated by the relabeling subject
84 # clearance, also the objects are single-level.
85 mlsconstrain file { create relabelto }
86 (( h1 dom h2 ) and ( l2 eq h2 ));
87
88 # new file labels must be dominated by the relabeling subject clearance
89 mlsconstrain { dir lnk_file chr_file blk_file sock_file fifo_file file } { relabelfrom }
90 ( h1 dom h2 );
91
92 mlsconstrain { dir lnk_file chr_file blk_file sock_file fifo_file file } { create relabelto }
93 (( h1 dom h2 ) and ( l2 eq h2 ));
94
95 mlsconstrain process { transition dyntransition }
96 (( h1 dom h2 ) or ( t1 == mcssetcats ));
97
98 mlsconstrain process { ptrace }
99 (( h1 dom h2) or ( t1 == mcsptraceall ));
100
101 mlsconstrain process { sigkill sigstop }
102 (( h1 dom h2 ) or ( t1 == mcskillall ));
103
104 mlsconstrain process { signal }
105 (( h1 dom h2 ) or ( t1 != mcsuntrustedproc ));
106
107 #
108 # MCS policy for SELinux-enabled databases
109 #
110
111 # Any database object must be dominated by the relabeling subject
112 # clearance, also the objects are single-level.
113 mlsconstrain { db_database db_schema db_table db_sequence db_view db_procedure db_language db_column db_blob } { create relabelto }
114 (( h1 dom h2 ) and ( l2 eq h2 ));
115
116 mlsconstrain { db_tuple } { insert relabelto }
117 (( h1 dom h2 ) and ( l2 eq h2 ));
118
119 # Access control for any database objects based on MCS rules.
120 mlsconstrain db_database { drop getattr setattr relabelfrom access install_module load_module get_param set_param }
121 ( h1 dom h2 );
122
123 mlsconstrain db_language { drop getattr setattr relabelfrom execute }
124 ( h1 dom h2 );
125
126 mlsconstrain db_table { drop getattr setattr relabelfrom select update insert delete use lock }
127 ( h1 dom h2 );
128
129 mlsconstrain db_column { drop getattr setattr relabelfrom select update insert use }
130 ( h1 dom h2 );
131
132 mlsconstrain db_tuple { relabelfrom select update delete use }
133 ( h1 dom h2 );
134
135 mlsconstrain db_sequence { drop getattr setattr relabelfrom get_value next_value set_value }
136 ( h1 dom h2 );
137
138 mlsconstrain db_view { drop getattr setattr relabelfrom expand }
139 ( h1 dom h2 );
140
141 mlsconstrain db_procedure { drop getattr setattr relabelfrom execute install }
142 ( h1 dom h2 );
143
144 mlsconstrain db_language { drop getattr setattr relabelfrom execute }
145 ( h1 dom h2 );
146
147 mlsconstrain db_blob { drop getattr setattr relabelfrom read write import export }
148 ( h1 dom h2 );
149
150 mlsconstrain packet { send recv }
151 (( h1 dom h2 ) or ( t1 == mcsnetwrite ));
152
153 ') dnl end enable_mcs