1*2d543d20SAndroid Build Coastguard WorkerContainer Statements 2*2d543d20SAndroid Build Coastguard Worker==================== 3*2d543d20SAndroid Build Coastguard Worker 4*2d543d20SAndroid Build Coastguard Workerblock 5*2d543d20SAndroid Build Coastguard Worker----- 6*2d543d20SAndroid Build Coastguard Worker 7*2d543d20SAndroid Build Coastguard WorkerStart a new namespace. 8*2d543d20SAndroid Build Coastguard Worker 9*2d543d20SAndroid Build Coastguard WorkerNot allowed in [`macro`](cil_call_macro_statements.md#macro) and [`optional`](cil_container_statements.md#optional) blocks. 10*2d543d20SAndroid Build Coastguard Worker 11*2d543d20SAndroid Build Coastguard Worker[`sensitivity`](cil_mls_labeling_statements.md#sensitivity) and [`category`](cil_mls_labeling_statements.md#category) statements are not allowed in [`block`](cil_container_statements.md#block) blocks. 12*2d543d20SAndroid Build Coastguard Worker 13*2d543d20SAndroid Build Coastguard WorkerDuplicate declarations of a [`block`](cil_container_statements.md#block) in the same namespace will normally cause an error, but inheriting a block into a namespace (with [`blockinherit`](cil_container_statements.md#blockinherit)) that already has a block with the same name will only result in a warning message and not cause an error. The policy from both blocks will end up in the binary policy. This behavior was used in the past to allow a block to be declared so that an [`in-statement`](cil_container_statements.md#in) could be used on it, but now an [`in-statement`](cil_container_statements.md#in) can be specified to occur after inheritance, so this behavior is not necessary (but is still allowed). 14*2d543d20SAndroid Build Coastguard Worker 15*2d543d20SAndroid Build Coastguard Worker**Statement definition:** 16*2d543d20SAndroid Build Coastguard Worker 17*2d543d20SAndroid Build Coastguard Worker```secil 18*2d543d20SAndroid Build Coastguard Worker (block block_id 19*2d543d20SAndroid Build Coastguard Worker cil_statement 20*2d543d20SAndroid Build Coastguard Worker ... 21*2d543d20SAndroid Build Coastguard Worker ) 22*2d543d20SAndroid Build Coastguard Worker``` 23*2d543d20SAndroid Build Coastguard Worker 24*2d543d20SAndroid Build Coastguard Worker**Where:** 25*2d543d20SAndroid Build Coastguard Worker 26*2d543d20SAndroid Build Coastguard Worker<table> 27*2d543d20SAndroid Build Coastguard Worker<colgroup> 28*2d543d20SAndroid Build Coastguard Worker<col width="25%" /> 29*2d543d20SAndroid Build Coastguard Worker<col width="75%" /> 30*2d543d20SAndroid Build Coastguard Worker</colgroup> 31*2d543d20SAndroid Build Coastguard Worker<tbody> 32*2d543d20SAndroid Build Coastguard Worker<tr class="odd"> 33*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>block</code></p></td> 34*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>block</code> keyword.</p></td> 35*2d543d20SAndroid Build Coastguard Worker</tr> 36*2d543d20SAndroid Build Coastguard Worker<tr class="even"> 37*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>block_id</code></p></td> 38*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The namespace identifier.</p></td> 39*2d543d20SAndroid Build Coastguard Worker</tr> 40*2d543d20SAndroid Build Coastguard Worker<tr class="odd"> 41*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>cil_statement</code></p></td> 42*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>Zero or more valid CIL statements.</p></td> 43*2d543d20SAndroid Build Coastguard Worker</tr> 44*2d543d20SAndroid Build Coastguard Worker</tbody> 45*2d543d20SAndroid Build Coastguard Worker</table> 46*2d543d20SAndroid Build Coastguard Worker 47*2d543d20SAndroid Build Coastguard Worker**Example:** 48*2d543d20SAndroid Build Coastguard Worker 49*2d543d20SAndroid Build Coastguard WorkerSee the [`blockinherit`](cil_container_statements.md#blockinherit) statement for an example. 50*2d543d20SAndroid Build Coastguard Worker 51*2d543d20SAndroid Build Coastguard Workerblockabstract 52*2d543d20SAndroid Build Coastguard Worker------------- 53*2d543d20SAndroid Build Coastguard Worker 54*2d543d20SAndroid Build Coastguard WorkerDeclares the namespace as a 'template' and does not generate code until instantiated by another namespace that has a [`blockinherit`](cil_container_statements.md#blockinherit) statement. 55*2d543d20SAndroid Build Coastguard Worker 56*2d543d20SAndroid Build Coastguard WorkerNot allowed in [`macro`](cil_call_macro_statements.md#macro) and [`optional`](cil_container_statements.md#optional) blocks. 57*2d543d20SAndroid Build Coastguard Worker 58*2d543d20SAndroid Build Coastguard Worker**Statement definition:** 59*2d543d20SAndroid Build Coastguard Worker 60*2d543d20SAndroid Build Coastguard Worker```secil 61*2d543d20SAndroid Build Coastguard Worker (block block_id 62*2d543d20SAndroid Build Coastguard Worker (blockabstract template_id) 63*2d543d20SAndroid Build Coastguard Worker cil_statement 64*2d543d20SAndroid Build Coastguard Worker ... 65*2d543d20SAndroid Build Coastguard Worker ) 66*2d543d20SAndroid Build Coastguard Worker``` 67*2d543d20SAndroid Build Coastguard Worker 68*2d543d20SAndroid Build Coastguard Worker**Where:** 69*2d543d20SAndroid Build Coastguard Worker 70*2d543d20SAndroid Build Coastguard Worker<table> 71*2d543d20SAndroid Build Coastguard Worker<colgroup> 72*2d543d20SAndroid Build Coastguard Worker<col width="25%" /> 73*2d543d20SAndroid Build Coastguard Worker<col width="75%" /> 74*2d543d20SAndroid Build Coastguard Worker</colgroup> 75*2d543d20SAndroid Build Coastguard Worker<tbody> 76*2d543d20SAndroid Build Coastguard Worker<tr class="odd"> 77*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>block</code></p></td> 78*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>block</code> keyword.</p></td> 79*2d543d20SAndroid Build Coastguard Worker</tr> 80*2d543d20SAndroid Build Coastguard Worker<tr class="even"> 81*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>block_id</code></p></td> 82*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The namespace identifier.</p></td> 83*2d543d20SAndroid Build Coastguard Worker</tr> 84*2d543d20SAndroid Build Coastguard Worker<tr class="odd"> 85*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>blockabstract</code></p></td> 86*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>blockabstract</code> keyword.</p></td> 87*2d543d20SAndroid Build Coastguard Worker</tr> 88*2d543d20SAndroid Build Coastguard Worker<tr class="even"> 89*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>template_id</code></p></td> 90*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The abstract namespace identifier. This must match the <code>block_id</code> entry.</p></td> 91*2d543d20SAndroid Build Coastguard Worker</tr> 92*2d543d20SAndroid Build Coastguard Worker<tr class="odd"> 93*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>cil_statement</code></p></td> 94*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>Zero or more valid CIL statements forming the abstract block.</p></td> 95*2d543d20SAndroid Build Coastguard Worker</tr> 96*2d543d20SAndroid Build Coastguard Worker</tbody> 97*2d543d20SAndroid Build Coastguard Worker</table> 98*2d543d20SAndroid Build Coastguard Worker 99*2d543d20SAndroid Build Coastguard Worker**Example:** 100*2d543d20SAndroid Build Coastguard Worker 101*2d543d20SAndroid Build Coastguard WorkerSee the [`blockinherit`](cil_container_statements.md#blockinherit) statement for an example. 102*2d543d20SAndroid Build Coastguard Worker 103*2d543d20SAndroid Build Coastguard Workerblockinherit 104*2d543d20SAndroid Build Coastguard Worker------------ 105*2d543d20SAndroid Build Coastguard Worker 106*2d543d20SAndroid Build Coastguard WorkerUsed to add common policy rules to the current namespace via a template that has been defined with the [`blockabstract`](cil_container_statements.md#blockabstract) statement. All [`blockinherit`](cil_container_statements.md#blockinherit) statements are resolved first and then the contents of the block are copied. This is so that inherited blocks will not be inherited. For a concrete example, please see the examples section. 107*2d543d20SAndroid Build Coastguard Worker 108*2d543d20SAndroid Build Coastguard WorkerInherited rules are resolved by searching namespaces in the following order: 109*2d543d20SAndroid Build Coastguard Worker 110*2d543d20SAndroid Build Coastguard Worker- The parent namespaces (if any) where the [`blockinherit`](cil_container_statements.md#blockinherit) rule is located with the exception of the global namespace. 111*2d543d20SAndroid Build Coastguard Worker 112*2d543d20SAndroid Build Coastguard Worker- The parent namespaces of the block being inherited (but not that block's namespace) with the exception of the global namespace. 113*2d543d20SAndroid Build Coastguard Worker 114*2d543d20SAndroid Build Coastguard Worker- The global namespace. 115*2d543d20SAndroid Build Coastguard Worker 116*2d543d20SAndroid Build Coastguard WorkerNot allowed in [`macro`](cil_call_macro_statements.md#macro) blocks. 117*2d543d20SAndroid Build Coastguard Worker 118*2d543d20SAndroid Build Coastguard Worker**Statement definition:** 119*2d543d20SAndroid Build Coastguard Worker 120*2d543d20SAndroid Build Coastguard Worker```secil 121*2d543d20SAndroid Build Coastguard Worker (block block_id 122*2d543d20SAndroid Build Coastguard Worker (blockinherit template_id) 123*2d543d20SAndroid Build Coastguard Worker cil_statement 124*2d543d20SAndroid Build Coastguard Worker ... 125*2d543d20SAndroid Build Coastguard Worker ) 126*2d543d20SAndroid Build Coastguard Worker``` 127*2d543d20SAndroid Build Coastguard Worker 128*2d543d20SAndroid Build Coastguard Worker**Where:** 129*2d543d20SAndroid Build Coastguard Worker 130*2d543d20SAndroid Build Coastguard Worker<table> 131*2d543d20SAndroid Build Coastguard Worker<colgroup> 132*2d543d20SAndroid Build Coastguard Worker<col width="25%" /> 133*2d543d20SAndroid Build Coastguard Worker<col width="75%" /> 134*2d543d20SAndroid Build Coastguard Worker</colgroup> 135*2d543d20SAndroid Build Coastguard Worker<tbody> 136*2d543d20SAndroid Build Coastguard Worker<tr class="odd"> 137*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>block</code></p></td> 138*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>block</code> keyword.</p></td> 139*2d543d20SAndroid Build Coastguard Worker</tr> 140*2d543d20SAndroid Build Coastguard Worker<tr class="even"> 141*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>block_id</code></p></td> 142*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The namespace identifier.</p></td> 143*2d543d20SAndroid Build Coastguard Worker</tr> 144*2d543d20SAndroid Build Coastguard Worker<tr class="odd"> 145*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>blockinherit</code></p></td> 146*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>blockinherit</code> keyword.</p></td> 147*2d543d20SAndroid Build Coastguard Worker</tr> 148*2d543d20SAndroid Build Coastguard Worker<tr class="even"> 149*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>template_id</code></p></td> 150*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The inherited namespace identifier.</p></td> 151*2d543d20SAndroid Build Coastguard Worker</tr> 152*2d543d20SAndroid Build Coastguard Worker<tr class="odd"> 153*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>cil_statement</code></p></td> 154*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>Zero or more valid CIL statements.</p></td> 155*2d543d20SAndroid Build Coastguard Worker</tr> 156*2d543d20SAndroid Build Coastguard Worker</tbody> 157*2d543d20SAndroid Build Coastguard Worker</table> 158*2d543d20SAndroid Build Coastguard Worker 159*2d543d20SAndroid Build Coastguard Worker**Example:** 160*2d543d20SAndroid Build Coastguard Worker 161*2d543d20SAndroid Build Coastguard WorkerThis example contains a template `client_server` that is instantiated in two blocks (`netserver_app` and `netclient_app`): 162*2d543d20SAndroid Build Coastguard Worker 163*2d543d20SAndroid Build Coastguard Worker```secil 164*2d543d20SAndroid Build Coastguard Worker ; This is the template block: 165*2d543d20SAndroid Build Coastguard Worker (block client_server 166*2d543d20SAndroid Build Coastguard Worker (blockabstract client_server) 167*2d543d20SAndroid Build Coastguard Worker 168*2d543d20SAndroid Build Coastguard Worker ; Log file labeling 169*2d543d20SAndroid Build Coastguard Worker (type log_file) 170*2d543d20SAndroid Build Coastguard Worker (typeattributeset file_type (log_file)) 171*2d543d20SAndroid Build Coastguard Worker (typeattributeset data_file_type (log_file)) 172*2d543d20SAndroid Build Coastguard Worker (allow process log_file (dir (write search create setattr add_name))) 173*2d543d20SAndroid Build Coastguard Worker (allow process log_file (file (create open append getattr setattr))) 174*2d543d20SAndroid Build Coastguard Worker (roletype object_r log_file) 175*2d543d20SAndroid Build Coastguard Worker (context log_file_context (u object_r log_file low_low)) 176*2d543d20SAndroid Build Coastguard Worker 177*2d543d20SAndroid Build Coastguard Worker ; Process labeling 178*2d543d20SAndroid Build Coastguard Worker (type process) 179*2d543d20SAndroid Build Coastguard Worker (typeattributeset domain (process)) 180*2d543d20SAndroid Build Coastguard Worker (call app_domain (process)) 181*2d543d20SAndroid Build Coastguard Worker (call net_domain (process)) 182*2d543d20SAndroid Build Coastguard Worker ) 183*2d543d20SAndroid Build Coastguard Worker 184*2d543d20SAndroid Build Coastguard Worker ; This is a policy block that will inherit the abstract block above: 185*2d543d20SAndroid Build Coastguard Worker (block netclient_app 186*2d543d20SAndroid Build Coastguard Worker ; Add common policy rules to namespace: 187*2d543d20SAndroid Build Coastguard Worker (blockinherit client_server) 188*2d543d20SAndroid Build Coastguard Worker ; Label the log files 189*2d543d20SAndroid Build Coastguard Worker (filecon "/data/data/com.se4android.netclient/.*" file log_file_context) 190*2d543d20SAndroid Build Coastguard Worker ) 191*2d543d20SAndroid Build Coastguard Worker 192*2d543d20SAndroid Build Coastguard Worker ; This is another policy block that will inherit the abstract block above: 193*2d543d20SAndroid Build Coastguard Worker (block netserver_app 194*2d543d20SAndroid Build Coastguard Worker ; Add common policy rules to namespace: 195*2d543d20SAndroid Build Coastguard Worker (blockinherit client_server) 196*2d543d20SAndroid Build Coastguard Worker 197*2d543d20SAndroid Build Coastguard Worker ; Label the log files 198*2d543d20SAndroid Build Coastguard Worker (filecon "/data/data/com.se4android.netserver/.*" file log_file_context) 199*2d543d20SAndroid Build Coastguard Worker ) 200*2d543d20SAndroid Build Coastguard Worker 201*2d543d20SAndroid Build Coastguard Worker ; This is an example of how blockinherits resolve inherits before copying 202*2d543d20SAndroid Build Coastguard Worker (block a 203*2d543d20SAndroid Build Coastguard Worker (type one)) 204*2d543d20SAndroid Build Coastguard Worker 205*2d543d20SAndroid Build Coastguard Worker (block b 206*2d543d20SAndroid Build Coastguard Worker ; Notice that block a is declared here as well 207*2d543d20SAndroid Build Coastguard Worker (block a 208*2d543d20SAndroid Build Coastguard Worker (type two))) 209*2d543d20SAndroid Build Coastguard Worker 210*2d543d20SAndroid Build Coastguard Worker ; This will first copy the contents of block b, which results in type b.a.two being copied. 211*2d543d20SAndroid Build Coastguard Worker ; Next, the contents of block a will be copied which will result in type a.one. 212*2d543d20SAndroid Build Coastguard Worker (block ab 213*2d543d20SAndroid Build Coastguard Worker (blockinherit b) 214*2d543d20SAndroid Build Coastguard Worker (blockinherit a)) 215*2d543d20SAndroid Build Coastguard Worker``` 216*2d543d20SAndroid Build Coastguard Worker 217*2d543d20SAndroid Build Coastguard Workeroptional 218*2d543d20SAndroid Build Coastguard Worker-------- 219*2d543d20SAndroid Build Coastguard Worker 220*2d543d20SAndroid Build Coastguard WorkerDeclare an [`optional`](cil_container_statements.md#optional) namespace. All CIL statements in the optional block must be satisfied before instantiation in the binary policy. 221*2d543d20SAndroid Build Coastguard Worker 222*2d543d20SAndroid Build Coastguard WorkerNot allowed in [`booleanif`](cil_conditional_statements.md#booleanif) blocks. 223*2d543d20SAndroid Build Coastguard Worker 224*2d543d20SAndroid Build Coastguard Worker[`tunable`](cil_conditional_statements.md#tunable), [`in`](cil_container_statements.md#in), [`block`](cil_container_statements.md#block), [`blockabstract`](cil_container_statements.md#blockabstract), and [`macro`](cil_call_macro_statements.md#macro) statements are not allowed in [`optional`](cil_container_statements.md#optional) blocks. 225*2d543d20SAndroid Build Coastguard Worker 226*2d543d20SAndroid Build Coastguard Worker**Statement definition:** 227*2d543d20SAndroid Build Coastguard Worker 228*2d543d20SAndroid Build Coastguard Worker```secil 229*2d543d20SAndroid Build Coastguard Worker (optional optional_id 230*2d543d20SAndroid Build Coastguard Worker cil_statement 231*2d543d20SAndroid Build Coastguard Worker ... 232*2d543d20SAndroid Build Coastguard Worker ) 233*2d543d20SAndroid Build Coastguard Worker``` 234*2d543d20SAndroid Build Coastguard Worker 235*2d543d20SAndroid Build Coastguard Worker**Where:** 236*2d543d20SAndroid Build Coastguard Worker 237*2d543d20SAndroid Build Coastguard Worker<table> 238*2d543d20SAndroid Build Coastguard Worker<colgroup> 239*2d543d20SAndroid Build Coastguard Worker<col width="25%" /> 240*2d543d20SAndroid Build Coastguard Worker<col width="75%" /> 241*2d543d20SAndroid Build Coastguard Worker</colgroup> 242*2d543d20SAndroid Build Coastguard Worker<tbody> 243*2d543d20SAndroid Build Coastguard Worker<tr class="odd"> 244*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>optional</code></p></td> 245*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>optional</code> keyword.</p></td> 246*2d543d20SAndroid Build Coastguard Worker</tr> 247*2d543d20SAndroid Build Coastguard Worker<tr class="even"> 248*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>optional_id</code></p></td> 249*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>optional</code> namespace identifier.</p></td> 250*2d543d20SAndroid Build Coastguard Worker</tr> 251*2d543d20SAndroid Build Coastguard Worker<tr class="odd"> 252*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>cil_statement</code></p></td> 253*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>Zero or more valid CIL statements.</p></td> 254*2d543d20SAndroid Build Coastguard Worker</tr> 255*2d543d20SAndroid Build Coastguard Worker</tbody> 256*2d543d20SAndroid Build Coastguard Worker</table> 257*2d543d20SAndroid Build Coastguard Worker 258*2d543d20SAndroid Build Coastguard Worker**Example:** 259*2d543d20SAndroid Build Coastguard Worker 260*2d543d20SAndroid Build Coastguard WorkerThis example will instantiate the optional block `ext_gateway.move_file` into policy providing all optional CIL statements can be resolved: 261*2d543d20SAndroid Build Coastguard Worker 262*2d543d20SAndroid Build Coastguard Worker```secil 263*2d543d20SAndroid Build Coastguard Worker (block ext_gateway 264*2d543d20SAndroid Build Coastguard Worker ...... 265*2d543d20SAndroid Build Coastguard Worker (optional move_file 266*2d543d20SAndroid Build Coastguard Worker (typetransition process msg_filter.move_file.in_queue file msg_filter.move_file.in_file) 267*2d543d20SAndroid Build Coastguard Worker (allow process msg_filter.move_file.in_queue (dir (read getattr write search add_name))) 268*2d543d20SAndroid Build Coastguard Worker (allow process msg_filter.move_file.in_file (file (write create getattr))) 269*2d543d20SAndroid Build Coastguard Worker (allow msg_filter.move_file.in_file unconfined.object (filesystem (associate))) 270*2d543d20SAndroid Build Coastguard Worker (typetransition msg_filter.int_gateway.process msg_filter.move_file.out_queue file 271*2d543d20SAndroid Build Coastguard Worker msg_filter.move_file.out_file) 272*2d543d20SAndroid Build Coastguard Worker (allow msg_filter.int_gateway.process msg_filter.move_file.out_queue (dir (read write search))) 273*2d543d20SAndroid Build Coastguard Worker (allow msg_filter.int_gateway.process msg_filter.move_file.out_file (file (read getattr unlink))) 274*2d543d20SAndroid Build Coastguard Worker ) ; End optional block 275*2d543d20SAndroid Build Coastguard Worker 276*2d543d20SAndroid Build Coastguard Worker ..... 277*2d543d20SAndroid Build Coastguard Worker ) ; End block 278*2d543d20SAndroid Build Coastguard Worker``` 279*2d543d20SAndroid Build Coastguard Worker 280*2d543d20SAndroid Build Coastguard Workerin 281*2d543d20SAndroid Build Coastguard Worker-- 282*2d543d20SAndroid Build Coastguard Worker 283*2d543d20SAndroid Build Coastguard WorkerAllows the insertion of CIL statements into a named container ([`block`](cil_container_statements.md#block), [`optional`](cil_container_statements.md#optional) or [`macro`](cil_call_macro_statements.md#macro)). This insertion can be specified to occur either before or after block inheritance has been resolved. 284*2d543d20SAndroid Build Coastguard Worker 285*2d543d20SAndroid Build Coastguard WorkerNot allowed in [`macro`](cil_call_macro_statements.md#macro), [`booleanif`](cil_conditional_statements.md#booleanif), and other [`in`](cil_container_statements.md#in) blocks. 286*2d543d20SAndroid Build Coastguard Worker 287*2d543d20SAndroid Build Coastguard Worker[`tunable`](cil_conditional_statements.md#tunable) and [`in`](cil_container_statements.md#in) statements are not allowed in [`in`](cil_container_statements.md#in) blocks. 288*2d543d20SAndroid Build Coastguard Worker 289*2d543d20SAndroid Build Coastguard Worker**Statement definition:** 290*2d543d20SAndroid Build Coastguard Worker 291*2d543d20SAndroid Build Coastguard Worker```secil 292*2d543d20SAndroid Build Coastguard Worker (in [before|after] container_id 293*2d543d20SAndroid Build Coastguard Worker cil_statement 294*2d543d20SAndroid Build Coastguard Worker ... 295*2d543d20SAndroid Build Coastguard Worker ) 296*2d543d20SAndroid Build Coastguard Worker``` 297*2d543d20SAndroid Build Coastguard Worker 298*2d543d20SAndroid Build Coastguard Worker**Where:** 299*2d543d20SAndroid Build Coastguard Worker 300*2d543d20SAndroid Build Coastguard Worker<table> 301*2d543d20SAndroid Build Coastguard Worker<colgroup> 302*2d543d20SAndroid Build Coastguard Worker<col width="25%" /> 303*2d543d20SAndroid Build Coastguard Worker<col width="75%" /> 304*2d543d20SAndroid Build Coastguard Worker</colgroup> 305*2d543d20SAndroid Build Coastguard Worker<tbody> 306*2d543d20SAndroid Build Coastguard Worker<tr class="odd"> 307*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>in</code></p></td> 308*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>The <code>in</code> keyword.</p></td> 309*2d543d20SAndroid Build Coastguard Worker</tr> 310*2d543d20SAndroid Build Coastguard Worker<tr class="even"> 311*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>before|after</code></p></td> 312*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>An optional value that specifies whether to process the [`in`](cil_container_statements.md#in) <code>before</code> or <code>after</code> block inheritance. If no value is specified, then the [`in`](cil_container_statements.md#in) will be processed before block inheritance.</p></td> 313*2d543d20SAndroid Build Coastguard Worker</tr> 314*2d543d20SAndroid Build Coastguard Worker<tr class="odd"> 315*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>container_id</code></p></td> 316*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>A valid <code>block</code>, <code>optional</code> or <code>macro</code> namespace identifier.</p></td> 317*2d543d20SAndroid Build Coastguard Worker</tr> 318*2d543d20SAndroid Build Coastguard Worker<tr class="even"> 319*2d543d20SAndroid Build Coastguard Worker<td align="left"><p><code>cil_statement</code></p></td> 320*2d543d20SAndroid Build Coastguard Worker<td align="left"><p>Zero or more valid CIL statements.</p></td> 321*2d543d20SAndroid Build Coastguard Worker</tr> 322*2d543d20SAndroid Build Coastguard Worker</tbody> 323*2d543d20SAndroid Build Coastguard Worker</table> 324*2d543d20SAndroid Build Coastguard Worker 325*2d543d20SAndroid Build Coastguard Worker**Example:** 326*2d543d20SAndroid Build Coastguard Worker 327*2d543d20SAndroid Build Coastguard WorkerThis will add rules to the container named `system_server`: 328*2d543d20SAndroid Build Coastguard Worker 329*2d543d20SAndroid Build Coastguard Worker```secil 330*2d543d20SAndroid Build Coastguard Worker (in system_server 331*2d543d20SAndroid Build Coastguard Worker (dontaudit process secmark_demo.dns_packet (packet (send recv))) 332*2d543d20SAndroid Build Coastguard Worker (allow process secmark_demo.dns_packet (packet (send recv))) 333*2d543d20SAndroid Build Coastguard Worker ) 334*2d543d20SAndroid Build Coastguard Worker``` 335