secilc/docs: use fenced code blocks for cil examples
Also fixes the occasional missing brackets as higlighted by my editor, however the individual examples where not reviewed much closer. secilc was chosen as language name because the compiler is named secilc and outside of SELinux the name cil is less searchable and could lead to confusion. Signed-off-by: Jonathan Hettwer <j2468h@gmail.com>
This commit is contained in:
parent
32f8ed3d6b
commit
057d72af2d
20 changed files with 439 additions and 12 deletions
|
@ -51,7 +51,7 @@ $(TMPDIR)/%.md: %.md | $(TMPDIR)
|
||||||
$(TMPDIR)/policy.cil: $(TESTDIR)/policy.cil
|
$(TMPDIR)/policy.cil: $(TESTDIR)/policy.cil
|
||||||
cp -f $< $@
|
cp -f $< $@
|
||||||
@# add a title for the TOC to policy.cil. This is needed to play nicely with the PDF conversion.
|
@# add a title for the TOC to policy.cil. This is needed to play nicely with the PDF conversion.
|
||||||
$(SED) -i '1i Example Policy\n=========\n```' $@
|
$(SED) -i '1i Example Policy\n=========\n```secil' $@
|
||||||
echo '```' >> $@
|
echo '```' >> $@
|
||||||
|
|
||||||
html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil
|
html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil
|
||||||
|
|
|
@ -8,7 +8,9 @@ Specifies the access allowed between a source and target type. Note that access
|
||||||
|
|
||||||
**Rule definition:**
|
**Rule definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(allow source_id target_id|self classpermissionset_id ...)
|
(allow source_id target_id|self classpermissionset_id ...)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -42,6 +44,7 @@ Specifies the access allowed between a source and target type. Note that access
|
||||||
|
|
||||||
These examples show a selection of possible permutations of [`allow`](cil_access_vector_rules.md#allow) rules:
|
These examples show a selection of possible permutations of [`allow`](cil_access_vector_rules.md#allow) rules:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class binder (impersonate call set_context_mgr transfer receive))
|
(class binder (impersonate call set_context_mgr transfer receive))
|
||||||
(class property_service (set))
|
(class property_service (set))
|
||||||
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
|
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
|
||||||
|
@ -84,6 +87,7 @@ These examples show a selection of possible permutations of [`allow`](cil_access
|
||||||
(allow type_5 type_5 (property_service (set)))
|
(allow type_5 type_5 (property_service (set)))
|
||||||
(allow type_1 all_types (property_service (set)))
|
(allow type_1 all_types (property_service (set)))
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
auditallow
|
auditallow
|
||||||
----------
|
----------
|
||||||
|
@ -92,7 +96,9 @@ Audit the access rights defined if there is a valid allow rule. Note: It does NO
|
||||||
|
|
||||||
**Rule definition:**
|
**Rule definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(auditallow source_id target_id|self classpermissionset_id ...)
|
(auditallow source_id target_id|self classpermissionset_id ...)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -126,10 +132,11 @@ Audit the access rights defined if there is a valid allow rule. Note: It does NO
|
||||||
|
|
||||||
This example will log an audit event whenever the corresponding [`allow`](cil_access_vector_rules.md#allow) rule grants access to the specified permissions:
|
This example will log an audit event whenever the corresponding [`allow`](cil_access_vector_rules.md#allow) rule grants access to the specified permissions:
|
||||||
|
|
||||||
|
```secil
|
||||||
(allow release_app.process secmark_demo.browser_packet (packet (send recv append bind)))
|
(allow release_app.process secmark_demo.browser_packet (packet (send recv append bind)))
|
||||||
|
|
||||||
(auditallow release_app.process secmark_demo.browser_packet (packet (send recv)))
|
(auditallow release_app.process secmark_demo.browser_packet (packet (send recv)))
|
||||||
|
```
|
||||||
|
|
||||||
dontaudit
|
dontaudit
|
||||||
---------
|
---------
|
||||||
|
@ -140,7 +147,9 @@ Note that these rules can be omitted by the CIL compiler command line parameter
|
||||||
|
|
||||||
**Rule definition:**
|
**Rule definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(dontaudit source_id target_id|self classpermissionset_id ...)
|
(dontaudit source_id target_id|self classpermissionset_id ...)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -174,7 +183,9 @@ Note that these rules can be omitted by the CIL compiler command line parameter
|
||||||
|
|
||||||
This example will not audit the denied access:
|
This example will not audit the denied access:
|
||||||
|
|
||||||
|
```secil
|
||||||
(dontaudit zygote.process self (capability (fsetid)))
|
(dontaudit zygote.process self (capability (fsetid)))
|
||||||
|
```
|
||||||
|
|
||||||
neverallow
|
neverallow
|
||||||
----------
|
----------
|
||||||
|
@ -185,7 +196,9 @@ Note that these rules can be over-ridden by the CIL compiler command line parame
|
||||||
|
|
||||||
**Rule definition:**
|
**Rule definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(neverallow source_id target_id|self classpermissionset_id ...)
|
(neverallow source_id target_id|self classpermissionset_id ...)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -219,6 +232,7 @@ Note that these rules can be over-ridden by the CIL compiler command line parame
|
||||||
|
|
||||||
This example will not compile as `type_3` is not allowed to be a source type for the [`allow`](cil_access_vector_rules.md#allow) rule:
|
This example will not compile as `type_3` is not allowed to be a source type for the [`allow`](cil_access_vector_rules.md#allow) rule:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class property_service (set))
|
(class property_service (set))
|
||||||
|
|
||||||
(block av_rules
|
(block av_rules
|
||||||
|
@ -232,6 +246,7 @@ This example will not compile as `type_3` is not allowed to be a source type for
|
||||||
; This rule will fail compilation:
|
; This rule will fail compilation:
|
||||||
(allow type_3 self (property_service (set)))
|
(allow type_3 self (property_service (set)))
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
allowx
|
allowx
|
||||||
------
|
------
|
||||||
|
@ -242,7 +257,9 @@ Note that for this to work there must *also* be valid equivalent [`allow`](cil_a
|
||||||
|
|
||||||
**Rule definition:**
|
**Rule definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(allowx source_id target_id|self permissionx_id)
|
(allowx source_id target_id|self permissionx_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -276,12 +293,14 @@ Note that for this to work there must *also* be valid equivalent [`allow`](cil_a
|
||||||
|
|
||||||
These examples show a selection of possible permutations of [`allowx`](cil_access_vector_rules.md#allowx) rules:
|
These examples show a selection of possible permutations of [`allowx`](cil_access_vector_rules.md#allowx) rules:
|
||||||
|
|
||||||
|
```secil
|
||||||
(allow type_1 type_2 (tcp_socket (ioctl))) ;; pre-requisite
|
(allow type_1 type_2 (tcp_socket (ioctl))) ;; pre-requisite
|
||||||
(allowx type_1 type_2 (ioctl tcp_socket (range 0x2000 0x20FF)))
|
(allowx type_1 type_2 (ioctl tcp_socket (range 0x2000 0x20FF)))
|
||||||
|
|
||||||
(permissionx ioctl_nodebug (ioctl udp_socket (not (range 0x4000 0x4010))))
|
(permissionx ioctl_nodebug (ioctl udp_socket (not (range 0x4000 0x4010))))
|
||||||
(allow type_3 type_4 (udp_socket (ioctl))) ;; pre-requisite
|
(allow type_3 type_4 (udp_socket (ioctl))) ;; pre-requisite
|
||||||
(allowx type_3 type_4 ioctl_nodebug)
|
(allowx type_3 type_4 ioctl_nodebug)
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
auditallowx
|
auditallowx
|
||||||
|
@ -293,7 +312,9 @@ Note that for this to work there must *also* be valid equivalent [`auditallow`](
|
||||||
|
|
||||||
**Rule definition:**
|
**Rule definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(auditallowx source_id target_id|self permissionx_id)
|
(auditallowx source_id target_id|self permissionx_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -327,11 +348,12 @@ Note that for this to work there must *also* be valid equivalent [`auditallow`](
|
||||||
|
|
||||||
This example will log an audit event whenever the corresponding [`allowx`](cil_access_vector_rules.md#allowx) rule grants access to the specified extended permissions:
|
This example will log an audit event whenever the corresponding [`allowx`](cil_access_vector_rules.md#allowx) rule grants access to the specified extended permissions:
|
||||||
|
|
||||||
|
```secil
|
||||||
(allowx type_1 type_2 (ioctl tcp_socket (range 0x2000 0x20FF)))
|
(allowx type_1 type_2 (ioctl tcp_socket (range 0x2000 0x20FF)))
|
||||||
|
|
||||||
(auditallow type_1 type_2 (tcp_socket (ioctl))) ;; pre-requisite
|
(auditallow type_1 type_2 (tcp_socket (ioctl))) ;; pre-requisite
|
||||||
(auditallowx type_1 type_2 (ioctl tcp_socket (range 0x2005 0x2010)))
|
(auditallowx type_1 type_2 (ioctl tcp_socket (range 0x2005 0x2010)))
|
||||||
|
```
|
||||||
|
|
||||||
dontauditx
|
dontauditx
|
||||||
----------
|
----------
|
||||||
|
@ -344,7 +366,9 @@ Note that these rules can be omitted by the CIL compiler command line parameter
|
||||||
|
|
||||||
**Rule definition:**
|
**Rule definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(dontauditx source_id target_id|self permissionx_id)
|
(dontauditx source_id target_id|self permissionx_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -378,9 +402,10 @@ Note that these rules can be omitted by the CIL compiler command line parameter
|
||||||
|
|
||||||
This example will not audit the denied access:
|
This example will not audit the denied access:
|
||||||
|
|
||||||
|
```secil
|
||||||
(allowx type_1 type_2 (ioctl tcp_socket (0x1))) ;; pre-requisite, just some irrelevant random ioctl
|
(allowx type_1 type_2 (ioctl tcp_socket (0x1))) ;; pre-requisite, just some irrelevant random ioctl
|
||||||
(dontauditx type_1 type_2 (ioctl tcp_socket (range 0x3000 0x30FF)))
|
(dontauditx type_1 type_2 (ioctl tcp_socket (range 0x3000 0x30FF)))
|
||||||
|
```
|
||||||
|
|
||||||
neverallowx
|
neverallowx
|
||||||
----------
|
----------
|
||||||
|
@ -390,7 +415,9 @@ Note that these rules can be over-ridden by the CIL compiler command line parame
|
||||||
|
|
||||||
**Rule definition:**
|
**Rule definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(neverallowx source_id target_id|self permissionx_id)
|
(neverallowx source_id target_id|self permissionx_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -424,6 +451,7 @@ Note that these rules can be over-ridden by the CIL compiler command line parame
|
||||||
|
|
||||||
This example will not compile as `type_3` is not allowed to be a source type and ioctl range for the [`allowx`](cil_access_vector_rules.md#allowx) rule:
|
This example will not compile as `type_3` is not allowed to be a source type and ioctl range for the [`allowx`](cil_access_vector_rules.md#allowx) rule:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class property_service (ioctl))
|
(class property_service (ioctl))
|
||||||
(block av_rules
|
(block av_rules
|
||||||
(type type_1)
|
(type type_1)
|
||||||
|
@ -435,3 +463,4 @@ This example will not compile as `type_3` is not allowed to be a source type and
|
||||||
; This rule will fail compilation:
|
; This rule will fail compilation:
|
||||||
(allowx type_3 self (ioctl property_service (0x20A0)))
|
(allowx type_3 self (ioctl property_service (0x20A0)))
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
|
@ -10,7 +10,9 @@ Each parameter passed contains an argument to be resolved by the [macro](#macro)
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(call macro_id [(param ...)])
|
(call macro_id [(param ...)])
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -58,10 +60,12 @@ When resolving macros the following places are checked in this order:
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(macro macro_id ([(param_type param_id) ...])
|
(macro macro_id ([(param_type param_id) ...])
|
||||||
cil_statements
|
cil_statements
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -99,6 +103,7 @@ When resolving macros the following places are checked in this order:
|
||||||
|
|
||||||
This example will instantiate the `binder_call` macro in the calling namespace (`my_domain`) and replace `ARG1` with `appdomain` and `ARG2` with `binderservicedomain`:
|
This example will instantiate the `binder_call` macro in the calling namespace (`my_domain`) and replace `ARG1` with `appdomain` and `ARG2` with `binderservicedomain`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block my_domain
|
(block my_domain
|
||||||
(call binder_call (appdomain binderservicedomain))
|
(call binder_call (appdomain binderservicedomain))
|
||||||
)
|
)
|
||||||
|
@ -108,9 +113,11 @@ This example will instantiate the `binder_call` macro in the calling namespace (
|
||||||
(allow ARG2 ARG1 (binder (transfer)))
|
(allow ARG2 ARG1 (binder (transfer)))
|
||||||
(allow ARG1 ARG2 (fd (use)))
|
(allow ARG1 ARG2 (fd (use)))
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
This example does not pass any parameters to the macro but adds a [`type`](cil_type_statements.md#type) identifier to the current namespace:
|
This example does not pass any parameters to the macro but adds a [`type`](cil_type_statements.md#type) identifier to the current namespace:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block unconfined
|
(block unconfined
|
||||||
(call add_type)
|
(call add_type)
|
||||||
....
|
....
|
||||||
|
@ -119,14 +126,17 @@ This example does not pass any parameters to the macro but adds a [`type`](cil_t
|
||||||
(type exec)
|
(type exec)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
This example passes an anonymous and named IP address to the macro:
|
This example passes an anonymous and named IP address to the macro:
|
||||||
|
|
||||||
|
```secil
|
||||||
(ipaddr netmask_1 255.255.255.0)
|
(ipaddr netmask_1 255.255.255.0)
|
||||||
(context netlabel_1 (system.user object_r unconfined.object low_low)
|
(context netlabel_1 (system.user object_r unconfined.object low_low))
|
||||||
|
|
||||||
(call build_nodecon ((192.168.1.64) netmask_1))
|
(call build_nodecon ((192.168.1.64) netmask_1))
|
||||||
|
|
||||||
(macro build_nodecon ((ipaddr ARG1) (ipaddr ARG2))
|
(macro build_nodecon ((ipaddr ARG1) (ipaddr ARG2))
|
||||||
(nodecon ARG1 ARG2 netlabel_1)
|
(nodecon ARG1 ARG2 netlabel_1)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
|
@ -8,7 +8,9 @@ Declares a common identifier in the current namespace with a set of common permi
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(common common_id (permission_id ...))
|
(common common_id (permission_id ...))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -37,7 +39,9 @@ Declares a common identifier in the current namespace with a set of common permi
|
||||||
|
|
||||||
This common statement will associate the [`common`](cil_class_and_permission_statements.md#common) identifier '`file`' with the list of permissions:
|
This common statement will associate the [`common`](cil_class_and_permission_statements.md#common) identifier '`file`' with the list of permissions:
|
||||||
|
|
||||||
|
```secil
|
||||||
(common file (ioctl read write create getattr setattr lock relabelfrom relabelto append unlink link rename execute swapon quotaon mounton))
|
(common file (ioctl read write create getattr setattr lock relabelfrom relabelto append unlink link rename execute swapon quotaon mounton))
|
||||||
|
```
|
||||||
|
|
||||||
classcommon
|
classcommon
|
||||||
-----------
|
-----------
|
||||||
|
@ -46,7 +50,9 @@ Associate a [`class`](cil_class_and_permission_statements.md#class) identifier t
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(classcommon class_id common_id)
|
(classcommon class_id common_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -75,9 +81,11 @@ Associate a [`class`](cil_class_and_permission_statements.md#class) identifier t
|
||||||
|
|
||||||
This associates the `dir` class with the list of permissions declared by the `file common` identifier:
|
This associates the `dir` class with the list of permissions declared by the `file common` identifier:
|
||||||
|
|
||||||
|
```secil
|
||||||
(common file (ioctl read write create getattr setattr lock relabelfrom relabelto append unlink link rename execute swapon quotaon mounton))
|
(common file (ioctl read write create getattr setattr lock relabelfrom relabelto append unlink link rename execute swapon quotaon mounton))
|
||||||
|
|
||||||
(classcommon dir file)
|
(classcommon dir file)
|
||||||
|
```
|
||||||
|
|
||||||
class
|
class
|
||||||
-----
|
-----
|
||||||
|
@ -86,7 +94,9 @@ Declares a class and zero or more permissions in the current namespace.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(class class_id (permission_id ...))
|
(class class_id (permission_id ...))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -115,29 +125,39 @@ Declares a class and zero or more permissions in the current namespace.
|
||||||
|
|
||||||
This example defines a set of permissions for the `binder` class identifier:
|
This example defines a set of permissions for the `binder` class identifier:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class binder (impersonate call set_context_mgr transfer receive))
|
(class binder (impersonate call set_context_mgr transfer receive))
|
||||||
|
```
|
||||||
|
|
||||||
This example defines a common set of permissions to be used by the `sem` class, the `(class sem ())` does not define any other permissions (i.e. an empty list):
|
This example defines a common set of permissions to be used by the `sem` class, the `(class sem ())` does not define any other permissions (i.e. an empty list):
|
||||||
|
|
||||||
|
```secil
|
||||||
(common ipc (create destroy getattr setattr read write associate unix_read unix_write))
|
(common ipc (create destroy getattr setattr read write associate unix_read unix_write))
|
||||||
|
|
||||||
(classcommon sem ipc)
|
(classcommon sem ipc)
|
||||||
(class sem ())
|
(class sem ())
|
||||||
|
```
|
||||||
|
|
||||||
and will produce the following set of permissions for the `sem` class identifier of:
|
and will produce the following set of permissions for the `sem` class identifier of:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class sem (create destroy getattr setattr read write associate unix_read unix_write))
|
(class sem (create destroy getattr setattr read write associate unix_read unix_write))
|
||||||
|
```
|
||||||
|
|
||||||
This example, with the following combination of the [`common`](cil_class_and_permission_statements.md#common), [`classcommon`](cil_class_and_permission_statements.md#classcommon) and [`class`](cil_class_and_permission_statements.md#class) statements:
|
This example, with the following combination of the [`common`](cil_class_and_permission_statements.md#common), [`classcommon`](cil_class_and_permission_statements.md#classcommon) and [`class`](cil_class_and_permission_statements.md#class) statements:
|
||||||
|
|
||||||
|
```secil
|
||||||
(common file (ioctl read write create getattr setattr lock relabelfrom relabelto append unlink link rename execute swapon quotaon mounton))
|
(common file (ioctl read write create getattr setattr lock relabelfrom relabelto append unlink link rename execute swapon quotaon mounton))
|
||||||
|
|
||||||
(classcommon dir file)
|
(classcommon dir file)
|
||||||
(class dir (add_name remove_name reparent search rmdir open audit_access execmod))
|
(class dir (add_name remove_name reparent search rmdir open audit_access execmod))
|
||||||
|
```
|
||||||
|
|
||||||
will produce a set of permissions for the `dir` class identifier of:
|
will produce a set of permissions for the `dir` class identifier of:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class dir (add_name remove_name reparent search rmdir open audit_access execmod ioctl read write create getattr setattr lock relabelfrom relabelto append unlink link rename execute swapon quotaon mounton))
|
(class dir (add_name remove_name reparent search rmdir open audit_access execmod ioctl read write create getattr setattr lock relabelfrom relabelto append unlink link rename execute swapon quotaon mounton))
|
||||||
|
```
|
||||||
|
|
||||||
classorder
|
classorder
|
||||||
----------
|
----------
|
||||||
|
@ -146,7 +166,9 @@ Defines the order of [class](#class)'s. This is a mandatory statement. Multiple
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(classorder (class_id ...))
|
(classorder (class_id ...))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -171,11 +193,13 @@ Defines the order of [class](#class)'s. This is a mandatory statement. Multiple
|
||||||
|
|
||||||
This will produce an ordered list of "`file dir process`"
|
This will produce an ordered list of "`file dir process`"
|
||||||
|
|
||||||
|
```secil
|
||||||
(class process)
|
(class process)
|
||||||
(class file)
|
(class file)
|
||||||
(class dir)
|
(class dir)
|
||||||
(classorder (file dir))
|
(classorder (file dir))
|
||||||
(classorder (dir process))
|
(classorder (dir process))
|
||||||
|
```
|
||||||
|
|
||||||
**Unordered Classorder Statement:**
|
**Unordered Classorder Statement:**
|
||||||
|
|
||||||
|
@ -185,6 +209,7 @@ If users do not have knowledge of the existing [`classorder`](#classorder), the
|
||||||
|
|
||||||
This will produce an unordered list of "`file dir foo a bar baz`"
|
This will produce an unordered list of "`file dir foo a bar baz`"
|
||||||
|
|
||||||
|
```secil
|
||||||
(class file)
|
(class file)
|
||||||
(class dir)
|
(class dir)
|
||||||
(class foo)
|
(class foo)
|
||||||
|
@ -195,6 +220,7 @@ This will produce an unordered list of "`file dir foo a bar baz`"
|
||||||
(classorder (dir foo))
|
(classorder (dir foo))
|
||||||
(classorder (unordered a))
|
(classorder (unordered a))
|
||||||
(classorder (unordered bar foo baz))
|
(classorder (unordered bar foo baz))
|
||||||
|
```
|
||||||
|
|
||||||
classpermission
|
classpermission
|
||||||
---------------
|
---------------
|
||||||
|
@ -203,7 +229,9 @@ Declares a class permission set identifier in the current namespace that can be
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(classpermission classpermissionset_id)
|
(classpermission classpermissionset_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -235,7 +263,9 @@ Defines a class permission set identifier in the current namespace that associat
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(classpermissionset classpermissionset_id (class_id (permission_id | expr ...)))
|
(classpermissionset classpermissionset_id (class_id (permission_id | expr ...)))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -278,6 +308,7 @@ Defines a class permission set identifier in the current namespace that associat
|
||||||
|
|
||||||
These class permission set statements will resolve to the permission sets shown in the kernel policy language [`allow`](cil_access_vector_rules.md#allow) rules:
|
These class permission set statements will resolve to the permission sets shown in the kernel policy language [`allow`](cil_access_vector_rules.md#allow) rules:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
|
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
|
||||||
|
|
||||||
(type test_1)
|
(type test_1)
|
||||||
|
@ -322,6 +353,7 @@ These class permission set statements will resolve to the permission sets shown
|
||||||
(classpermissionset zygote_all_perms (zygote (all)))
|
(classpermissionset zygote_all_perms (zygote (all)))
|
||||||
(allow unconfined.process test_5 zygote_all_perms)
|
(allow unconfined.process test_5 zygote_all_perms)
|
||||||
;; allow unconfined.process test_5 : zygote { specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo } ;
|
;; allow unconfined.process test_5 : zygote { specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo } ;
|
||||||
|
```
|
||||||
|
|
||||||
classmap
|
classmap
|
||||||
--------
|
--------
|
||||||
|
@ -346,7 +378,9 @@ Declares a class map identifier in the current namespace and one or more class m
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(classmap classmap_id (classmapping_id ...))
|
(classmap classmap_id (classmapping_id ...))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -382,7 +416,9 @@ Define sets of [`classpermissionset`](cil_class_and_permission_statements.md#cla
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(classmapping classmap_id classmapping_id classpermissionset_id)
|
(classmapping classmap_id classmapping_id classpermissionset_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -415,6 +451,7 @@ Define sets of [`classpermissionset`](cil_class_and_permission_statements.md#cla
|
||||||
|
|
||||||
These class mapping statements will resolve to the permission sets shown in the kernel policy language [`allow`](cil_access_vector_rules.md#allow) rules:
|
These class mapping statements will resolve to the permission sets shown in the kernel policy language [`allow`](cil_access_vector_rules.md#allow) rules:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class binder (impersonate call set_context_mgr transfer receive))
|
(class binder (impersonate call set_context_mgr transfer receive))
|
||||||
(class property_service (set))
|
(class property_service (set))
|
||||||
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
|
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
|
||||||
|
@ -454,6 +491,7 @@ These class mapping statements will resolve to the permission sets shown in the
|
||||||
|
|
||||||
;; allow map_example.type_3 map_example.type_3 : binder { impersonate call set_context_mgr } ;
|
;; allow map_example.type_3 map_example.type_3 : binder { impersonate call set_context_mgr } ;
|
||||||
;; allow map_example.type_3 map_example.type_3 : zygote { specifyrlimits specifycapabilities specifyinvokewith specifyseinfo } ;
|
;; allow map_example.type_3 map_example.type_3 : zygote { specifyrlimits specifycapabilities specifyinvokewith specifyseinfo } ;
|
||||||
|
```
|
||||||
|
|
||||||
permissionx
|
permissionx
|
||||||
-----------
|
-----------
|
||||||
|
@ -462,7 +500,9 @@ Defines a named extended permission, which can be used in the [`allowx`](cil_acc
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(permissionx permissionx_id (kind class_id (permission ... | expr ...)))
|
(permissionx permissionx_id (kind class_id (permission ... | expr ...)))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -517,6 +557,8 @@ Defines a named extended permission, which can be used in the [`allowx`](cil_acc
|
||||||
|
|
||||||
**Examples:**
|
**Examples:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(permissionx ioctl_1 (ioctl tcp_socket (0x2000 0x3000 0x4000)))
|
(permissionx ioctl_1 (ioctl tcp_socket (0x2000 0x3000 0x4000)))
|
||||||
(permissionx ioctl_2 (ioctl tcp_socket (range 0x6000 0x60FF)))
|
(permissionx ioctl_2 (ioctl tcp_socket (range 0x6000 0x60FF)))
|
||||||
(permissionx ioctl_3 (ioctl tcp_socket (and (range 0x8000 0x90FF) (not (range 0x8100 0x82FF)))))
|
(permissionx ioctl_3 (ioctl tcp_socket (and (range 0x8000 0x90FF) (not (range 0x8100 0x82FF)))))
|
||||||
|
```
|
||||||
|
|
|
@ -8,7 +8,9 @@ Declares a run time boolean as true or false in the current namespace. The [`boo
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(boolean boolean_id true|false)
|
(boolean boolean_id true|false)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -46,7 +48,8 @@ Contains the run time conditional statements that are instantiated in the binary
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
(booleanif boolean_id | expr ...)
|
```secil
|
||||||
|
(booleanif boolean_id | expr ...
|
||||||
(true
|
(true
|
||||||
cil_statements
|
cil_statements
|
||||||
...)
|
...)
|
||||||
|
@ -54,6 +57,7 @@ Contains the run time conditional statements that are instantiated in the binary
|
||||||
cil_statements
|
cil_statements
|
||||||
...)
|
...)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -96,6 +100,7 @@ Contains the run time conditional statements that are instantiated in the binary
|
||||||
|
|
||||||
The second example also shows the kernel policy language equivalent:
|
The second example also shows the kernel policy language equivalent:
|
||||||
|
|
||||||
|
```secil
|
||||||
(boolean disableAudio false)
|
(boolean disableAudio false)
|
||||||
|
|
||||||
(booleanif disableAudio
|
(booleanif disableAudio
|
||||||
|
@ -112,6 +117,7 @@ The second example also shows the kernel policy language equivalent:
|
||||||
(allow process mediaserver.audio_capture_device (chr_file_set (rw_file_perms)))
|
(allow process mediaserver.audio_capture_device (chr_file_set (rw_file_perms)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
tunable
|
tunable
|
||||||
-------
|
-------
|
||||||
|
@ -122,7 +128,9 @@ Note that tunables can be treated as booleans by the CIL compiler command line p
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(tunable tunable_id true|false)
|
(tunable tunable_id true|false)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -158,7 +166,8 @@ Compile time conditional statement that may or may not add CIL statements to be
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
(tunableif tunable_id | expr ...)
|
```secil
|
||||||
|
(tunableif tunable_id | expr ...
|
||||||
(true
|
(true
|
||||||
cil_statements
|
cil_statements
|
||||||
...)
|
...)
|
||||||
|
@ -166,6 +175,7 @@ Compile time conditional statement that may or may not add CIL statements to be
|
||||||
cil_statements
|
cil_statements
|
||||||
...)
|
...)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -208,6 +218,7 @@ Compile time conditional statement that may or may not add CIL statements to be
|
||||||
|
|
||||||
This example will not add the range transition rule to the binary policy:
|
This example will not add the range transition rule to the binary policy:
|
||||||
|
|
||||||
|
```secil
|
||||||
(tunable range_trans_rule false)
|
(tunable range_trans_rule false)
|
||||||
|
|
||||||
(block init
|
(block init
|
||||||
|
@ -220,3 +231,4 @@ This example will not add the range transition rule to the binary policy:
|
||||||
)
|
)
|
||||||
) ; End tunableif
|
) ; End tunableif
|
||||||
) ; End block
|
) ; End block
|
||||||
|
```
|
||||||
|
|
|
@ -8,7 +8,9 @@ Enable constraints to be placed on the specified permissions of the object class
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(constrain classpermissionset_id ... expression | expr ...)
|
(constrain classpermissionset_id ... expression | expr ...)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -62,6 +64,7 @@ Enable constraints to be placed on the specified permissions of the object class
|
||||||
|
|
||||||
Two constrain statements are shown with their equivalent kernel policy language statements:
|
Two constrain statements are shown with their equivalent kernel policy language statements:
|
||||||
|
|
||||||
|
```secil
|
||||||
;; constrain { file } { write }
|
;; constrain { file } { write }
|
||||||
;; (( t1 == unconfined.process ) and ( t2 == unconfined.object ) or ( r1 eq r2 ));
|
;; (( t1 == unconfined.process ) and ( t2 == unconfined.object ) or ( r1 eq r2 ));
|
||||||
(constrain (file (write))
|
(constrain (file (write))
|
||||||
|
@ -87,6 +90,7 @@ Two constrain statements are shown with their equivalent kernel policy language
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
validatetrans
|
validatetrans
|
||||||
-------------
|
-------------
|
||||||
|
@ -95,7 +99,9 @@ The [`validatetrans`](cil_constraint_statements.md#validatetrans) statement is o
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(validatetrans class_id expression | expr ...)
|
(validatetrans class_id expression | expr ...)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -153,9 +159,11 @@ The [`validatetrans`](cil_constraint_statements.md#validatetrans) statement is o
|
||||||
|
|
||||||
A validate transition statement with the equivalent kernel policy language statement:
|
A validate transition statement with the equivalent kernel policy language statement:
|
||||||
|
|
||||||
|
```secil
|
||||||
; validatetrans { file } ( t1 == unconfined.process );
|
; validatetrans { file } ( t1 == unconfined.process );
|
||||||
|
|
||||||
(validatetrans file (eq t1 unconfined.process))
|
(validatetrans file (eq t1 unconfined.process))
|
||||||
|
```
|
||||||
|
|
||||||
mlsconstrain
|
mlsconstrain
|
||||||
------------
|
------------
|
||||||
|
@ -164,7 +172,9 @@ Enable MLS constraints to be placed on the specified permissions of the object c
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(mlsconstrain classpermissionset_id ... expression | expr ...)
|
(mlsconstrain classpermissionset_id ... expression | expr ...)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -224,6 +234,7 @@ Enable MLS constraints to be placed on the specified permissions of the object c
|
||||||
|
|
||||||
An MLS constrain statement with the equivalent kernel policy language statement:
|
An MLS constrain statement with the equivalent kernel policy language statement:
|
||||||
|
|
||||||
|
```secil
|
||||||
;; mlsconstrain { file } { open }
|
;; mlsconstrain { file } { open }
|
||||||
;; (( l1 eq l2 ) and ( u1 == u2 ) or ( r1 != r2 ));
|
;; (( l1 eq l2 ) and ( u1 == u2 ) or ( r1 != r2 ));
|
||||||
|
|
||||||
|
@ -236,6 +247,7 @@ An MLS constrain statement with the equivalent kernel policy language statement:
|
||||||
(neq r1 r2)
|
(neq r1 r2)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
mlsvalidatetrans
|
mlsvalidatetrans
|
||||||
----------------
|
----------------
|
||||||
|
@ -244,7 +256,9 @@ The [`mlsvalidatetrans`](cil_constraint_statements.md#mlsvalidatetrans) statemen
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(mlsvalidatetrans class_id expression | expr ...)
|
(mlsvalidatetrans class_id expression | expr ...)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -308,6 +322,8 @@ The [`mlsvalidatetrans`](cil_constraint_statements.md#mlsvalidatetrans) statemen
|
||||||
|
|
||||||
An MLS validate transition statement with the equivalent kernel policy language statement:
|
An MLS validate transition statement with the equivalent kernel policy language statement:
|
||||||
|
|
||||||
|
```secil
|
||||||
;; mlsvalidatetrans { file } ( l1 domby h2 );
|
;; mlsvalidatetrans { file } ( l1 domby h2 );
|
||||||
|
|
||||||
(mlsvalidatetrans file (domby l1 h2))
|
(mlsvalidatetrans file (domby l1 h2))
|
||||||
|
```
|
||||||
|
|
|
@ -8,10 +8,12 @@ Start a new namespace where any CIL statement is valid.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(block block_id
|
(block block_id
|
||||||
cil_statement
|
cil_statement
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -47,11 +49,13 @@ Declares the namespace as a 'template' and does not generate code until instanti
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(block block_id
|
(block block_id
|
||||||
(blockabstract template_id)
|
(blockabstract template_id)
|
||||||
cil_statement
|
cil_statement
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -95,11 +99,13 @@ Used to add common policy rules to the current namespace via a template that has
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(block block_id
|
(block block_id
|
||||||
(blockinherit template_id)
|
(blockinherit template_id)
|
||||||
cil_statement
|
cil_statement
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -136,6 +142,7 @@ Used to add common policy rules to the current namespace via a template that has
|
||||||
|
|
||||||
This example contains a template `client_server` that is instantiated in two blocks (`netserver_app` and `netclient_app`):
|
This example contains a template `client_server` that is instantiated in two blocks (`netserver_app` and `netclient_app`):
|
||||||
|
|
||||||
|
```secil
|
||||||
; This is the template block:
|
; This is the template block:
|
||||||
(block client_server
|
(block client_server
|
||||||
(blockabstract client_server)
|
(blockabstract client_server)
|
||||||
|
@ -187,6 +194,7 @@ This example contains a template `client_server` that is instantiated in two blo
|
||||||
(block ab
|
(block ab
|
||||||
(blockinherit b)
|
(blockinherit b)
|
||||||
(blockinherit a))
|
(blockinherit a))
|
||||||
|
```
|
||||||
|
|
||||||
optional
|
optional
|
||||||
--------
|
--------
|
||||||
|
@ -203,10 +211,12 @@ Declare an [`optional`](cil_container_statements.md#optional) namespace. All CIL
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(optional optional_id
|
(optional optional_id
|
||||||
cil_statement
|
cil_statement
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -235,6 +245,7 @@ Declare an [`optional`](cil_container_statements.md#optional) namespace. All CIL
|
||||||
|
|
||||||
This example will instantiate the optional block `ext_gateway.move_file` into policy providing all optional CIL statements can be resolved:
|
This example will instantiate the optional block `ext_gateway.move_file` into policy providing all optional CIL statements can be resolved:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block ext_gateway
|
(block ext_gateway
|
||||||
......
|
......
|
||||||
(optional move_file
|
(optional move_file
|
||||||
|
@ -250,6 +261,7 @@ This example will instantiate the optional block `ext_gateway.move_file` into po
|
||||||
|
|
||||||
.....
|
.....
|
||||||
) ; End block
|
) ; End block
|
||||||
|
```
|
||||||
|
|
||||||
in
|
in
|
||||||
--
|
--
|
||||||
|
@ -258,10 +270,12 @@ Allows the insertion of CIL statements into a named container ([`block`](cil_con
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(in container_id
|
(in container_id
|
||||||
cil_statement
|
cil_statement
|
||||||
...
|
...
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -290,7 +304,9 @@ Allows the insertion of CIL statements into a named container ([`block`](cil_con
|
||||||
|
|
||||||
This will add rules to the container named `system_server`:
|
This will add rules to the container named `system_server`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(in system_server
|
(in system_server
|
||||||
(dontaudit process secmark_demo.dns_packet (packet (send recv)))
|
(dontaudit process secmark_demo.dns_packet (packet (send recv)))
|
||||||
(allow process secmark_demo.dns_packet (packet (send recv)))
|
(allow process secmark_demo.dns_packet (packet (send recv)))
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
|
@ -16,7 +16,9 @@ Declare an SELinux security context identifier for labeling. The range (or curre
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(context context_id (user_id role_id type_id levelrange_id)))
|
(context context_id (user_id role_id type_id levelrange_id)))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -57,21 +59,29 @@ Declare an SELinux security context identifier for labeling. The range (or curre
|
||||||
|
|
||||||
This example uses a named context definition:
|
This example uses a named context definition:
|
||||||
|
|
||||||
|
```secil
|
||||||
(context runas_exec_context (u object_r exec low_low))
|
(context runas_exec_context (u object_r exec low_low))
|
||||||
|
|
||||||
(filecon "/system/bin/run-as" file runas_exec_context)
|
(filecon "/system/bin/run-as" file runas_exec_context)
|
||||||
|
```
|
||||||
|
|
||||||
to resolve/build a `file_contexts` entry of (assuming MLS enabled policy):
|
to resolve/build a `file_contexts` entry of (assuming MLS enabled policy):
|
||||||
|
|
||||||
|
```
|
||||||
/system/bin/run-as -- u:object_r:runas.exec:s0-s0
|
/system/bin/run-as -- u:object_r:runas.exec:s0-s0
|
||||||
|
```
|
||||||
|
|
||||||
This example uses an anonymous context where the previously declared `user role type levelrange` identifiers are used to specify two [`portcon`](cil_network_labeling_statements.md#portcon) statements:
|
This example uses an anonymous context where the previously declared `user role type levelrange` identifiers are used to specify two [`portcon`](cil_network_labeling_statements.md#portcon) statements:
|
||||||
|
|
||||||
|
```secil
|
||||||
(portcon udp 1024 (test.user object_r test.process ((s0) (s1))))
|
(portcon udp 1024 (test.user object_r test.process ((s0) (s1))))
|
||||||
(portcon tcp 1024 (test.user object_r test.process (system_low system_high)))
|
(portcon tcp 1024 (test.user object_r test.process (system_low system_high)))
|
||||||
|
```
|
||||||
|
|
||||||
This example uses an anonymous context for the first and named context for the second in a [`netifcon`](cil_network_labeling_statements.md#netifcon) statement:
|
This example uses an anonymous context for the first and named context for the second in a [`netifcon`](cil_network_labeling_statements.md#netifcon) statement:
|
||||||
|
|
||||||
|
```secil
|
||||||
(context netif_context (test.user object_r test.process ((s0 (c0)) (s1 (c0)))))
|
(context netif_context (test.user object_r test.process ((s0 (c0)) (s1 (c0)))))
|
||||||
|
|
||||||
(netifcon eth04 (test.user object_r test.process ((s0 (c0)) (s1 (c0)))) netif_context)
|
(netifcon eth04 (test.user object_r test.process ((s0 (c0)) (s1 (c0)))) netif_context)
|
||||||
|
```
|
||||||
|
|
|
@ -10,7 +10,9 @@ Allows the default user to be taken from the source or target context when compu
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(defaultuser class_id default)
|
(defaultuser class_id default)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -39,6 +41,7 @@ Allows the default user to be taken from the source or target context when compu
|
||||||
|
|
||||||
When creating new `binder`, `property_service`, `zygote` or `memprotect` objects the [`user`](cil_user_statements.md#user) component of the new security context will be taken from the `source` context:
|
When creating new `binder`, `property_service`, `zygote` or `memprotect` objects the [`user`](cil_user_statements.md#user) component of the new security context will be taken from the `source` context:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class binder (impersonate call set_context_mgr transfer receive))
|
(class binder (impersonate call set_context_mgr transfer receive))
|
||||||
(class property_service (set))
|
(class property_service (set))
|
||||||
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
|
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
|
||||||
|
@ -56,13 +59,16 @@ When creating new `binder`, `property_service`, `zygote` or `memprotect` objects
|
||||||
;; default_user zygote source;
|
;; default_user zygote source;
|
||||||
;; default_user property_service source;
|
;; default_user property_service source;
|
||||||
;; default_user memprotect source;
|
;; default_user memprotect source;
|
||||||
|
```
|
||||||
|
|
||||||
defaultrole
|
defaultrole
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Allows the default role to be taken from the source or target context when computing a new context for the object [`class`](cil_class_and_permission_statements.md#class) identifier. Requires policy version 27.
|
Allows the default role to be taken from the source or target context when computing a new context for the object [`class`](cil_class_and_permission_statements.md#class) identifier. Requires policy version 27.
|
||||||
|
|
||||||
|
```secil
|
||||||
(defaultrole class_id default)
|
(defaultrole class_id default)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -91,6 +97,7 @@ Allows the default role to be taken from the source or target context when compu
|
||||||
|
|
||||||
When creating new `binder`, `property_service` or `zygote` objects the [`role`](cil_role_statements.md#role) component of the new security context will be taken from the `target` context:
|
When creating new `binder`, `property_service` or `zygote` objects the [`role`](cil_role_statements.md#role) component of the new security context will be taken from the `target` context:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class binder (impersonate call set_context_mgr transfer receive))
|
(class binder (impersonate call set_context_mgr transfer receive))
|
||||||
(class property_service (set))
|
(class property_service (set))
|
||||||
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
|
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
|
||||||
|
@ -101,6 +108,7 @@ When creating new `binder`, `property_service` or `zygote` objects the [`role`](
|
||||||
;; default_role binder target;
|
;; default_role binder target;
|
||||||
;; default_role zygote target;
|
;; default_role zygote target;
|
||||||
;; default_role property_service target;
|
;; default_role property_service target;
|
||||||
|
```
|
||||||
|
|
||||||
defaulttype
|
defaulttype
|
||||||
-----------
|
-----------
|
||||||
|
@ -109,7 +117,9 @@ Allows the default type to be taken from the source or target context when compu
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(defaulttype class_id default)
|
(defaulttype class_id default)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -138,7 +148,9 @@ Allows the default type to be taken from the source or target context when compu
|
||||||
|
|
||||||
When creating a new `socket` object, the [`type`](cil_type_statements.md#type) component of the new security context will be taken from the `source` context:
|
When creating a new `socket` object, the [`type`](cil_type_statements.md#type) component of the new security context will be taken from the `source` context:
|
||||||
|
|
||||||
|
```secil
|
||||||
(defaulttype socket source)
|
(defaulttype socket source)
|
||||||
|
```
|
||||||
|
|
||||||
defaultrange
|
defaultrange
|
||||||
------------
|
------------
|
||||||
|
@ -147,7 +159,9 @@ Allows the default level or range to be taken from the source, target, or both c
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(defaultrange class_id default <range>)
|
(defaultrange class_id default <range>)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -180,8 +194,12 @@ Allows the default level or range to be taken from the source, target, or both c
|
||||||
|
|
||||||
When creating a new `file` object, the appropriate `range` component of the new security context will be taken from the `target` context:
|
When creating a new `file` object, the appropriate `range` component of the new security context will be taken from the `target` context:
|
||||||
|
|
||||||
|
```secil
|
||||||
(defaultrange file target low_high)
|
(defaultrange file target low_high)
|
||||||
|
```
|
||||||
|
|
||||||
MLS userspace object managers may need to compute the common parts of a range such that the object is created with the range common to the subject and containing object:
|
MLS userspace object managers may need to compute the common parts of a range such that the object is created with the range common to the subject and containing object:
|
||||||
|
|
||||||
|
```secil
|
||||||
(defaultrange db_table glblub)
|
(defaultrange db_table glblub)
|
||||||
|
```
|
||||||
|
|
|
@ -8,7 +8,9 @@ Define entries for labeling files. The compiler will produce these entries in a
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(filecon "path" file_type context_id)
|
(filecon "path" file_type context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -89,17 +91,21 @@ Define entries for labeling files. The compiler will produce these entries in a
|
||||||
|
|
||||||
These examples use one named, one anonymous and one empty context definition:
|
These examples use one named, one anonymous and one empty context definition:
|
||||||
|
|
||||||
|
```secil
|
||||||
(context runas_exec_context (u object_r exec low_low))
|
(context runas_exec_context (u object_r exec low_low))
|
||||||
|
|
||||||
(filecon "/system/bin/run-as" file runas_exec_context)
|
(filecon "/system/bin/run-as" file runas_exec_context)
|
||||||
(filecon "/dev/socket/wpa_wlan[0-9]" any u:object_r:wpa.socket:s0-s0)
|
(filecon "/dev/socket/wpa_wlan[0-9]" any u:object_r:wpa.socket:s0-s0)
|
||||||
(filecon "/data/local/mine" dir ())
|
(filecon "/data/local/mine" dir ())
|
||||||
|
```
|
||||||
|
|
||||||
to resolve/build `file_contexts` entries of (assuming MLS enabled policy):
|
to resolve/build `file_contexts` entries of (assuming MLS enabled policy):
|
||||||
|
|
||||||
|
```
|
||||||
/system/bin/run-as -- u:object_r:runas.exec:s0
|
/system/bin/run-as -- u:object_r:runas.exec:s0
|
||||||
/dev/socket/wpa_wlan[0-9] u:object_r:wpa.socket:s0
|
/dev/socket/wpa_wlan[0-9] u:object_r:wpa.socket:s0
|
||||||
/data/local/mine -d <<none>>
|
/data/local/mine -d <<none>>
|
||||||
|
```
|
||||||
|
|
||||||
fsuse
|
fsuse
|
||||||
-----
|
-----
|
||||||
|
@ -108,7 +114,9 @@ Label filesystems that support SELinux security contexts.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(fsuse fstype fsname context_id)
|
(fsuse fstype fsname context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -147,6 +155,7 @@ Label filesystems that support SELinux security contexts.
|
||||||
|
|
||||||
The [context](#context) identifiers are declared in the `file` namespace and the [`fsuse`](cil_file_labeling_statements.md#fsuse) statements in the global namespace:
|
The [context](#context) identifiers are declared in the `file` namespace and the [`fsuse`](cil_file_labeling_statements.md#fsuse) statements in the global namespace:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block file
|
(block file
|
||||||
(type labeledfs)
|
(type labeledfs)
|
||||||
(roletype object_r labeledfs)
|
(roletype object_r labeledfs)
|
||||||
|
@ -166,6 +175,7 @@ The [context](#context) identifiers are declared in the `file` namespace and the
|
||||||
|
|
||||||
(fsuse trans devpts file.devpts_context)
|
(fsuse trans devpts file.devpts_context)
|
||||||
(fsuse trans tmpfs file.tmpfs_context)
|
(fsuse trans tmpfs file.tmpfs_context)
|
||||||
|
```
|
||||||
|
|
||||||
genfscon
|
genfscon
|
||||||
--------
|
--------
|
||||||
|
@ -174,7 +184,9 @@ Used to allocate a security context to filesystems that cannot support any of th
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(genfscon fsname path context_id)
|
(genfscon fsname path context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -207,6 +219,7 @@ Used to allocate a security context to filesystems that cannot support any of th
|
||||||
|
|
||||||
The [context](#context) identifiers are declared in the `file` namespace and the [`genfscon`](cil_file_labeling_statements.md#genfscon) statements are then inserted using the [`in`](cil_container_statements.md#in) container statement:
|
The [context](#context) identifiers are declared in the `file` namespace and the [`genfscon`](cil_file_labeling_statements.md#genfscon) statements are then inserted using the [`in`](cil_container_statements.md#in) container statement:
|
||||||
|
|
||||||
|
```secil
|
||||||
(file
|
(file
|
||||||
(type rootfs)
|
(type rootfs)
|
||||||
(roletype object_r rootfs)
|
(roletype object_r rootfs)
|
||||||
|
@ -226,3 +239,4 @@ The [context](#context) identifiers are declared in the `file` namespace and the
|
||||||
(genfscon proc /sysrq-trigger sysrq_proc_context)
|
(genfscon proc /sysrq-trigger sysrq_proc_context)
|
||||||
(genfscon selinuxfs / selinuxfs_context)
|
(genfscon selinuxfs / selinuxfs_context)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
|
@ -10,7 +10,9 @@ Label IB partition keys. This may be a single key or a range.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(ibpkeycon subnet pkey|(pkey_low pkey_high) context_id)
|
(ibpkeycon subnet pkey|(pkey_low pkey_high) context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -43,8 +45,9 @@ Label IB partition keys. This may be a single key or a range.
|
||||||
|
|
||||||
An anonymous context for a partition key range of `0x0-0x10` assigned to an IPv6 subnet:
|
An anonymous context for a partition key range of `0x0-0x10` assigned to an IPv6 subnet:
|
||||||
|
|
||||||
|
```secil
|
||||||
(ibpkeycon fe80:: (0 0x10) (system_u system_r kernel_t (low (s3 (cats01 cats02)))))
|
(ibpkeycon fe80:: (0 0x10) (system_u system_r kernel_t (low (s3 (cats01 cats02)))))
|
||||||
|
```
|
||||||
|
|
||||||
ibendportcon
|
ibendportcon
|
||||||
------------
|
------------
|
||||||
|
@ -53,7 +56,9 @@ Label IB end ports.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(ibendportcon device_id port context_id)
|
(ibendportcon device_id port context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -86,4 +91,6 @@ Label IB end ports.
|
||||||
|
|
||||||
A named context for device `mlx5_0` on port `1`:
|
A named context for device `mlx5_0` on port `1`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(ibendportcon mlx5_0 1 system_u_bin_t_l2h)
|
(ibendportcon mlx5_0 1 system_u_bin_t_l2h)
|
||||||
|
```
|
||||||
|
|
|
@ -10,7 +10,9 @@ Declare a sensitivity identifier in the current namespace. Multiple [`sensitivit
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(sensitivity sensitivity_id)
|
(sensitivity sensitivity_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -35,9 +37,11 @@ Declare a sensitivity identifier in the current namespace. Multiple [`sensitivit
|
||||||
|
|
||||||
This example declares three [`sensitivity`](cil_mls_labeling_statements.md#sensitivity) identifiers:
|
This example declares three [`sensitivity`](cil_mls_labeling_statements.md#sensitivity) identifiers:
|
||||||
|
|
||||||
|
```secil
|
||||||
(sensitivity s0)
|
(sensitivity s0)
|
||||||
(sensitivity s1)
|
(sensitivity s1)
|
||||||
(sensitivity s2)
|
(sensitivity s2)
|
||||||
|
```
|
||||||
|
|
||||||
sensitivityalias
|
sensitivityalias
|
||||||
----------------
|
----------------
|
||||||
|
@ -46,7 +50,9 @@ Declares a sensitivity alias identifier in the current namespace. See the [`sens
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(sensitivityalias sensitivityalias_id)
|
(sensitivityalias sensitivityalias_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -78,7 +84,9 @@ Associates a previously declared [`sensitivityalias`](cil_mls_labeling_statement
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(sensitivityaliasactual sensitivityalias_id sensitivity_id)
|
(sensitivityaliasactual sensitivityalias_id sensitivity_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -107,11 +115,13 @@ Associates a previously declared [`sensitivityalias`](cil_mls_labeling_statement
|
||||||
|
|
||||||
This example will associate sensitivity `s0` with two sensitivity alias's:
|
This example will associate sensitivity `s0` with two sensitivity alias's:
|
||||||
|
|
||||||
|
```secil
|
||||||
(sensitivity s0)
|
(sensitivity s0)
|
||||||
(sensitivityalias unclassified)
|
(sensitivityalias unclassified)
|
||||||
(sensitivityalias SystemLow)
|
(sensitivityalias SystemLow)
|
||||||
(sensitivityaliasactual unclassified s0)
|
(sensitivityaliasactual unclassified s0)
|
||||||
(sensitivityaliasactual SystemLow s0)
|
(sensitivityaliasactual SystemLow s0)
|
||||||
|
```
|
||||||
|
|
||||||
sensitivityorder
|
sensitivityorder
|
||||||
----------------
|
----------------
|
||||||
|
@ -120,7 +130,9 @@ Define the sensitivity order - lowest to highest. Multiple [`sensitivityorder`](
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(sensitivityorder (sensitivity_id ...))
|
(sensitivityorder (sensitivity_id ...))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -145,6 +157,7 @@ Define the sensitivity order - lowest to highest. Multiple [`sensitivityorder`](
|
||||||
|
|
||||||
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.
|
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.
|
||||||
|
|
||||||
|
```secil
|
||||||
(sensitivity s0)
|
(sensitivity s0)
|
||||||
(sensitivityalias s0 SystemLow)
|
(sensitivityalias s0 SystemLow)
|
||||||
(sensitivity s1)
|
(sensitivity s1)
|
||||||
|
@ -155,6 +168,7 @@ This example shows two [`sensitivityorder`](cil_mls_labeling_statements.md#sensi
|
||||||
(sensitivity s4)
|
(sensitivity s4)
|
||||||
(sensitivityalias s4 SystemHigh)
|
(sensitivityalias s4 SystemHigh)
|
||||||
(sensitivityorder (s2 s3 SystemHigh))
|
(sensitivityorder (s2 s3 SystemHigh))
|
||||||
|
```
|
||||||
|
|
||||||
category
|
category
|
||||||
--------
|
--------
|
||||||
|
@ -163,7 +177,9 @@ Declare a category identifier in the current namespace. Multiple category statem
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(category category_id)
|
(category category_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -188,9 +204,11 @@ Declare a category identifier in the current namespace. Multiple category statem
|
||||||
|
|
||||||
This example declares a three [`category`](cil_mls_labeling_statements.md#category) identifiers:
|
This example declares a three [`category`](cil_mls_labeling_statements.md#category) identifiers:
|
||||||
|
|
||||||
|
```secil
|
||||||
(category c0)
|
(category c0)
|
||||||
(category c1)
|
(category c1)
|
||||||
(category c2)
|
(category c2)
|
||||||
|
```
|
||||||
|
|
||||||
categoryalias
|
categoryalias
|
||||||
-------------
|
-------------
|
||||||
|
@ -199,7 +217,9 @@ Declares a category alias identifier in the current namespace. See the [`categor
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(categoryalias categoryalias_id)
|
(categoryalias categoryalias_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -227,7 +247,9 @@ Associates a previously declared [`categoryalias`](cil_mls_labeling_statements.m
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(categoryaliasactual categoryalias_id category_id)
|
(categoryaliasactual categoryalias_id category_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -256,9 +278,11 @@ Associates a previously declared [`categoryalias`](cil_mls_labeling_statements.m
|
||||||
|
|
||||||
Declares a category `c0`, a category alias of `documents`, and then associates them:
|
Declares a category `c0`, a category alias of `documents`, and then associates them:
|
||||||
|
|
||||||
|
```secil
|
||||||
(category c0)
|
(category c0)
|
||||||
(categoryalias documents)
|
(categoryalias documents)
|
||||||
(categoryaliasactual documents c0)
|
(categoryaliasactual documents c0)
|
||||||
|
```
|
||||||
|
|
||||||
categoryorder
|
categoryorder
|
||||||
-------------
|
-------------
|
||||||
|
@ -267,7 +291,9 @@ Define the category order. Multiple [`categoryorder`](cil_mls_labeling_statement
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(categoryorder (category_id ...))
|
(categoryorder (category_id ...))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -292,7 +318,9 @@ Define the category order. Multiple [`categoryorder`](cil_mls_labeling_statement
|
||||||
|
|
||||||
This example orders one category alias and nine categories:
|
This example orders one category alias and nine categories:
|
||||||
|
|
||||||
|
```secil
|
||||||
(categoryorder (documents c1 c2 c3 c4 c5 c6 c7 c8 c9)
|
(categoryorder (documents c1 c2 c3 c4 c5 c6 c7 c8 c9)
|
||||||
|
```
|
||||||
|
|
||||||
categoryset
|
categoryset
|
||||||
-----------
|
-----------
|
||||||
|
@ -307,7 +335,9 @@ Notes:
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(categoryset categoryset_id (category_id ... | expr ...))
|
(categoryset categoryset_id (category_id ... | expr ...))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -347,6 +377,7 @@ Notes:
|
||||||
|
|
||||||
These examples show a selection of [`categoryset`](cil_mls_labeling_statements.md#categoryset) statements:
|
These examples show a selection of [`categoryset`](cil_mls_labeling_statements.md#categoryset) statements:
|
||||||
|
|
||||||
|
```secil
|
||||||
; Declare categories with two alias's:
|
; Declare categories with two alias's:
|
||||||
(category c0)
|
(category c0)
|
||||||
(categoryalias documents)
|
(categoryalias documents)
|
||||||
|
@ -372,6 +403,7 @@ These examples show a selection of [`categoryset`](cil_mls_labeling_statements.m
|
||||||
(categoryset catset_3 (c4))
|
(categoryset catset_3 (c4))
|
||||||
|
|
||||||
(categoryset just_c0 (xor (c1 c2) (documents c1 c2)))
|
(categoryset just_c0 (xor (c1 c2) (documents c1 c2)))
|
||||||
|
```
|
||||||
|
|
||||||
sensitivitycategory
|
sensitivitycategory
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -380,7 +412,9 @@ Associate a [`sensitivity`](cil_mls_labeling_statements.md#sensitivity) identifi
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(sensitivitycategory sensitivity_id categoryset_id)
|
(sensitivitycategory sensitivity_id categoryset_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -409,11 +443,13 @@ Associate a [`sensitivity`](cil_mls_labeling_statements.md#sensitivity) identifi
|
||||||
|
|
||||||
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:
|
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:
|
||||||
|
|
||||||
|
```secil
|
||||||
(sensitivitycategory s0 catrange_1)
|
(sensitivitycategory s0 catrange_1)
|
||||||
(sensitivitycategory s0 catset_1)
|
(sensitivitycategory s0 catset_1)
|
||||||
(sensitivitycategory s0 catset_3)
|
(sensitivitycategory s0 catset_3)
|
||||||
(sensitivitycategory s0 (all))
|
(sensitivitycategory s0 (all))
|
||||||
(sensitivitycategory unclassified (range documents c2))
|
(sensitivitycategory unclassified (range documents c2))
|
||||||
|
```
|
||||||
|
|
||||||
level
|
level
|
||||||
-----
|
-----
|
||||||
|
@ -422,7 +458,9 @@ Declare a [`level`](cil_mls_labeling_statements.md#level) identifier in the curr
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
level level_id (sensitivity_id [categoryset_id])
|
```secil
|
||||||
|
(level level_id (sensitivity_id [categoryset_id]))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -455,11 +493,13 @@ Declare a [`level`](cil_mls_labeling_statements.md#level) identifier in the curr
|
||||||
|
|
||||||
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:
|
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:
|
||||||
|
|
||||||
|
```secil
|
||||||
(level systemLow (s0))
|
(level systemLow (s0))
|
||||||
(level level_1 (s0))
|
(level level_1 (s0))
|
||||||
(level level_2 (s0 (catrange_1)))
|
(level level_2 (s0 (catrange_1)))
|
||||||
(level level_3 (s0 (all_cats)))
|
(level level_3 (s0 (all_cats)))
|
||||||
(level level_4 (unclassified (c2 c3 c4)))
|
(level level_4 (unclassified (c2 c3 c4)))
|
||||||
|
```
|
||||||
|
|
||||||
levelrange
|
levelrange
|
||||||
----------
|
----------
|
||||||
|
@ -468,7 +508,9 @@ Declare a level range identifier in the current namespace and associate a curren
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(levelrange levelrange_id (low_level_id high_level_id))
|
(levelrange levelrange_id (low_level_id high_level_id))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -501,6 +543,7 @@ Declare a level range identifier in the current namespace and associate a curren
|
||||||
|
|
||||||
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:
|
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:
|
||||||
|
|
||||||
|
```secil
|
||||||
(handleunknown allow)
|
(handleunknown allow)
|
||||||
(mls true)
|
(mls true)
|
||||||
|
|
||||||
|
@ -581,6 +624,7 @@ This example policy shows [`levelrange`](cil_mls_labeling_statements.md#levelran
|
||||||
|
|
||||||
(context context_1 (user object_r object low_low))
|
(context context_1 (user object_r object low_low))
|
||||||
) ; End unconfined namespace
|
) ; End unconfined namespace
|
||||||
|
```
|
||||||
|
|
||||||
rangetransition
|
rangetransition
|
||||||
---------------
|
---------------
|
||||||
|
@ -589,7 +633,9 @@ Allows an objects level to transition to a different level. Generally used to en
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(rangetransition source_id target_id class_id new_range_id)
|
(rangetransition source_id target_id class_id new_range_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -626,13 +672,15 @@ Allows an objects level to transition to a different level. Generally used to en
|
||||||
|
|
||||||
This rule will transition the range of `sshd.exec` to `s0 - s1:c0.c3` on execution from the `init.process`:
|
This rule will transition the range of `sshd.exec` to `s0 - s1:c0.c3` on execution from the `init.process`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(sensitivity s0)
|
(sensitivity s0)
|
||||||
(sensitivity s1)
|
(sensitivity s1)
|
||||||
(sensitivityorder s0 s1)
|
(sensitivityorder s0 s1)
|
||||||
(category c0)
|
(category c0)
|
||||||
...
|
...
|
||||||
(level systemlow (s0)
|
(level systemlow (s0))
|
||||||
(level systemhigh (s1 (c0 c1 c2)))
|
(level systemhigh (s1 (c0 c1 c2)))
|
||||||
(levelrange low_high (systemlow systemhigh))
|
(levelrange low_high (systemlow systemhigh))
|
||||||
|
|
||||||
(rangetransition init.process sshd.exec process low_high)
|
(rangetransition init.process sshd.exec process low_high)
|
||||||
|
```
|
||||||
|
|
|
@ -14,7 +14,9 @@ Notes:
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(ipaddr ipaddr_id ip_address)
|
(ipaddr ipaddr_id ip_address)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -43,13 +45,15 @@ Notes:
|
||||||
|
|
||||||
This example declares a named IP address and also passes an 'explicit anonymously declared' IP address to a macro:
|
This example declares a named IP address and also passes an 'explicit anonymously declared' IP address to a macro:
|
||||||
|
|
||||||
|
```secil
|
||||||
(ipaddr netmask_1 255.255.255.0)
|
(ipaddr netmask_1 255.255.255.0)
|
||||||
(context netlabel_1 (system.user object_r unconfined.object low_low)
|
(context netlabel_1 (system.user object_r unconfined.object low_low))
|
||||||
|
|
||||||
(call build_nodecon ((192.168.1.64) netmask_1))
|
(call build_nodecon ((192.168.1.64) netmask_1))
|
||||||
|
|
||||||
(macro build_nodecon ((ipaddr ARG1) (ipaddr ARG2))
|
(macro build_nodecon ((ipaddr ARG1) (ipaddr ARG2))
|
||||||
(nodecon ARG1 ARG2 netlabel_1))
|
(nodecon ARG1 ARG2 netlabel_1))
|
||||||
|
```
|
||||||
|
|
||||||
netifcon
|
netifcon
|
||||||
--------
|
--------
|
||||||
|
@ -58,7 +62,9 @@ Label network interface objects (e.g. `eth0`).
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(netifcon netif_name netif_context_id packet_context_id)
|
(netifcon netif_name netif_context_id packet_context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -93,12 +99,14 @@ Label network interface objects (e.g. `eth0`).
|
||||||
|
|
||||||
These examples show named and anonymous [`netifcon`](cil_network_labeling_statements.md#netifcon) statements:
|
These examples show named and anonymous [`netifcon`](cil_network_labeling_statements.md#netifcon) statements:
|
||||||
|
|
||||||
|
```secil
|
||||||
(context context_1 (unconfined.user object_r unconfined.object low_low))
|
(context context_1 (unconfined.user object_r unconfined.object low_low))
|
||||||
(context context_2 (unconfined.user object_r unconfined.object (systemlow level_2)))
|
(context context_2 (unconfined.user object_r unconfined.object (systemlow level_2)))
|
||||||
|
|
||||||
(netifcon eth0 context_1 (unconfined.user object_r unconfined.object levelrange_1))
|
(netifcon eth0 context_1 (unconfined.user object_r unconfined.object levelrange_1))
|
||||||
(netifcon eth1 context_1 (unconfined.user object_r unconfined.object ((s0) level_1)))
|
(netifcon eth1 context_1 (unconfined.user object_r unconfined.object ((s0) level_1)))
|
||||||
(netifcon eth3 context_1 context_2)
|
(netifcon eth3 context_1 context_2)
|
||||||
|
```
|
||||||
|
|
||||||
nodecon
|
nodecon
|
||||||
-------
|
-------
|
||||||
|
@ -109,7 +117,9 @@ IP Addresses may be declared without a previous declaration by enclosing within
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(nodecon subnet_id netmask_id context_id)
|
(nodecon subnet_id netmask_id context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -142,6 +152,7 @@ IP Addresses may be declared without a previous declaration by enclosing within
|
||||||
|
|
||||||
These examples show named and anonymous [`nodecon`](cil_network_labeling_statements.md#nodecon) statements:
|
These examples show named and anonymous [`nodecon`](cil_network_labeling_statements.md#nodecon) statements:
|
||||||
|
|
||||||
|
```secil
|
||||||
(context context_1 (unconfined.user object_r unconfined.object low_low))
|
(context context_1 (unconfined.user object_r unconfined.object low_low))
|
||||||
(context context_2 (unconfined.user object_r unconfined.object (systemlow level_2)))
|
(context context_2 (unconfined.user object_r unconfined.object (systemlow level_2)))
|
||||||
|
|
||||||
|
@ -160,6 +171,7 @@ These examples show named and anonymous [`nodecon`](cil_network_labeling_stateme
|
||||||
(nodecon ipv6_2 netmask_2 context_3)
|
(nodecon ipv6_2 netmask_2 context_3)
|
||||||
(nodecon (2001:db8:1:0:0:0:0:0) (ffff:ffff:ffff:0:0:0:0:0) context_3)
|
(nodecon (2001:db8:1:0:0:0:0:0) (ffff:ffff:ffff:0:0:0:0:0) context_3)
|
||||||
(nodecon (2001:db8:1:0:0:0:0:0) netmask_2 (sys.id sys.role my48prefix.node ((s0)(s0))))
|
(nodecon (2001:db8:1:0:0:0:0:0) netmask_2 (sys.id sys.role my48prefix.node ((s0)(s0))))
|
||||||
|
```
|
||||||
|
|
||||||
portcon
|
portcon
|
||||||
-------
|
-------
|
||||||
|
@ -168,7 +180,9 @@ Label a udp, tcp, dccp or sctp port.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(portcon protocol port|(port_low port_high) context_id)
|
(portcon protocol port|(port_low port_high) context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -203,6 +217,7 @@ Label a udp, tcp, dccp or sctp port.
|
||||||
|
|
||||||
These examples show named and anonymous [`portcon`](cil_network_labeling_statements.md#portcon) statements:
|
These examples show named and anonymous [`portcon`](cil_network_labeling_statements.md#portcon) statements:
|
||||||
|
|
||||||
|
```secil
|
||||||
(portcon tcp 1111 (unconfined.user object_r unconfined.object ((s0) (s0 (c0)))))
|
(portcon tcp 1111 (unconfined.user object_r unconfined.object ((s0) (s0 (c0)))))
|
||||||
(portcon tcp 2222 (unconfined.user object_r unconfined.object levelrange_2))
|
(portcon tcp 2222 (unconfined.user object_r unconfined.object levelrange_2))
|
||||||
(portcon tcp 3333 (unconfined.user object_r unconfined.object levelrange_1))
|
(portcon tcp 3333 (unconfined.user object_r unconfined.object levelrange_1))
|
||||||
|
@ -210,3 +225,4 @@ These examples show named and anonymous [`portcon`](cil_network_labeling_stateme
|
||||||
(portcon tcp (2000 20000) (unconfined.user object_r unconfined.object (systemlow level_3)))
|
(portcon tcp (2000 20000) (unconfined.user object_r unconfined.object (systemlow level_3)))
|
||||||
(portcon dccp (6840 6880) (unconfined.user object_r unconfined.object ((s0) level_2)))
|
(portcon dccp (6840 6880) (unconfined.user object_r unconfined.object ((s0) level_2)))
|
||||||
(portcon sctp (1024 1035) (unconfined.user object_r unconfined.object ((s0) level_2)))
|
(portcon sctp (1024 1035) (unconfined.user object_r unconfined.object ((s0) level_2)))
|
||||||
|
```
|
||||||
|
|
|
@ -10,7 +10,9 @@ Note that this can be over-ridden by the CIL compiler command line parameter `-M
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(mls boolean)
|
(mls boolean)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -33,7 +35,9 @@ Note that this can be over-ridden by the CIL compiler command line parameter `-M
|
||||||
|
|
||||||
**Example:**
|
**Example:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(mls true)
|
(mls true)
|
||||||
|
```
|
||||||
|
|
||||||
handleunknown
|
handleunknown
|
||||||
-------------
|
-------------
|
||||||
|
@ -44,7 +48,9 @@ Note that this can be over-ridden by the CIL compiler command line parameter `-U
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(handleunknown action)
|
(handleunknown action)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -72,7 +78,9 @@ Note that this can be over-ridden by the CIL compiler command line parameter `-U
|
||||||
|
|
||||||
This will allow unknown classes / permissions to be present in the policy:
|
This will allow unknown classes / permissions to be present in the policy:
|
||||||
|
|
||||||
|
```secil
|
||||||
(handleunknown allow)
|
(handleunknown allow)
|
||||||
|
```
|
||||||
|
|
||||||
policycap
|
policycap
|
||||||
---------
|
---------
|
||||||
|
@ -81,7 +89,9 @@ Allow policy capabilities to be enabled via policy. These should be declared in
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(policycap policycap_id)
|
(policycap policycap_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -106,8 +116,10 @@ Allow policy capabilities to be enabled via policy. These should be declared in
|
||||||
|
|
||||||
These set two valid policy capabilities:
|
These set two valid policy capabilities:
|
||||||
|
|
||||||
|
```secil
|
||||||
; Enable networking controls.
|
; Enable networking controls.
|
||||||
(policycap network_peer_controls)
|
(policycap network_peer_controls)
|
||||||
|
|
||||||
; Enable open permission check.
|
; Enable open permission check.
|
||||||
(policycap open_perms)
|
(policycap open_perms)
|
||||||
|
```
|
||||||
|
|
|
@ -57,10 +57,12 @@ Declarations may be named or anonymous and have three different forms:
|
||||||
ipaddr
|
ipaddr
|
||||||
macro
|
macro
|
||||||
policycap
|
policycap
|
||||||
|
|
||||||
2. Explicit anonymous declarations - These are currently restricted to IP addresses where they can be declared directly in statements by enclosing them within parentheses e.g. `(127.0.0.1)` or `(::1)`. See the [Network Labeling Statements](#network_labeling) section for examples.
|
2. Explicit anonymous declarations - These are currently restricted to IP addresses where they can be declared directly in statements by enclosing them within parentheses e.g. `(127.0.0.1)` or `(::1)`. See the [Network Labeling Statements](#network_labeling) section for examples.
|
||||||
|
|
||||||
3. Anonymous declarations - These have been previously declared and the object already exists, therefore they may be referenced by their name or identifier within statements. For example the following declare all the components required to specify a context:
|
3. Anonymous declarations - These have been previously declared and the object already exists, therefore they may be referenced by their name or identifier within statements. For example the following declare all the components required to specify a context:
|
||||||
|
|
||||||
|
```secil
|
||||||
(sensitivity s0)
|
(sensitivity s0)
|
||||||
(category c0)
|
(category c0)
|
||||||
(role object_r)
|
(role object_r)
|
||||||
|
@ -69,10 +71,13 @@ Declarations may be named or anonymous and have three different forms:
|
||||||
(user user)
|
(user user)
|
||||||
(type object)
|
(type object)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
now a [`portcon`](cil_network_labeling_statements.md#portcon) statement can be defined that uses these individual components to build a context as follows:
|
now a [`portcon`](cil_network_labeling_statements.md#portcon) statement can be defined that uses these individual components to build a context as follows:
|
||||||
|
|
||||||
|
```secil
|
||||||
(portcon udp 12345 (unconfined.user object_r unconfined.object ((s0) (s0(c0)))))
|
(portcon udp 12345 (unconfined.user object_r unconfined.object ((s0) (s0(c0)))))
|
||||||
|
```
|
||||||
|
|
||||||
Definitions
|
Definitions
|
||||||
-----------
|
-----------
|
||||||
|
@ -113,6 +118,7 @@ Namespaces
|
||||||
|
|
||||||
CIL supports namespaces via containers such as the [`block`](cil_container_statements.md#block) statement. When a block is resolved to form the parent / child relationship a dot '`.`' is used, for example the following [`allow`](cil_access_vector_rules.md#allow) rule:
|
CIL supports namespaces via containers such as the [`block`](cil_container_statements.md#block) statement. When a block is resolved to form the parent / child relationship a dot '`.`' is used, for example the following [`allow`](cil_access_vector_rules.md#allow) rule:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block example_ns
|
(block example_ns
|
||||||
(type process)
|
(type process)
|
||||||
(type object)
|
(type object)
|
||||||
|
@ -120,16 +126,20 @@ CIL supports namespaces via containers such as the [`block`](cil_container_state
|
||||||
|
|
||||||
(allow process object (file (open read getattr)))
|
(allow process object (file (open read getattr)))
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
will resolve to the following kernel policy language statement:
|
will resolve to the following kernel policy language statement:
|
||||||
|
|
||||||
|
```
|
||||||
allow example_ns.process example_ns.object : example_ns.file { open read getattr };
|
allow example_ns.process example_ns.object : example_ns.file { open read getattr };
|
||||||
|
```
|
||||||
|
|
||||||
Global Namespace
|
Global Namespace
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
CIL has a global namespace that is always present. Any symbol that is declared outside a container is in the global namespace. To reference a symbol in global namespace, the symbol should be prefixed with a dot '`.`' as shown in the following example:
|
CIL has a global namespace that is always present. Any symbol that is declared outside a container is in the global namespace. To reference a symbol in global namespace, the symbol should be prefixed with a dot '`.`' as shown in the following example:
|
||||||
|
|
||||||
|
```secil
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
; This example has three namespace 'tmpfs' types declared:
|
; This example has three namespace 'tmpfs' types declared:
|
||||||
; 1) Global .tmpfs
|
; 1) Global .tmpfs
|
||||||
|
@ -170,6 +180,7 @@ CIL has a global namespace that is always present. Any symbol that is declared o
|
||||||
(block other_ns
|
(block other_ns
|
||||||
(type tmpfs)
|
(type tmpfs)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
Should the symbol not be prefixed with a dot, the current namespace would be searched first and then the global namespace (provided there is not a symbol of that name in the current namespace).
|
Should the symbol not be prefixed with a dot, the current namespace would be searched first and then the global namespace (provided there is not a symbol of that name in the current namespace).
|
||||||
|
|
||||||
|
@ -180,9 +191,11 @@ Expressions may occur in the following CIL statements: [`booleanif`](cil_conditi
|
||||||
|
|
||||||
CIL expressions use the [prefix](http://www.cs.man.ac.uk/~pjj/cs212/fix.html) or Polish notation and may be nested (note that the kernel policy language uses postfix or reverse Polish notation). The syntax is as follows, where the parenthesis are part of the syntax:
|
CIL expressions use the [prefix](http://www.cs.man.ac.uk/~pjj/cs212/fix.html) or Polish notation and may be nested (note that the kernel policy language uses postfix or reverse Polish notation). The syntax is as follows, where the parenthesis are part of the syntax:
|
||||||
|
|
||||||
|
```
|
||||||
expr_set = (name ... | expr ...)
|
expr_set = (name ... | expr ...)
|
||||||
expr = (expr_key expr_set ...)
|
expr = (expr_key expr_set ...)
|
||||||
expr_key = and | or | xor | not | all | eq | neq | dom | domby | incomp | range
|
expr_key = and | or | xor | not | all | eq | neq | dom | domby | incomp | range
|
||||||
|
```
|
||||||
|
|
||||||
The number of `expr_set`'s in an `expr` is dependent on the statement type (there are four different classes as defined below) that also influence the valid `expr_key` entries (e.g. `dom`, `domby`, `incomp` are only allowed in constraint statements).
|
The number of `expr_set`'s in an `expr` is dependent on the statement type (there are four different classes as defined below) that also influence the valid `expr_key` entries (e.g. `dom`, `domby`, `incomp` are only allowed in constraint statements).
|
||||||
|
|
||||||
|
@ -204,6 +217,7 @@ The number of `expr_set`'s in an `expr` is dependent on the statement type (ther
|
||||||
|
|
||||||
This example includes all `fs_type type` entries except `file.usermodehelper` and `file.proc_security` in the associated [`typeattribute`](cil_type_statements.md#typeattribute) identifier `all_fs_type_except_usermodehelper_and_proc_security`:
|
This example includes all `fs_type type` entries except `file.usermodehelper` and `file.proc_security` in the associated [`typeattribute`](cil_type_statements.md#typeattribute) identifier `all_fs_type_except_usermodehelper_and_proc_security`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(typeattribute all_fs_type_except_usermodehelper_and_proc_security)
|
(typeattribute all_fs_type_except_usermodehelper_and_proc_security)
|
||||||
|
|
||||||
(typeattributeset all_fs_type_except_usermodehelper_and_proc_security
|
(typeattributeset all_fs_type_except_usermodehelper_and_proc_security
|
||||||
|
@ -215,17 +229,21 @@ The number of `expr_set`'s in an `expr` is dependent on the statement type (ther
|
||||||
(not file.proc_security)
|
(not file.proc_security)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
The `cps_1 classpermissionset` identifier includes all permissions except `load_policy` and `setenforce`:
|
The `cps_1 classpermissionset` identifier includes all permissions except `load_policy` and `setenforce`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class security (compute_av compute_create compute_member check_context load_policy compute_relabel compute_user setenforce setbool setsecparam setcheckreqprot read_policy))
|
(class security (compute_av compute_create compute_member check_context load_policy compute_relabel compute_user setenforce setbool setsecparam setcheckreqprot read_policy))
|
||||||
|
|
||||||
(classpermission cps_1)
|
(classpermission cps_1)
|
||||||
|
|
||||||
(classpermissionset cps_1 (security (not (load_policy setenforce))))
|
(classpermissionset cps_1 (security (not (load_policy setenforce))))
|
||||||
|
```
|
||||||
|
|
||||||
This example includes all permissions in the associated [`classpermissionset`](cil_class_and_permission_statements.md#classpermissionset) identifier `security_all_perms`:
|
This example includes all permissions in the associated [`classpermissionset`](cil_class_and_permission_statements.md#classpermissionset) identifier `security_all_perms`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class security (compute_av compute_create compute_member check_context load_policy
|
(class security (compute_av compute_create compute_member check_context load_policy
|
||||||
compute_relabel compute_user setenforce setbool setsecparam setcheckreqprot
|
compute_relabel compute_user setenforce setbool setsecparam setcheckreqprot
|
||||||
read_policy)
|
read_policy)
|
||||||
|
@ -234,6 +252,7 @@ The number of `expr_set`'s in an `expr` is dependent on the statement type (ther
|
||||||
(classpermission security_all_perms)
|
(classpermission security_all_perms)
|
||||||
|
|
||||||
(classpermissionset security_all_perms (security (all)))
|
(classpermissionset security_all_perms (security (all)))
|
||||||
|
```
|
||||||
|
|
||||||
2. The [`categoryset`](cil_mls_labeling_statements.md#categoryset) statement allows `expr_set` to mix names and `expr_key` values of: `and`, `or`, `not`, `xor`, `all`, `range` as shown in the examples.
|
2. The [`categoryset`](cil_mls_labeling_statements.md#categoryset) statement allows `expr_set` to mix names and `expr_key` values of: `and`, `or`, `not`, `xor`, `all`, `range` as shown in the examples.
|
||||||
|
|
||||||
|
@ -241,6 +260,7 @@ The number of `expr_set`'s in an `expr` is dependent on the statement type (ther
|
||||||
|
|
||||||
3. The [`booleanif`](cil_conditional_statements.md#booleanif) and [`tunableif`](cil_conditional_statements.md#tunableif) statements only allow an `expr_set` to have one `name` or `expr` with `expr_key` values of `and`, `or`, `xor`, `not`, `eq`, `neq` as shown in the examples:
|
3. The [`booleanif`](cil_conditional_statements.md#booleanif) and [`tunableif`](cil_conditional_statements.md#tunableif) statements only allow an `expr_set` to have one `name` or `expr` with `expr_key` values of `and`, `or`, `xor`, `not`, `eq`, `neq` as shown in the examples:
|
||||||
|
|
||||||
|
```secil
|
||||||
(booleanif disableAudio
|
(booleanif disableAudio
|
||||||
(false
|
(false
|
||||||
(allow process device.audio_device (chr_file_set (rw_file_perms)))
|
(allow process device.audio_device (chr_file_set (rw_file_perms)))
|
||||||
|
@ -252,9 +272,11 @@ The number of `expr_set`'s in an `expr` is dependent on the statement type (ther
|
||||||
(allow process device.audio_capture_device (chr_file_set (rw_file_perms)))
|
(allow process device.audio_capture_device (chr_file_set (rw_file_perms)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
4. The [`constrain`](cil_constraint_statements.md#constrain), [`mlsconstrain`](cil_constraint_statements.md#mlsconstrain), [`validatetrans`](cil_constraint_statements.md#validatetrans) and [`mlsvalidatetrans`](cil_constraint_statements.md#mlsvalidatetrans) statements only allow an `expr_set` to have one `name` or `expr` with `expr_key` values of `and`, `or`, `not`, `all`, `eq`, `neq`, `dom`, `domby`, `incomp`. When `expr_key` is `dom`, `domby` or `incomp`, it must be followed by a string (e.g. `h1`, `l2`) and another string or a set of `name`s. The following examples show CIL constraint statements and their policy language equivalents:
|
4. The [`constrain`](cil_constraint_statements.md#constrain), [`mlsconstrain`](cil_constraint_statements.md#mlsconstrain), [`validatetrans`](cil_constraint_statements.md#validatetrans) and [`mlsvalidatetrans`](cil_constraint_statements.md#mlsvalidatetrans) statements only allow an `expr_set` to have one `name` or `expr` with `expr_key` values of `and`, `or`, `not`, `all`, `eq`, `neq`, `dom`, `domby`, `incomp`. When `expr_key` is `dom`, `domby` or `incomp`, it must be followed by a string (e.g. `h1`, `l2`) and another string or a set of `name`s. The following examples show CIL constraint statements and their policy language equivalents:
|
||||||
|
|
||||||
|
```secil
|
||||||
; Process transition: Require equivalence unless the subject is trusted.
|
; Process transition: Require equivalence unless the subject is trusted.
|
||||||
(mlsconstrain (process (transition dyntransition))
|
(mlsconstrain (process (transition dyntransition))
|
||||||
(or (and (eq h1 h2) (eq l1 l2)) (eq t1 mlstrustedsubject)))
|
(or (and (eq h1 h2) (eq l1 l2)) (eq t1 mlstrustedsubject)))
|
||||||
|
@ -270,29 +292,36 @@ The number of `expr_set`'s in an `expr` is dependent on the statement type (ther
|
||||||
; The equivalent policy language mlsconstrain statememt is:
|
; The equivalent policy language mlsconstrain statememt is:
|
||||||
;mlsconstrain process { getsched getsession getpgid getcap getattr ptrace share }
|
;mlsconstrain process { getsched getsession getpgid getcap getattr ptrace share }
|
||||||
; (l1 dom l2 or t1 == mlstrustedsubject);
|
; (l1 dom l2 or t1 == mlstrustedsubject);
|
||||||
|
```
|
||||||
|
|
||||||
Name String
|
Name String
|
||||||
-----------
|
-----------
|
||||||
|
|
||||||
Used to define [`macro`](cil_call_macro_statements.md#macro) statement parameter string types:
|
Used to define [`macro`](cil_call_macro_statements.md#macro) statement parameter string types:
|
||||||
|
|
||||||
|
```secil
|
||||||
(call macro1("__kmsg__"))
|
(call macro1("__kmsg__"))
|
||||||
|
|
||||||
(macro macro1 ((string ARG1))
|
(macro macro1 ((string ARG1))
|
||||||
(typetransition audit.process device.device chr_file ARG1 device.klog_device)
|
(typetransition audit.process device.device chr_file ARG1 device.klog_device)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
Alternatively:
|
Alternatively:
|
||||||
|
|
||||||
|
```secil
|
||||||
(call macro1("__kmsg__"))
|
(call macro1("__kmsg__"))
|
||||||
|
|
||||||
(macro macro1 ((name ARG1))
|
(macro macro1 ((name ARG1))
|
||||||
(typetransition audit.process device.device chr_file ARG1 device.klog_device)
|
(typetransition audit.process device.device chr_file ARG1 device.klog_device)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
self
|
self
|
||||||
----
|
----
|
||||||
|
|
||||||
The [`self`](cil_reference_guide.md#self) keyword may be used as the target in AVC rule statements, and means that the target is the same as the source as shown in the following example:.
|
The [`self`](cil_reference_guide.md#self) keyword may be used as the target in AVC rule statements, and means that the target is the same as the source as shown in the following example:.
|
||||||
|
|
||||||
|
```secil
|
||||||
(allow unconfined.process self (file (read write)))
|
(allow unconfined.process self (file (read write)))
|
||||||
|
```
|
||||||
|
|
|
@ -8,7 +8,9 @@ Declares a role identifier in the current namespace.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(role role_id)
|
(role role_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -33,11 +35,13 @@ Declares a role identifier in the current namespace.
|
||||||
|
|
||||||
This example declares two roles: `object_r` in the global namespace and `unconfined.role`:
|
This example declares two roles: `object_r` in the global namespace and `unconfined.role`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(role object_r)
|
(role object_r)
|
||||||
|
|
||||||
(block unconfined
|
(block unconfined
|
||||||
(role role)
|
(role role)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
roletype
|
roletype
|
||||||
--------
|
--------
|
||||||
|
@ -46,7 +50,9 @@ Authorises a [`role`](cil_role_statements.md#role) to access a [`type`](cil_type
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(role role_id type_id)
|
(role role_id type_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -75,11 +81,13 @@ Authorises a [`role`](cil_role_statements.md#role) to access a [`type`](cil_type
|
||||||
|
|
||||||
This example will declare [`role`](cil_role_statements.md#role) and [`type`](cil_type_statements.md#type) identifiers, then associate them:
|
This example will declare [`role`](cil_role_statements.md#role) and [`type`](cil_type_statements.md#type) identifiers, then associate them:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block unconfined
|
(block unconfined
|
||||||
(role role)
|
(role role)
|
||||||
(type process)
|
(type process)
|
||||||
(roletype role process)
|
(roletype role process)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
roleattribute
|
roleattribute
|
||||||
-------------
|
-------------
|
||||||
|
@ -88,7 +96,9 @@ Declares a role attribute identifier in the current namespace. The identifier ma
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(roleattribute roleattribute_id)
|
(roleattribute roleattribute_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -113,9 +123,11 @@ Declares a role attribute identifier in the current namespace. The identifier ma
|
||||||
|
|
||||||
This example will declare a role attribute `roles.role_holder` that will have an empty set:
|
This example will declare a role attribute `roles.role_holder` that will have an empty set:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block roles
|
(block roles
|
||||||
(roleattribute role_holder)
|
(roleattribute role_holder)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
roleattributeset
|
roleattributeset
|
||||||
----------------
|
----------------
|
||||||
|
@ -124,7 +136,9 @@ Allows the association of one or more previously declared [`role`](cil_role_stat
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(roleattributeset roleattribute_id (role_id ... | expr ...))
|
(roleattributeset roleattribute_id (role_id ... | expr ...))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -163,6 +177,7 @@ Allows the association of one or more previously declared [`role`](cil_role_stat
|
||||||
|
|
||||||
This example will declare three roles and two role attributes, then associate all the roles to them as shown:
|
This example will declare three roles and two role attributes, then associate all the roles to them as shown:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block roles
|
(block roles
|
||||||
(role role_1)
|
(role role_1)
|
||||||
(role role_2)
|
(role role_2)
|
||||||
|
@ -174,6 +189,7 @@ This example will declare three roles and two role attributes, then associate al
|
||||||
(roleattribute role_holder_all)
|
(roleattribute role_holder_all)
|
||||||
(roleattributeset role_holder_all (all))
|
(roleattributeset role_holder_all (all))
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
roleallow
|
roleallow
|
||||||
---------
|
---------
|
||||||
|
@ -188,7 +204,9 @@ Notes:
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(roleallow current_role_id new_role_id)
|
(roleallow current_role_id new_role_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -224,7 +242,9 @@ Specify a role transition from the current role to a new role when computing a c
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(roletransition current_role_id target_type_id class_id new_role_id)
|
(roletransition current_role_id target_type_id class_id new_role_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -261,6 +281,7 @@ Specify a role transition from the current role to a new role when computing a c
|
||||||
|
|
||||||
This example will authorise the `unconfined.role` to assume the `msg_filter.role` role, and then transition to that role:
|
This example will authorise the `unconfined.role` to assume the `msg_filter.role` role, and then transition to that role:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block ext_gateway
|
(block ext_gateway
|
||||||
(type process)
|
(type process)
|
||||||
(type exec)
|
(type exec)
|
||||||
|
@ -269,6 +290,7 @@ This example will authorise the `unconfined.role` to assume the `msg_filter.role
|
||||||
(roleallow unconfined.role msg_filter.role)
|
(roleallow unconfined.role msg_filter.role)
|
||||||
(roletransition unconfined.role exec process msg_filter.role)
|
(roletransition unconfined.role exec process msg_filter.role)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
rolebounds
|
rolebounds
|
||||||
----------
|
----------
|
||||||
|
@ -283,7 +305,9 @@ Notes:
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(rolebounds parent_role_id child_role_id)
|
(rolebounds parent_role_id child_role_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -312,9 +336,11 @@ Notes:
|
||||||
|
|
||||||
In this example the role `test` cannot have greater privileges than `unconfined.role`:
|
In this example the role `test` cannot have greater privileges than `unconfined.role`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(role test)
|
(role test)
|
||||||
|
|
||||||
(unconfined
|
(unconfined
|
||||||
(role role)
|
(role role)
|
||||||
(rolebounds role .test)
|
(rolebounds role .test)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
|
@ -8,7 +8,9 @@ Declares a new SID identifier in the current namespace.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(sid sid_id)
|
(sid sid_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -33,9 +35,11 @@ Declares a new SID identifier in the current namespace.
|
||||||
|
|
||||||
These examples show three [`sid`](cil_sid_statements.md#sid) declarations:
|
These examples show three [`sid`](cil_sid_statements.md#sid) declarations:
|
||||||
|
|
||||||
|
```secil
|
||||||
(sid kernel)
|
(sid kernel)
|
||||||
(sid security)
|
(sid security)
|
||||||
(sid igmp_packet)
|
(sid igmp_packet)
|
||||||
|
```
|
||||||
|
|
||||||
sidorder
|
sidorder
|
||||||
--------
|
--------
|
||||||
|
@ -44,7 +48,9 @@ Defines the order of [sid](#sid)'s. This is a mandatory statement when SIDs are
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(sidorder (sid_id ...))
|
(sidorder (sid_id ...))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -69,11 +75,13 @@ Defines the order of [sid](#sid)'s. This is a mandatory statement when SIDs are
|
||||||
|
|
||||||
This will produce an ordered list of "`kernel security unlabeled`"
|
This will produce an ordered list of "`kernel security unlabeled`"
|
||||||
|
|
||||||
|
```secil
|
||||||
(sid kernel)
|
(sid kernel)
|
||||||
(sid security)
|
(sid security)
|
||||||
(sid unlabeled)
|
(sid unlabeled)
|
||||||
(sidorder (kernel security))
|
(sidorder (kernel security))
|
||||||
(sidorder (security unlabeled))
|
(sidorder (security unlabeled))
|
||||||
|
```
|
||||||
|
|
||||||
sidcontext
|
sidcontext
|
||||||
----------
|
----------
|
||||||
|
@ -82,7 +90,9 @@ Associates an SELinux security [context](#context) to a previously declared [`si
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(sidcontext sid_id context_id)
|
(sidcontext sid_id context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -111,6 +121,7 @@ Associates an SELinux security [context](#context) to a previously declared [`si
|
||||||
|
|
||||||
This shows two named security context examples plus an anonymous context:
|
This shows two named security context examples plus an anonymous context:
|
||||||
|
|
||||||
|
```secil
|
||||||
; Two named context:
|
; Two named context:
|
||||||
(sid kernel)
|
(sid kernel)
|
||||||
(context kernel_context (u r process low_low))
|
(context kernel_context (u r process low_low))
|
||||||
|
@ -123,3 +134,4 @@ This shows two named security context examples plus an anonymous context:
|
||||||
; An anonymous context:
|
; An anonymous context:
|
||||||
(sid unlabeled)
|
(sid unlabeled)
|
||||||
(sidcontext unlabeled (u object_r ((s0) (s0))))
|
(sidcontext unlabeled (u object_r ((s0) (s0))))
|
||||||
|
```
|
||||||
|
|
|
@ -8,7 +8,9 @@ Declares a type identifier in the current namespace.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(type type_id)
|
(type type_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -33,9 +35,11 @@ Declares a type identifier in the current namespace.
|
||||||
|
|
||||||
This example declares a type identifier `bluetooth.process`:
|
This example declares a type identifier `bluetooth.process`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block bluetooth
|
(block bluetooth
|
||||||
(type process)
|
(type process)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
typealias
|
typealias
|
||||||
---------
|
---------
|
||||||
|
@ -44,7 +48,9 @@ Declares a type alias in the current namespace.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(typealias typealias_id)
|
(typealias typealias_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -76,7 +82,9 @@ Associates a previously declared [`typealias`](cil_type_statements.md#typealias)
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(typealiasactual typealias_id type_id)
|
(typealiasactual typealias_id type_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -105,12 +113,14 @@ Associates a previously declared [`typealias`](cil_type_statements.md#typealias)
|
||||||
|
|
||||||
This example will alias `unconfined.process` as `unconfined_t` in the global namespace:
|
This example will alias `unconfined.process` as `unconfined_t` in the global namespace:
|
||||||
|
|
||||||
|
```secil
|
||||||
(typealias unconfined_t)
|
(typealias unconfined_t)
|
||||||
(typealiasactual unconfined_t unconfined.process)
|
(typealiasactual unconfined_t unconfined.process)
|
||||||
|
|
||||||
(block unconfined
|
(block unconfined
|
||||||
(type process)
|
(type process)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
typeattribute
|
typeattribute
|
||||||
-------------
|
-------------
|
||||||
|
@ -119,7 +129,9 @@ Declares a type attribute identifier in the current namespace. The identifier ma
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(typeattribute typeattribute_id)
|
(typeattribute typeattribute_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -144,7 +156,9 @@ Declares a type attribute identifier in the current namespace. The identifier ma
|
||||||
|
|
||||||
This example declares a type attribute `domain` in global namespace that will have an empty set:
|
This example declares a type attribute `domain` in global namespace that will have an empty set:
|
||||||
|
|
||||||
|
```secil
|
||||||
(typeattribute domain)
|
(typeattribute domain)
|
||||||
|
```
|
||||||
|
|
||||||
typeattributeset
|
typeattributeset
|
||||||
----------------
|
----------------
|
||||||
|
@ -153,7 +167,9 @@ Allows the association of one or more previously declared [`type`](cil_type_stat
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(typeattributeset typeattribute_id (type_id ... | expr ...))
|
(typeattributeset typeattribute_id (type_id ... | expr ...))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -192,12 +208,15 @@ Allows the association of one or more previously declared [`type`](cil_type_stat
|
||||||
|
|
||||||
This example will take all the policy types and exclude those in `appdomain`. It is equivalent to `~appdomain` in the kernel policy language.
|
This example will take all the policy types and exclude those in `appdomain`. It is equivalent to `~appdomain` in the kernel policy language.
|
||||||
|
|
||||||
|
```secil
|
||||||
(typeattribute not_in_appdomain)
|
(typeattribute not_in_appdomain)
|
||||||
|
|
||||||
(typeattributeset not_in_appdomain (not (appdomain)))
|
(typeattributeset not_in_appdomain (not (appdomain)))
|
||||||
|
```
|
||||||
|
|
||||||
This example is equivalent to `{ domain -kernel.process -ueventd.process -init.process }` in the kernel policy language:
|
This example is equivalent to `{ domain -kernel.process -ueventd.process -init.process }` in the kernel policy language:
|
||||||
|
|
||||||
|
```secil
|
||||||
(typeattribute na_kernel_or_ueventd_or_init_in_domain)
|
(typeattribute na_kernel_or_ueventd_or_init_in_domain)
|
||||||
|
|
||||||
(typeattributeset na_kernel_or_ueventd_or_init_in_domain
|
(typeattributeset na_kernel_or_ueventd_or_init_in_domain
|
||||||
|
@ -212,6 +231,7 @@ This example is equivalent to `{ domain -kernel.process -ueventd.process -init.p
|
||||||
(not (init.process))
|
(not (init.process))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
expandtypeattribute
|
expandtypeattribute
|
||||||
-------------------
|
-------------------
|
||||||
|
@ -229,7 +249,9 @@ option cause the rules involving the type attribute to be expanded.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(expandtypeattribute typeattribute_id expand_value)
|
(expandtypeattribute typeattribute_id expand_value)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -258,11 +280,15 @@ option cause the rules involving the type attribute to be expanded.
|
||||||
|
|
||||||
This example uses the expandtypeattribute statement to forcibly expand a previously declared `domain` type attribute.
|
This example uses the expandtypeattribute statement to forcibly expand a previously declared `domain` type attribute.
|
||||||
|
|
||||||
|
```secil
|
||||||
(expandtypeattribute domain true)
|
(expandtypeattribute domain true)
|
||||||
|
```
|
||||||
|
|
||||||
This example uses the expandtypeattribute statement to not expand previously declared `file_type` and `port_type` type attributes regardless of compiler defaults.
|
This example uses the expandtypeattribute statement to not expand previously declared `file_type` and `port_type` type attributes regardless of compiler defaults.
|
||||||
|
|
||||||
|
```secil
|
||||||
(expandtypeattribute (file_type port_type) false)
|
(expandtypeattribute (file_type port_type) false)
|
||||||
|
```
|
||||||
|
|
||||||
typebounds
|
typebounds
|
||||||
----------
|
----------
|
||||||
|
@ -273,7 +299,9 @@ Requires kernel 2.6.28 and above to control the security context associated to t
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(typebounds parent_type_id child_type_id)
|
(typebounds parent_type_id child_type_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -302,6 +330,7 @@ Requires kernel 2.6.28 and above to control the security context associated to t
|
||||||
|
|
||||||
In this example the `httpd.child.process` cannot have `file (write)` due to lack of permissions on `httpd.process` which is the parent. It means the child domain will always have equal or less privileges than the parent:
|
In this example the `httpd.child.process` cannot have `file (write)` due to lack of permissions on `httpd.process` which is the parent. It means the child domain will always have equal or less privileges than the parent:
|
||||||
|
|
||||||
|
```secil
|
||||||
(class file (getattr read write))
|
(class file (getattr read write))
|
||||||
|
|
||||||
(block httpd
|
(block httpd
|
||||||
|
@ -320,6 +349,7 @@ In this example the `httpd.child.process` cannot have `file (write)` due to lack
|
||||||
(allow process httpd.object (file (read write)))
|
(allow process httpd.object (file (read write)))
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
typechange
|
typechange
|
||||||
----------
|
----------
|
||||||
|
@ -328,7 +358,9 @@ The type change rule is used to define a different label of an object for usersp
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(typechange source_type_id target_type_id class_id change_type_id)
|
(typechange source_type_id target_type_id class_id change_type_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -371,6 +403,7 @@ the function will return a context of:
|
||||||
|
|
||||||
` unconfined.object:object_r:unconfined.change_label:s0`
|
` unconfined.object:object_r:unconfined.change_label:s0`
|
||||||
|
|
||||||
|
```secil
|
||||||
(class file (getattr read write))
|
(class file (getattr read write))
|
||||||
|
|
||||||
(block unconfined
|
(block unconfined
|
||||||
|
@ -380,6 +413,7 @@ the function will return a context of:
|
||||||
|
|
||||||
(typechange object object file change_label)
|
(typechange object object file change_label)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
typemember
|
typemember
|
||||||
----------
|
----------
|
||||||
|
@ -388,7 +422,9 @@ The type member rule is used to define a new polyinstantiated label of an object
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(typemember source_type_id target_type_id class_id member_type_id)
|
(typemember source_type_id target_type_id class_id member_type_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -431,6 +467,7 @@ the function will return a context of:
|
||||||
|
|
||||||
` unconfined.object:object_r:unconfined.member_label:s0`
|
` unconfined.object:object_r:unconfined.member_label:s0`
|
||||||
|
|
||||||
|
```secil
|
||||||
(class file (getattr read write))
|
(class file (getattr read write))
|
||||||
|
|
||||||
(block unconfined
|
(block unconfined
|
||||||
|
@ -440,6 +477,7 @@ the function will return a context of:
|
||||||
|
|
||||||
(typemember object object file member_label)
|
(typemember object object file member_label)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
typetransition
|
typetransition
|
||||||
--------------
|
--------------
|
||||||
|
@ -448,7 +486,9 @@ The type transition rule specifies the labeling and object creation allowed betw
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(typetransition source_type_id target_type_id class_id [object_name] default_type_id)
|
(typetransition source_type_id target_type_id class_id [object_name] default_type_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -489,29 +529,35 @@ The type transition rule specifies the labeling and object creation allowed betw
|
||||||
|
|
||||||
This example shows a process transition rule with its supporting [`allow`](cil_access_vector_rules.md#allow) rule:
|
This example shows a process transition rule with its supporting [`allow`](cil_access_vector_rules.md#allow) rule:
|
||||||
|
|
||||||
|
```secil
|
||||||
(macro domain_auto_trans ((type ARG1) (type ARG2) (type ARG3))
|
(macro domain_auto_trans ((type ARG1) (type ARG2) (type ARG3))
|
||||||
; Allow the necessary permissions.
|
; Allow the necessary permissions.
|
||||||
(call domain_trans (ARG1 ARG2 ARG3))
|
(call domain_trans (ARG1 ARG2 ARG3))
|
||||||
; Make the transition occur by default.
|
; Make the transition occur by default.
|
||||||
(typetransition ARG1 ARG2 process ARG3)
|
(typetransition ARG1 ARG2 process ARG3)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
This example shows a file object transition rule with its supporting [`allow`](cil_access_vector_rules.md#allow) rule:
|
This example shows a file object transition rule with its supporting [`allow`](cil_access_vector_rules.md#allow) rule:
|
||||||
|
|
||||||
|
```secil
|
||||||
(macro tmpfs_domain ((type ARG1))
|
(macro tmpfs_domain ((type ARG1))
|
||||||
(type tmpfs)
|
(type tmpfs)
|
||||||
(typeattributeset file_type (tmpfs))
|
(typeattributeset file_type (tmpfs))
|
||||||
(typetransition ARG1 file.tmpfs file tmpfs)
|
(typetransition ARG1 file.tmpfs file tmpfs)
|
||||||
(allow ARG1 tmpfs (file (read write execute execmod)))
|
(allow ARG1 tmpfs (file (read write execute execmod)))
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
This example shows the 'name transition' rule with its supporting [`allow`](cil_access_vector_rules.md#allow) rule:
|
This example shows the 'name transition' rule with its supporting [`allow`](cil_access_vector_rules.md#allow) rule:
|
||||||
|
|
||||||
|
```secil
|
||||||
(macro write_klog ((type ARG1))
|
(macro write_klog ((type ARG1))
|
||||||
(typetransition ARG1 device.device chr_file "__kmsg__" device.klog_device)
|
(typetransition ARG1 device.device chr_file "__kmsg__" device.klog_device)
|
||||||
(allow ARG1 device.klog_device (chr_file (create open write unlink)))
|
(allow ARG1 device.klog_device (chr_file (create open write unlink)))
|
||||||
(allow ARG1 device.device (dir (write add_name remove_name)))
|
(allow ARG1 device.device (dir (write add_name remove_name)))
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
typepermissive
|
typepermissive
|
||||||
--------------
|
--------------
|
||||||
|
@ -520,7 +566,9 @@ Policy database version 23 introduced the permissive statement to allow the name
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(typepermissive source_type_id)
|
(typepermissive source_type_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -545,9 +593,11 @@ Policy database version 23 introduced the permissive statement to allow the name
|
||||||
|
|
||||||
This example will allow SELinux to run the `healthd.process` domain in permissive mode even when enforcing is enabled:
|
This example will allow SELinux to run the `healthd.process` domain in permissive mode even when enforcing is enabled:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block healthd
|
(block healthd
|
||||||
(type process)
|
(type process)
|
||||||
(typepermissive process)
|
(typepermissive process)
|
||||||
|
|
||||||
(allow ...)
|
(allow ...)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
|
@ -8,7 +8,9 @@ Declares an SELinux user identifier in the current namespace.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(user user_id)
|
(user user_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -33,9 +35,11 @@ Declares an SELinux user identifier in the current namespace.
|
||||||
|
|
||||||
This will declare an SELinux user as `unconfined.user`:
|
This will declare an SELinux user as `unconfined.user`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block unconfined
|
(block unconfined
|
||||||
(user user)
|
(user user)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
userrole
|
userrole
|
||||||
--------
|
--------
|
||||||
|
@ -44,7 +48,9 @@ Associates a previously declared [`user`](cil_user_statements.md#user) identifie
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(userrole user_id role_id)
|
(userrole user_id role_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -73,11 +79,13 @@ Associates a previously declared [`user`](cil_user_statements.md#user) identifie
|
||||||
|
|
||||||
This example will associate `unconfined.user` to `unconfined.role`:
|
This example will associate `unconfined.user` to `unconfined.role`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block unconfined
|
(block unconfined
|
||||||
(user user)
|
(user user)
|
||||||
(role role)
|
(role role)
|
||||||
(userrole user role)
|
(userrole user role)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
userattribute
|
userattribute
|
||||||
-------------
|
-------------
|
||||||
|
@ -86,7 +94,9 @@ Declares a user attribute identifier in the current namespace. The identifier ma
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(userattribute userattribute_id)
|
(userattribute userattribute_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -111,9 +121,11 @@ Declares a user attribute identifier in the current namespace. The identifier ma
|
||||||
|
|
||||||
This example will declare a user attribute `users.user_holder` that will have an empty set:
|
This example will declare a user attribute `users.user_holder` that will have an empty set:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block users
|
(block users
|
||||||
(userattribute user_holder)
|
(userattribute user_holder)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
userattributeset
|
userattributeset
|
||||||
----------------
|
----------------
|
||||||
|
@ -122,7 +134,9 @@ Allows the association of one or more previously declared [`user`](cil_user_stat
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(userattributeset userattribute_id (user_id ... | expr ...))
|
(userattributeset userattribute_id (user_id ... | expr ...))
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -161,6 +175,7 @@ Allows the association of one or more previously declared [`user`](cil_user_stat
|
||||||
|
|
||||||
This example will declare three users and two user attributes, then associate all the users to them as shown:
|
This example will declare three users and two user attributes, then associate all the users to them as shown:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block users
|
(block users
|
||||||
(user user_1)
|
(user user_1)
|
||||||
(user user_2)
|
(user user_2)
|
||||||
|
@ -172,6 +187,7 @@ This example will declare three users and two user attributes, then associate al
|
||||||
(userattribute user_holder_all)
|
(userattribute user_holder_all)
|
||||||
(userattributeset user_holder_all (all))
|
(userattributeset user_holder_all (all))
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
userlevel
|
userlevel
|
||||||
---------
|
---------
|
||||||
|
@ -180,7 +196,9 @@ Associates a previously declared [`user`](cil_user_statements.md#user) identifie
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(userlevel user_id level_id)
|
(userlevel user_id level_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -209,6 +227,7 @@ Associates a previously declared [`user`](cil_user_statements.md#user) identifie
|
||||||
|
|
||||||
This example will associate `unconfined.user` with a named [`level`](cil_mls_labeling_statements.md#level) of `systemlow`:
|
This example will associate `unconfined.user` with a named [`level`](cil_mls_labeling_statements.md#level) of `systemlow`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(sensitivity s0)
|
(sensitivity s0)
|
||||||
(level systemlow (s0))
|
(level systemlow (s0))
|
||||||
|
|
||||||
|
@ -218,6 +237,7 @@ This example will associate `unconfined.user` with a named [`level`](cil_mls_lab
|
||||||
; An anonymous example:
|
; An anonymous example:
|
||||||
;(userlevel user (s0))
|
;(userlevel user (s0))
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
userrange
|
userrange
|
||||||
---------
|
---------
|
||||||
|
@ -226,7 +246,9 @@ Associates a previously declared [`user`](cil_user_statements.md#user) identifie
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(userrange user_id levelrange_id)
|
(userrange user_id levelrange_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -255,6 +277,7 @@ Associates a previously declared [`user`](cil_user_statements.md#user) identifie
|
||||||
|
|
||||||
This example will associate `unconfined.user` with a named [`levelrange`](cil_mls_labeling_statements.md#levelrange) of `low_high`, other anonymous examples are also shown:
|
This example will associate `unconfined.user` with a named [`levelrange`](cil_mls_labeling_statements.md#levelrange) of `low_high`, other anonymous examples are also shown:
|
||||||
|
|
||||||
|
```secil
|
||||||
(category c0)
|
(category c0)
|
||||||
(category c1)
|
(category c1)
|
||||||
(categoryorder (c0 c1))
|
(categoryorder (c0 c1))
|
||||||
|
@ -277,6 +300,7 @@ This example will associate `unconfined.user` with a named [`levelrange`](cil_ml
|
||||||
;(userrange user (systemLow (s0 (c0 c1))))
|
;(userrange user (systemLow (s0 (c0 c1))))
|
||||||
;(userrange user ((s0) (s0 (c0 c1))))
|
;(userrange user ((s0) (s0 (c0 c1))))
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
userbounds
|
userbounds
|
||||||
----------
|
----------
|
||||||
|
@ -291,7 +315,9 @@ Notes:
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(userbounds parent_user_id child_user_id)
|
(userbounds parent_user_id child_user_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -320,12 +346,14 @@ Notes:
|
||||||
|
|
||||||
The user `test` cannot have greater privileges than `unconfined.user`:
|
The user `test` cannot have greater privileges than `unconfined.user`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(user test)
|
(user test)
|
||||||
|
|
||||||
(unconfined
|
(unconfined
|
||||||
(user user)
|
(user user)
|
||||||
(userbounds user .test)
|
(userbounds user .test)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
userprefix
|
userprefix
|
||||||
----------
|
----------
|
||||||
|
@ -334,7 +362,9 @@ Declare a user prefix that will be replaced by the file labeling utilities descr
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(userprefix user_id prefix)
|
(userprefix user_id prefix)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -363,10 +393,12 @@ Declare a user prefix that will be replaced by the file labeling utilities descr
|
||||||
|
|
||||||
This example will associate `unconfined.admin` user with a prefix of "[`user`](cil_user_statements.md#user)":
|
This example will associate `unconfined.admin` user with a prefix of "[`user`](cil_user_statements.md#user)":
|
||||||
|
|
||||||
|
```secil
|
||||||
(block unconfined
|
(block unconfined
|
||||||
(user admin
|
(user admin)
|
||||||
(userprefix admin user)
|
(userprefix admin user)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
selinuxuser
|
selinuxuser
|
||||||
-----------
|
-----------
|
||||||
|
@ -375,7 +407,9 @@ Associates a GNU/Linux user to a previously declared [`user`](cil_user_statement
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(selinuxuser user_name user_id userrange_id)
|
(selinuxuser user_name user_id userrange_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -408,10 +442,12 @@ Associates a GNU/Linux user to a previously declared [`user`](cil_user_statement
|
||||||
|
|
||||||
This example will associate `unconfined.admin` user with a GNU / Linux user "`admin_1`":
|
This example will associate `unconfined.admin` user with a GNU / Linux user "`admin_1`":
|
||||||
|
|
||||||
|
```secil
|
||||||
(block unconfined
|
(block unconfined
|
||||||
(user admin)
|
(user admin)
|
||||||
(selinuxuser admin_1 admin low_low)
|
(selinuxuser admin_1 admin low_low)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
||||||
selinuxuserdefault
|
selinuxuserdefault
|
||||||
------------------
|
------------------
|
||||||
|
@ -420,7 +456,9 @@ Declares the default SELinux user. Only one [`selinuxuserdefault`](cil_user_stat
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(selinuxuserdefault user_id userrange_id)
|
(selinuxuserdefault user_id userrange_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -449,7 +487,9 @@ Declares the default SELinux user. Only one [`selinuxuserdefault`](cil_user_stat
|
||||||
|
|
||||||
This example will define the `unconfined.user` as the default SELinux user:
|
This example will define the `unconfined.user` as the default SELinux user:
|
||||||
|
|
||||||
|
```secil
|
||||||
(block unconfined
|
(block unconfined
|
||||||
(user user)
|
(user user)
|
||||||
(selinuxuserdefault user low_low)
|
(selinuxuserdefault user low_low)
|
||||||
)
|
)
|
||||||
|
```
|
||||||
|
|
|
@ -12,7 +12,9 @@ Label i/o memory. This may be a single memory location or a range.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(iomemcon mem_addr|(mem_low mem_high) context_id)
|
(iomemcon mem_addr|(mem_low mem_high) context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -43,7 +45,9 @@ Label i/o memory. This may be a single memory location or a range.
|
||||||
|
|
||||||
An anonymous context for a memory address range of `0xfebe0-0xfebff`:
|
An anonymous context for a memory address range of `0xfebe0-0xfebff`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(iomemcon (1043424 1043455) (unconfined.user object_r unconfined.object low_low))
|
(iomemcon (1043424 1043455) (unconfined.user object_r unconfined.object low_low))
|
||||||
|
```
|
||||||
|
|
||||||
ioportcon
|
ioportcon
|
||||||
---------
|
---------
|
||||||
|
@ -52,7 +56,9 @@ Label i/o ports. This may be a single port or a range.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(ioportcon port|(port_low port_high) context_id)
|
(ioportcon port|(port_low port_high) context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -83,7 +89,9 @@ Label i/o ports. This may be a single port or a range.
|
||||||
|
|
||||||
An anonymous context for a single port of :`0xecc0`:
|
An anonymous context for a single port of :`0xecc0`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(ioportcon 60608 (unconfined.user object_r unconfined.object low_low))
|
(ioportcon 60608 (unconfined.user object_r unconfined.object low_low))
|
||||||
|
```
|
||||||
|
|
||||||
pcidevicecon
|
pcidevicecon
|
||||||
------------
|
------------
|
||||||
|
@ -92,7 +100,9 @@ Label a PCI device.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(pcidevicecon device context_id)
|
(pcidevicecon device context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -121,7 +131,9 @@ Label a PCI device.
|
||||||
|
|
||||||
An anonymous context for a pci device address of `0xc800`:
|
An anonymous context for a pci device address of `0xc800`:
|
||||||
|
|
||||||
|
```secil
|
||||||
(pcidevicecon 51200 (unconfined.user object_r unconfined.object low_low))
|
(pcidevicecon 51200 (unconfined.user object_r unconfined.object low_low))
|
||||||
|
```
|
||||||
|
|
||||||
pirqcon
|
pirqcon
|
||||||
-------
|
-------
|
||||||
|
@ -130,7 +142,9 @@ Label an interrupt level.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(pirqcon irq_level context_id)
|
(pirqcon irq_level context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -159,7 +173,9 @@ Label an interrupt level.
|
||||||
|
|
||||||
An anonymous context for IRQ 33:
|
An anonymous context for IRQ 33:
|
||||||
|
|
||||||
|
```secil
|
||||||
(pirqcon 33 (unconfined.user object_r unconfined.object low_low))
|
(pirqcon 33 (unconfined.user object_r unconfined.object low_low))
|
||||||
|
```
|
||||||
|
|
||||||
devicetreecon
|
devicetreecon
|
||||||
-------------
|
-------------
|
||||||
|
@ -168,7 +184,9 @@ Label device tree nodes.
|
||||||
|
|
||||||
**Statement definition:**
|
**Statement definition:**
|
||||||
|
|
||||||
|
```secil
|
||||||
(devicetreecon path context_id)
|
(devicetreecon path context_id)
|
||||||
|
```
|
||||||
|
|
||||||
**Where:**
|
**Where:**
|
||||||
|
|
||||||
|
@ -197,4 +215,6 @@ Label device tree nodes.
|
||||||
|
|
||||||
An anonymous context for the specified path:
|
An anonymous context for the specified path:
|
||||||
|
|
||||||
|
```secil
|
||||||
(devicetreecon "/this is/a/path" (unconfined.user object_r unconfined.object low_low))
|
(devicetreecon "/this is/a/path" (unconfined.user object_r unconfined.object low_low))
|
||||||
|
```
|
||||||
|
|
Loading…
Reference in a new issue