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 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638
|
Multi-Level Security Labeling Statements
========================================
Because there are many options for MLS labeling, the examples show a limited selection of statements, however there is a simple policy that will build shown in the [`levelrange`](cil_mls_labeling_statements.md#levelrange) section.
sensitivity
-----------
Declare a sensitivity identifier in the current namespace. Multiple [`sensitivity`](cil_mls_labeling_statements.md#sensitivity) statements in the policy will form an ordered list.
**Statement definition:**
(sensitivity sensitivity_id)
**Where:**
<table>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>sensitivity</code></p></td>
<td align="left"><p>The <code>sensitivity</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>sensitivity_id</code></p></td>
<td align="left"><p>The <code>sensitivity</code> identifier.</p></td>
</tr>
</tbody>
</table>
**Example:**
This example declares three [`sensitivity`](cil_mls_labeling_statements.md#sensitivity) identifiers:
(sensitivity s0)
(sensitivity s1)
(sensitivity s2)
sensitivityalias
----------------
Declares a sensitivity alias identifier in the current namespace. See the [`sensitivityaliasactual`](cil_mls_labeling_statements.md#sensitivityaliasactual) statement for an example that associates the [`sensitivityalias`](cil_mls_labeling_statements.md#sensitivityalias) identifier.
**Statement definition:**
(sensitivityalias sensitivityalias_id)
**Where:**
<table>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>sensitivityalias</code></p></td>
<td align="left"><p>The <code>sensitivityalias</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>sensitivityalias_id</code></p></td>
<td align="left"><p>The <code>sensitivityalias</code> identifier.</p></td>
</tr>
</tbody>
</table>
**Example:**
See the [`sensitivityaliasactual`](cil_mls_labeling_statements.md#sensitivityaliasactual) statement.
sensitivityaliasactual
----------------------
Associates a previously declared [`sensitivityalias`](cil_mls_labeling_statements.md#sensitivityalias) identifier to a previously declared [`sensitivity`](cil_mls_labeling_statements.md#sensitivity) identifier.
**Statement definition:**
(sensitivityaliasactual sensitivityalias_id sensitivity_id)
**Where:**
<table>
<colgroup>
<col width="29%" />
<col width="70%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>sensitivityaliasactual</code></p></td>
<td align="left"><p>The <code>sensitivityaliasactual</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>sensitivityalias_id</code></p></td>
<td align="left"><p>A single previously declared <code>sensitivityalias</code> identifier.</p></td>
</tr>
<tr class="odd">
<td align="left"><p><code>sensitivity_id</code></p></td>
<td align="left"><p>A single previously declared <code>sensitivity</code> identifier.</p></td>
</tr>
</tbody>
</table>
**Example:**
This example will associate sensitivity `s0` with two sensitivity alias's:
(sensitivity s0)
(sensitivityalias unclassified)
(sensitivityalias SystemLow)
(sensitivityaliasactual unclassified s0)
(sensitivityaliasactual SystemLow s0)
sensitivityorder
----------------
Define the sensitivity order - lowest to highest. Multiple [`sensitivityorder`](cil_mls_labeling_statements.md#sensitivityorder) statements in the policy will form an ordered list.
**Statement definition:**
(sensitivityorder (sensitivity_id ...))
**Where:**
<table>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>sensitivityorder</code></p></td>
<td align="left"><p>The <code>sensitivityorder</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>sensitivity_id</code></p></td>
<td align="left"><p>One or more previously declared <code>sensitivity</code> or <code>sensitivityalias</code> identifiers..</p></td>
</tr>
</tbody>
</table>
**Example:**
This example shows two [`sensitivityorder`](cil_mls_labeling_statements.md#sensitivityorder) statements that when compiled will form an ordered list. Note however that the second [`sensitivityorder`](cil_mls_labeling_statements.md#sensitivityorder) statement starts with `s2` so that the ordered list can be built.
(sensitivity s0)
(sensitivityalias s0 SystemLow)
(sensitivity s1)
(sensitivity s2)
(sensitivityorder (SystemLow s1 s2))
(sensitivity s3)
(sensitivity s4)
(sensitivityalias s4 SystemHigh)
(sensitivityorder (s2 s3 SystemHigh))
category
--------
Declare a category identifier in the current namespace. Multiple category statements declared in the policy will form an ordered list.
**Statement definition:**
(category category_id)
**Where:**
<table>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>category</code></p></td>
<td align="left"><p>The <code>category</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>category_id</code></p></td>
<td align="left"><p>The <code>category</code> identifier.</p></td>
</tr>
</tbody>
</table>
**Example:**
This example declares a three [`category`](cil_mls_labeling_statements.md#category) identifiers:
(category c0)
(category c1)
(category c2)
categoryalias
-------------
Declares a category alias identifier in the current namespace. See the [`categoryaliasactual`](cil_mls_labeling_statements.md#categoryaliasactual) statement for an example that associates the [`categoryalias`](cil_mls_labeling_statements.md#categoryalias) identifier.
**Statement definition:**
(categoryalias categoryalias_id)
**Where:**
<table>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>categoryalias</code></p></td>
<td align="left"><p>The <code>categoryalias</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>categoryalias_id</code></p></td>
<td align="left"><p>The <code>categoryalias</code> identifier.</p></td>
</tr>
</tbody>
</table>
categoryaliasactual
-------------------
Associates a previously declared [`categoryalias`](cil_mls_labeling_statements.md#categoryalias) identifier to a previously declared [`category`](cil_mls_labeling_statements.md#category) identifier.
**Statement definition:**
(categoryaliasactual categoryalias_id category_id)
**Where:**
<table>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>categoryaliasactual</code></p></td>
<td align="left"><p>The <code>categoryaliasactual</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>categoryalias_id</code></p></td>
<td align="left"><p>A single previously declared <code>categoryalias</code> identifier.</p></td>
</tr>
<tr class="odd">
<td align="left"><p><code>category_id</code></p></td>
<td align="left"><p>A single previously declared <code>category</code> identifier.</p></td>
</tr>
</tbody>
</table>
**Example:**
Declares a category `c0`, a category alias of `documents`, and then associates them:
(category c0)
(categoryalias documents)
(categoryaliasactual documents c0)
categoryorder
-------------
Define the category order. Multiple [`categoryorder`](cil_mls_labeling_statements.md#categoryorder) statements declared in the policy will form an ordered list. Note that this statement orders the categories to allow validation of category ranges.
**Statement definition:**
(categoryorder (category_id ...))
**Where:**
<table>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>categoryorder</code></p></td>
<td align="left"><p>The <code>categoryorder</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>category_id</code></p></td>
<td align="left"><p>One or more previously declared <code>category</code> or <code>categoryalias</code> identifiers.</p></td>
</tr>
</tbody>
</table>
**Example:**
This example orders one category alias and nine categories:
(categoryorder (documents c1 c2 c3 c4 c5 c6 c7 c8 c9)
categoryset
-----------
Declare an identifier for a set of contiguous or non-contiguous categories in the current namespace.
Notes:
- Category expressions are allowed in [`categoryset`](cil_mls_labeling_statements.md#categoryset), [`sensitivitycategory`](cil_mls_labeling_statements.md#sensitivitycategory), [`level`](cil_mls_labeling_statements.md#level), and [`levelrange`](cil_mls_labeling_statements.md#levelrange) statements.
- Category sets are not allowed in [`categoryorder`](cil_mls_labeling_statements.md#categoryorder) statements.
**Statement definition:**
(categoryset categoryset_id (category_id ... | expr ...))
**Where:**
<table>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>categoryset</code></p></td>
<td align="left"><p>The <code>categoryset</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>categoryset_id</code></p></td>
<td align="left"><p>The <code>categoryset</code> identifier.</p></td>
</tr>
<tr class="odd">
<td align="left"><p><code>category_id</code></p></td>
<td align="left"><p>Zero or more previously declared <code>category</code> or <code>categoryalias</code> identifiers.</p>
<p>Note that there must be at least one <code>category_id</code> identifier or <code>expr</code> parameter declared.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>expr</code></p></td>
<td align="left"><p>Zero or more <code>expr</code>'s, the valid operators and syntax are:</p>
<p><code> (and (category_id ...) (category_id ...))</code></p>
<p><code> (or (category_id ...) (category_id ...))</code></p>
<p><code> (xor (category_id ...) (category_id ...))</code></p>
<p><code> (not (category_id ...))</code></p>
<p><code> (range category_id category_id)</code></p>
<p><code> (all)</code></p></td>
</tr>
</tbody>
</table>
**Examples:**
These examples show a selection of [`categoryset`](cil_mls_labeling_statements.md#categoryset) statements:
; Declare categories with two alias's:
(category c0)
(categoryalias documents)
(categoryaliasactual documents c0)
(category c1)
(category c2)
(category c3)
(category c4)
(categoryalias spreadsheets)
(categoryaliasactual spreadsheets c4)
; Set the order to determine ranges:
(categoryorder (c0 c1 c2 c3 spreadsheets))
(categoryset catrange_1 (range c2 c3))
; Two methods to associate all categories:
(categoryset all_cats (range c0 c4))
(categoryset all_cats1 (all))
(categoryset catset_1 (documents c1))
(categoryset catset_2 (c2 c3))
(categoryset catset_3 (c4))
(categoryset just_c0 (xor (c1 c2) (documents c1 c2)))
sensitivitycategory
-------------------
Associate a [`sensitivity`](cil_mls_labeling_statements.md#sensitivity) identifier with one or more [category](#category)'s. Multiple definitions for the same [`sensitivity`](cil_mls_labeling_statements.md#sensitivity) form an ordered list of categories for that sensitivity. This statement is required before a [`level`](cil_mls_labeling_statements.md#level) identifier can be declared.
**Statement definition:**
(sensitivitycategory sensitivity_id categoryset_id)
**Where:**
<table>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>sensitivitycategory</code></p></td>
<td align="left"><p>The <code>sensitivitycategory</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>sensitivity_id</code></p></td>
<td align="left"><p>A single previously declared <code>sensitivity</code> or <code>sensitivityalias</code> identifier.</p></td>
</tr>
<tr class="odd">
<td align="left"><p><code>categoryset_id</code></p></td>
<td align="left"><p>A single previously declared <code>categoryset</code> (named or anonymous), or a list of <code>category</code> and/or <code>categoryalias</code> identifiers. The examples show each variation.</p></td>
</tr>
</tbody>
</table>
**Examples:**
These [`sensitivitycategory`](cil_mls_labeling_statements.md#sensitivitycategory) examples use a selection of [`category`](cil_mls_labeling_statements.md#category), [`categoryalias`](cil_mls_labeling_statements.md#categoryalias) and [`categoryset`](cil_mls_labeling_statements.md#categoryset)'s:
(sensitivitycategory s0 catrange_1)
(sensitivitycategory s0 catset_1)
(sensitivitycategory s0 catset_3)
(sensitivitycategory s0 (all))
(sensitivitycategory unclassified (range documents c2))
level
-----
Declare a [`level`](cil_mls_labeling_statements.md#level) identifier in the current namespace and associate it to a previously declared [`sensitivity`](cil_mls_labeling_statements.md#sensitivity) and zero or more categories. Note that if categories are required, then before this statement can be resolved the [`sensitivitycategory`](cil_mls_labeling_statements.md#sensitivitycategory) statement must be used to associate categories with the sensitivity.
**Statement definition:**
level level_id (sensitivity_id [categoryset_id])
**Where:**
<table>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>level</code></p></td>
<td align="left"><p>The <code>level</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>level_id</code></p></td>
<td align="left"><p>The <code>level</code> identifier.</p></td>
</tr>
<tr class="odd">
<td align="left"><p><code>sensitivity_id</code></p></td>
<td align="left"><p>A single previously declared <code>sensitivity</code> or <code>sensitivityalias</code> identifier.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>categoryset_id</code></p></td>
<td align="left"><p>A single previously declared <code>categoryset</code> (named or anonymous), or a list of <code>category</code> and/or <code>categoryalias</code> identifiers. The examples show each variation.</p></td>
</tr>
</tbody>
</table>
**Examples:**
These [`level`](cil_mls_labeling_statements.md#level) examples use a selection of [`category`](cil_mls_labeling_statements.md#category), [`categoryalias`](cil_mls_labeling_statements.md#categoryalias) and [`categoryset`](cil_mls_labeling_statements.md#categoryset)'s:
(level systemLow (s0))
(level level_1 (s0))
(level level_2 (s0 (catrange_1)))
(level level_3 (s0 (all_cats)))
(level level_4 (unclassified (c2 c3 c4)))
levelrange
----------
Declare a level range identifier in the current namespace and associate a current and clearance level.
**Statement definition:**
(levelrange levelrange_id (low_level_id high_level_id))
**Where:**
<table>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>levelrange</code></p></td>
<td align="left"><p>The <code>levelrange</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>levelrange_id</code></p></td>
<td align="left"><p>The <code>levelrange</code> identifier.</p></td>
</tr>
<tr class="odd">
<td align="left"><p><code>low_level_id</code></p></td>
<td align="left"><p>The current level specified by a previously declared <code>level</code> identifier. This may be formed by named or anonymous components as discussed in the <code>level</code> section and shown in the examples.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>high_level_id</code></p></td>
<td align="left"><p>The clearance or high level specified by a previously declared <code>level</code> identifier. This may be formed by named or anonymous components as discussed in the <code>level</code> section and shown in the examples.</p></td>
</tr>
</tbody>
</table>
**Examples:**
This example policy shows [`levelrange`](cil_mls_labeling_statements.md#levelrange) statement and all the other MLS labeling statements discussed in this section and will compile as a standalone policy:
(handleunknown allow)
(mls true)
; There must be least one set of SID statements in a policy:
(sid kernel)
(sidorder (kernel))
(sidcontext kernel unconfined.context_1)
(sensitivitycategory s0 (c4 c2 c3 c1 c0 c3))
(category c0)
(categoryalias documents)
(categoryaliasactual documents c0)
(category c1)
(category c2)
(category c3)
(category c4)
(categoryalias spreadsheets)
(categoryaliasactual spreadsheets c4)
(categoryorder (c0 c1 c2 c3 spreadsheets))
(categoryset catrange_1 (range c2 c3))
(categoryset all_cats (range c0 c4))
(categoryset all_cats1 (all))
(categoryset catset_1 (documents c1))
(categoryset catset_2 (c2 c3))
(categoryset catset_3 (c4))
(categoryset just_c0 (xor (c1 c2) (documents c1 c2)))
(sensitivity s0)
(sensitivityalias unclassified)
(sensitivityaliasactual unclassified s0)
(sensitivityorder (s0))
(sensitivitycategory s0 (c0))
(sensitivitycategory s0 catrange_1)
(sensitivitycategory s0 catset_1)
(sensitivitycategory s0 catset_3)
(sensitivitycategory s0 (all))
(sensitivitycategory s0 (range documents c2))
(level systemLow (s0))
(level level_1 (s0))
(level level_2 (s0 (catrange_1)))
(level level_3 (s0 (all_cats)))
(level level_4 (unclassified (c2 c3 c4)))
(levelrange levelrange_2 (level_2 level_2))
(levelrange levelrange_1 ((s0) level_2))
(levelrange low_low (systemLow systemLow))
(context context_2 (unconfined.user object_r unconfined.object (level_1 level_3)))
; Define object_r role. This must be assigned in CIL.
(role object_r)
(block unconfined
(user user)
(role role)
(type process)
(type object)
(userrange user (systemLow systemLow))
(userlevel user systemLow)
(userrole user role)
(userrole user object_r)
(roletype role process)
(roletype role object)
(roletype object_r object)
(class file (open execute read write))
; There must be least one allow rule in a policy:
(allow process self (file (read)))
(context context_1 (user object_r object low_low))
) ; End unconfined namespace
rangetransition
---------------
Allows an objects level to transition to a different level. Generally used to ensure processes run with their correct MLS range, for example `init` would run at `SystemHigh` and needs to initialise / run other processes at their correct MLS range.
**Statement definition:**
(rangetransition source_id target_id class_id new_range_id)
**Where:**
<table>
<colgroup>
<col width="25%" />
<col width="75%" />
</colgroup>
<tbody>
<tr class="odd">
<td align="left"><p><code>rangetransition</code></p></td>
<td align="left"><p>The <code>rangetransition</code> keyword.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>source_type_id</code></p></td>
<td align="left"><p>A single previously declared <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p></td>
</tr>
<tr class="odd">
<td align="left"><p><code>target_type_id</code></p></td>
<td align="left"><p>A single previously declared <code>type</code>, <code>typealias</code> or <code>typeattribute</code> identifier.</p></td>
</tr>
<tr class="even">
<td align="left"><p><code>class_id</code></p></td>
<td align="left"><p>A single previously declared <code>class</code> or <code>classmap</code> identifier.</p></td>
</tr>
<tr class="odd">
<td align="left"><p><code>new_range_id</code></p></td>
<td align="left"><p>The new MLS range for the object class that is a previously declared <code>levelrange</code> identifier. This entry may also be defined as an anonymous or named <code>level</code>, <code>sensitivity</code>, <code>sensitivityalias</code>, <code>category</code>, <code>categoryalias</code> or <code>categoryset</code> identifier.</p></td>
</tr>
</tbody>
</table>
**Examples:**
This rule will transition the range of `sshd.exec` to `s0 - s1:c0.c3` on execution from the `init.process`:
(sensitivity s0)
(sensitivity s1)
(sensitivityorder s0 s1)
(category c0)
...
(level systemlow (s0)
(level systemhigh (s1 (c0 c1 c2)))
(levelrange low_high (systemlow systemhigh))
(rangetransition init.process sshd.exec process low_high)
|