File: mcs

package info (click to toggle)
refpolicy 0.0.20061018-5
  • links: PTS
  • area: main
  • in suites: etch-m68k
  • size: 7,488 kB
  • ctags: 415
  • sloc: xml: 55,156; python: 1,867; makefile: 463; sh: 457; ansic: 290; perl: 171; sed: 14; awk: 7
file content (101 lines) | stat: -rw-r--r-- 2,824 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
ifdef(`enable_mcs',`
#
# Define sensitivities 
#
# MCS is single-sensitivity.

gen_sens(1)

#
# Define the categories
#
# Generate declarations

gen_cats(mcs_num_cats)

#
# Each MCS level specifies a sensitivity and zero or more categories which may
# be associated with that sensitivity.
#

gen_levels(1,mcs_num_cats)

#
# 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.
#
# Note that getattr on files is always permitted.
#
mlsconstrain file { write setattr append unlink link rename ioctl lock execute relabelfrom }
	( h1 dom h2 );

mlsconstrain dir { create getattr setattr read write link unlink rename search add_name remove_name reparent rmdir lock ioctl }
	(( h1 dom h2 ) or ( t2 == domain ) or ( t1 == mlsfileread ));

# New filesystem object labels must be dominated by the relabeling subject
# clearance, also the objects are single-level.
mlsconstrain file { create relabelto }
	(( h1 dom h2 ) and ( l2 eq h2 ));

# At this time we do not restrict "ps" type operations via MCS.  This
# will probably change in future.
mlsconstrain file { read }
	(( h1 dom h2 ) or ( t2 == domain ) or ( t1 == mlsfileread ));

# new file labels must be dominated by the relabeling subject clearance
mlsconstrain { dir lnk_file chr_file blk_file sock_file fifo_file } { relabelfrom }
	( h1 dom h2 );

mlsconstrain { dir lnk_file chr_file blk_file sock_file fifo_file } { create relabelto }
	(( h1 dom h2 ) and ( l2 eq h2 ));

mlsconstrain process { transition dyntransition }
	(( h1 dom h2 ) or ( t1 == mcssetcats ));

mlsconstrain process { ptrace }
	(( h1 dom h2) or ( t1 == mcsptraceall ));

mlsconstrain process { sigkill sigstop }
	(( h1 dom h2 ) or ( t1 == mcskillall ));

') dnl end enable_mcs