16cd6a6acSopenharmony_ciSID Statements
26cd6a6acSopenharmony_ci==============
36cd6a6acSopenharmony_ci
46cd6a6acSopenharmony_cisid
56cd6a6acSopenharmony_ci---
66cd6a6acSopenharmony_ci
76cd6a6acSopenharmony_ciDeclares a new SID identifier in the current namespace.
86cd6a6acSopenharmony_ci
96cd6a6acSopenharmony_ci**Statement definition:**
106cd6a6acSopenharmony_ci
116cd6a6acSopenharmony_ci```secil
126cd6a6acSopenharmony_ci    (sid sid_id)
136cd6a6acSopenharmony_ci```
146cd6a6acSopenharmony_ci
156cd6a6acSopenharmony_ci**Where:**
166cd6a6acSopenharmony_ci
176cd6a6acSopenharmony_ci<table>
186cd6a6acSopenharmony_ci<colgroup>
196cd6a6acSopenharmony_ci<col width="25%" />
206cd6a6acSopenharmony_ci<col width="75%" />
216cd6a6acSopenharmony_ci</colgroup>
226cd6a6acSopenharmony_ci<tbody>
236cd6a6acSopenharmony_ci<tr class="odd">
246cd6a6acSopenharmony_ci<td align="left"><p><code>sid</code></p></td>
256cd6a6acSopenharmony_ci<td align="left"><p>The <code>sid</code> keyword.</p></td>
266cd6a6acSopenharmony_ci</tr>
276cd6a6acSopenharmony_ci<tr class="even">
286cd6a6acSopenharmony_ci<td align="left"><p><code>sid_id</code></p></td>
296cd6a6acSopenharmony_ci<td align="left"><p>The <code>sid</code> identifier.</p></td>
306cd6a6acSopenharmony_ci</tr>
316cd6a6acSopenharmony_ci</tbody>
326cd6a6acSopenharmony_ci</table>
336cd6a6acSopenharmony_ci
346cd6a6acSopenharmony_ci**Examples:**
356cd6a6acSopenharmony_ci
366cd6a6acSopenharmony_ciThese examples show three [`sid`](cil_sid_statements.md#sid) declarations:
376cd6a6acSopenharmony_ci
386cd6a6acSopenharmony_ci```secil
396cd6a6acSopenharmony_ci    (sid kernel)
406cd6a6acSopenharmony_ci    (sid security)
416cd6a6acSopenharmony_ci    (sid igmp_packet)
426cd6a6acSopenharmony_ci```
436cd6a6acSopenharmony_ci
446cd6a6acSopenharmony_cisidorder
456cd6a6acSopenharmony_ci--------
466cd6a6acSopenharmony_ci
476cd6a6acSopenharmony_ciDefines the order of [sid](#sid)'s. This is a mandatory statement when SIDs are defined. Multiple [`sidorder`](cil_sid_statements.md#sidorder) statements declared in the policy will form an ordered list.
486cd6a6acSopenharmony_ci
496cd6a6acSopenharmony_ci**Statement definition:**
506cd6a6acSopenharmony_ci
516cd6a6acSopenharmony_ci```secil
526cd6a6acSopenharmony_ci    (sidorder (sid_id ...))
536cd6a6acSopenharmony_ci```
546cd6a6acSopenharmony_ci
556cd6a6acSopenharmony_ci**Where:**
566cd6a6acSopenharmony_ci
576cd6a6acSopenharmony_ci<table>
586cd6a6acSopenharmony_ci<colgroup>
596cd6a6acSopenharmony_ci<col width="25%" />
606cd6a6acSopenharmony_ci<col width="75%" />
616cd6a6acSopenharmony_ci</colgroup>
626cd6a6acSopenharmony_ci<tbody>
636cd6a6acSopenharmony_ci<tr class="odd">
646cd6a6acSopenharmony_ci<td align="left"><p><code>sidorder</code></p></td>
656cd6a6acSopenharmony_ci<td align="left"><p>The <code>sidorder</code> keyword.</p></td>
666cd6a6acSopenharmony_ci</tr>
676cd6a6acSopenharmony_ci<tr class="even">
686cd6a6acSopenharmony_ci<td align="left"><p><code>sid_id</code></p></td>
696cd6a6acSopenharmony_ci<td align="left"><p>One or more <code>sid</code> identifiers.</p></td>
706cd6a6acSopenharmony_ci</tr>
716cd6a6acSopenharmony_ci</tbody>
726cd6a6acSopenharmony_ci</table>
736cd6a6acSopenharmony_ci
746cd6a6acSopenharmony_ci**Example:**
756cd6a6acSopenharmony_ci
766cd6a6acSopenharmony_ciThis will produce an ordered list of "`kernel security unlabeled`"
776cd6a6acSopenharmony_ci
786cd6a6acSopenharmony_ci```secil
796cd6a6acSopenharmony_ci    (sid kernel)
806cd6a6acSopenharmony_ci    (sid security)
816cd6a6acSopenharmony_ci    (sid unlabeled)
826cd6a6acSopenharmony_ci    (sidorder (kernel security))
836cd6a6acSopenharmony_ci    (sidorder (security unlabeled))
846cd6a6acSopenharmony_ci```
856cd6a6acSopenharmony_ci
866cd6a6acSopenharmony_cisidcontext
876cd6a6acSopenharmony_ci----------
886cd6a6acSopenharmony_ci
896cd6a6acSopenharmony_ciAssociates an SELinux security [context](#context) to a previously declared [`sid`](cil_sid_statements.md#sid) identifier.
906cd6a6acSopenharmony_ci
916cd6a6acSopenharmony_ci**Statement definition:**
926cd6a6acSopenharmony_ci
936cd6a6acSopenharmony_ci```secil
946cd6a6acSopenharmony_ci    (sidcontext sid_id context_id)
956cd6a6acSopenharmony_ci```
966cd6a6acSopenharmony_ci
976cd6a6acSopenharmony_ci**Where:**
986cd6a6acSopenharmony_ci
996cd6a6acSopenharmony_ci<table>
1006cd6a6acSopenharmony_ci<colgroup>
1016cd6a6acSopenharmony_ci<col width="25%" />
1026cd6a6acSopenharmony_ci<col width="75%" />
1036cd6a6acSopenharmony_ci</colgroup>
1046cd6a6acSopenharmony_ci<tbody>
1056cd6a6acSopenharmony_ci<tr class="odd">
1066cd6a6acSopenharmony_ci<td align="left"><p><code>sidcontext</code></p></td>
1076cd6a6acSopenharmony_ci<td align="left"><p>The <code>sidcontext</code> keyword.</p></td>
1086cd6a6acSopenharmony_ci</tr>
1096cd6a6acSopenharmony_ci<tr class="even">
1106cd6a6acSopenharmony_ci<td align="left"><p><code>sid_id</code></p></td>
1116cd6a6acSopenharmony_ci<td align="left"><p>A single previously declared <code>sid</code> identifier.</p></td>
1126cd6a6acSopenharmony_ci</tr>
1136cd6a6acSopenharmony_ci<tr class="odd">
1146cd6a6acSopenharmony_ci<td align="left"><p><code>context_id</code></p></td>
1156cd6a6acSopenharmony_ci<td align="left"><p>A previously declared <code>context</code> identifier or an anonymous security context (<code>user role type levelrange</code>), the range MUST be defined whether the policy is MLS/MCS enabled or not.</p></td>
1166cd6a6acSopenharmony_ci</tr>
1176cd6a6acSopenharmony_ci</tbody>
1186cd6a6acSopenharmony_ci</table>
1196cd6a6acSopenharmony_ci
1206cd6a6acSopenharmony_ci**Examples:**
1216cd6a6acSopenharmony_ci
1226cd6a6acSopenharmony_ciThis shows two named security context examples plus an anonymous context:
1236cd6a6acSopenharmony_ci
1246cd6a6acSopenharmony_ci```secil
1256cd6a6acSopenharmony_ci    ; Two named context:
1266cd6a6acSopenharmony_ci    (sid kernel)
1276cd6a6acSopenharmony_ci    (context kernel_context (u r process low_low))
1286cd6a6acSopenharmony_ci    (sidcontext kernel kernel_context)
1296cd6a6acSopenharmony_ci
1306cd6a6acSopenharmony_ci    (sid security)
1316cd6a6acSopenharmony_ci    (context security_context (u object_r process low_low))
1326cd6a6acSopenharmony_ci    (sidcontext security security_context)
1336cd6a6acSopenharmony_ci
1346cd6a6acSopenharmony_ci    ; An anonymous context:
1356cd6a6acSopenharmony_ci    (sid unlabeled)
1366cd6a6acSopenharmony_ci    (sidcontext unlabeled (u object_r ((s0) (s0))))
1376cd6a6acSopenharmony_ci```
138