pax_global_header 0000666 0000000 0000000 00000000064 14762117372 0014524 g ustar 00root root 0000000 0000000 52 comment=8e9157bbeea1899b7b8b257e7eaa71efef3fffed
secilc-3.8.1/ 0000775 0000000 0000000 00000000000 14762117372 0012777 5 ustar 00root root 0000000 0000000 secilc-3.8.1/.gitignore 0000664 0000000 0000000 00000000221 14762117372 0014762 0 ustar 00root root 0000000 0000000 secilc
secilc.8
secil2conf
secil2conf.8
secil2tree
secil2tree.8
policy.*
file_contexts
docs/html
docs/pdf
docs/tmp
opt-actual.bin
opt-actual.cil
secilc-3.8.1/LICENSE 0000664 0000000 0000000 00000003312 14762117372 0014003 0 ustar 00root root 0000000 0000000 All files are licensed under the FreeBSD license, except for third party
components, which are subject to their respective licenses as specified in
their source files.
FreeBSD License
Copyright 2011 Tresys Technology, LLC. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY TRESYS TECHNOLOGY, LLC ``AS IS'' AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
EVENT SHALL TRESYS TECHNOLOGY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Tresys Technology, LLC.
secilc-3.8.1/Makefile 0000664 0000000 0000000 00000004735 14762117372 0014450 0 ustar 00root root 0000000 0000000 PREFIX ?= /usr
BINDIR ?= $(PREFIX)/bin
MANDIR ?= $(PREFIX)/share/man
SECILC = secilc
SECILC_SRCS := secilc.c
SECILC_OBJS := $(patsubst %.c,%.o,$(SECILC_SRCS))
SECIL2CONF = secil2conf
SECIL2CONF_SRCS := secil2conf.c
SECIL2CONF_OBJS := $(patsubst %.c,%.o,$(SECIL2CONF_SRCS))
SECIL2TREE = secil2tree
SECIL2TREE_SRCS := secil2tree.c
SECIL2TREE_OBJS := $(patsubst %.c,%.o,$(SECIL2TREE_SRCS))
SECILC_MANPAGE = secilc.8
SECIL2CONF_MANPAGE = secil2conf.8
SECIL2TREE_MANPAGE = secil2tree.8
XMLTO = xmlto
DIFF = diff
CHECKPOLICY = checkpolicy
POL_VERS = $(shell $(CHECKPOLICY) -V | cut -f 1 -d ' ')
CFLAGS ?= -Wall -Wshadow -Wextra -Wundef -Wmissing-format-attribute -Wcast-align -Wstrict-prototypes -Wpointer-arith -Wunused
override CFLAGS += -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
override LDLIBS += -lsepol
all: $(SECILC) $(SECIL2CONF) $(SECIL2TREE) man
$(SECILC): $(SECILC_OBJS)
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
test: $(SECILC)
./$(SECILC) test/policy.cil
./$(SECILC) -c $(POL_VERS) -O -M 1 -f /dev/null -o opt-actual.bin test/opt-input.cil
$(CHECKPOLICY) -b -C -M -o opt-actual.cil opt-actual.bin >/dev/null
$(DIFF) test/opt-expected.cil opt-actual.cil
$(SECIL2CONF): $(SECIL2CONF_OBJS)
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
$(SECIL2TREE): $(SECIL2TREE_OBJS)
$(CC) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ $^ $(LDLIBS)
man: $(SECILC_MANPAGE) $(SECIL2CONF_MANPAGE) $(SECIL2TREE_MANPAGE)
$(SECILC_MANPAGE): $(SECILC_MANPAGE).xml
$(XMLTO) man $(SECILC_MANPAGE).xml
$(SECIL2CONF_MANPAGE): $(SECIL2CONF_MANPAGE).xml
$(XMLTO) man $(SECIL2CONF_MANPAGE).xml
$(SECIL2TREE_MANPAGE): $(SECIL2TREE_MANPAGE).xml
$(XMLTO) man $(SECIL2TREE_MANPAGE).xml
install: all man
-mkdir -p $(DESTDIR)$(BINDIR)
-mkdir -p $(DESTDIR)$(MANDIR)/man8
install -m 755 $(SECILC) $(DESTDIR)$(BINDIR)
install -m 755 $(SECIL2CONF) $(DESTDIR)$(BINDIR)
install -m 755 $(SECIL2TREE) $(DESTDIR)$(BINDIR)
install -m 644 $(SECILC_MANPAGE) $(DESTDIR)$(MANDIR)/man8
install -m 644 $(SECIL2CONF_MANPAGE) $(DESTDIR)$(MANDIR)/man8
install -m 644 $(SECIL2TREE_MANPAGE) $(DESTDIR)$(MANDIR)/man8
doc:
$(MAKE) -C docs
clean:
rm -f $(SECILC)
rm -f $(SECILC_OBJS)
rm -f $(SECIL2CONF)
rm -f $(SECIL2CONF_OBJS)
rm -f $(SECIL2TREE)
rm -f $(SECIL2TREE_OBJS)
rm -f policy.*
rm -f file_contexts
rm -f $(SECILC_MANPAGE)
rm -f $(SECIL2CONF_MANPAGE)
rm -f $(SECIL2TREE_MANPAGE)
rm -f opt-actual.cil
rm -f opt-actual.bin
$(MAKE) -C docs clean
relabel:
.PHONY: all clean test install doc relabel man
secilc-3.8.1/README 0000664 0000000 0000000 00000003066 14762117372 0013664 0 ustar 00root root 0000000 0000000 SELinux Common Intermediate Language (CIL) Compiler
INTRODUCTION
The SELinux CIL Compiler is a compiler that converts the CIL language as
described on the CIL design wiki into a kernel binary policy file.
Please see the CIL Design Wiki at:
http://github.com/SELinuxProject/cil/wiki/
for more information about the goals and features on the CIL language.
DEPENDENCIES
gcc >= 4.5.1
libsepol >= 2.5
BUILD STEPS
Run "make" with one of the following targets:
make
Build the CIL compiler (secilc).
make test
Pass a sample policy to test with the compiler.
make install
Install the secilc compiler and man page to disk.
make clean
Remove temporary build files.
make man
Build the secilc man page.
make bare
Remove temporary build files and compile binaries.
USAGE
Execute 'secilc' with any number of CIL files as arguments. A binary policy and
file_contexts file will be created.
Use the '--help' option for more details.
DOCUMENTATION
There is a github markdown CIL Reference Guide in the docs directory. To
view the table of contents, see README.md in the docs directory.
To convert the github markdown content to HTML and PDF, change to the docs
directory and run:
make
The documents will be located in the docs/html and docs/pdf directories.
To build the html and pdf, the pandoc package is required.
KNOWN ISSUES
- Blocks inside of macros causes undefined behavior
- Policy must be well formed. For example, invalid usage of
sensitivities/categories/levels may create an unloaded binary
- Recursive limits are not handled
secilc-3.8.1/VERSION 0000664 0000000 0000000 00000000006 14762117372 0014043 0 ustar 00root root 0000000 0000000 3.8.1
secilc-3.8.1/docs/ 0000775 0000000 0000000 00000000000 14762117372 0013727 5 ustar 00root root 0000000 0000000 secilc-3.8.1/docs/Makefile 0000664 0000000 0000000 00000004170 14762117372 0015371 0 ustar 00root root 0000000 0000000 CWD = $(shell pwd)
HTMLDIR = $(CWD)/html
PDFDIR = $(CWD)/pdf
TMPDIR = $(CWD)/tmp
TESTDIR = $(CWD)/../test
# All the markdown files that make up the guide:
FILE_LIST ?= cil_introduction.md \
cil_reference_guide.md \
cil_access_vector_rules.md \
cil_call_macro_statements.md \
cil_class_and_permission_statements.md \
cil_conditional_statements.md \
cil_constraint_statements.md \
cil_container_statements.md \
cil_context_statement.md \
cil_default_object_statements.md \
cil_file_labeling_statements.md \
cil_mls_labeling_statements.md \
cil_network_labeling_statements.md \
cil_policy_config_statements.md \
cil_role_statements.md \
cil_sid_statements.md \
cil_type_statements.md \
cil_user_statements.md \
cil_infiniband_statements.md \
cil_xen_statements.md
PANDOC_FILE_LIST = $(addprefix $(TMPDIR)/,$(FILE_LIST))
PANDOC_HIGHLIGHT_STYLE="theme.theme"
PDF_OUT=CIL_Reference_Guide.pdf
HTML_OUT=CIL_Reference_Guide.html
PANDOC = pandoc
SED ?= sed
OS := $(shell uname)
ifeq ($(OS), Darwin)
SED := gsed
endif
all: html pdf
$(TMPDIR):
mkdir -p $(TMPDIR)
$(TMPDIR)/%.md: %.md | $(TMPDIR)
cp -f $< $(TMPDIR)/
@# Substitute markdown links for conversion into PDF links
$(SED) -i -re 's:(\[`[^`]*`\])\([^#]*([^\)]):\1\(\2:g' $@
$(TMPDIR)/policy.cil: $(TESTDIR)/policy.cil
cp -f $< $@
@# 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```secil' $@
echo '```' >> $@
html: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil secil.xml
mkdir -p $(HTMLDIR)
$(PANDOC) \
--highlight-style=$(PANDOC_HIGHLIGHT_STYLE) \
--syntax-definition=secil.xml \
--standalone \
--metadata title="CIL Reference Guide" \
--metadata document-css=false \
-t html \
$(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil \
-o $(HTMLDIR)/$(HTML_OUT)
pdf: $(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil secil.xml
mkdir -p $(PDFDIR)
$(PANDOC) \
--highlight-style=$(PANDOC_HIGHLIGHT_STYLE) \
--syntax-definition=secil.xml \
--standalone \
--toc \
$(PANDOC_FILE_LIST) $(TMPDIR)/policy.cil \
-o $(PDFDIR)/$(PDF_OUT)
clean:
rm -rf $(HTMLDIR)
rm -rf $(PDFDIR)
rm -rf $(TMPDIR)
secilc-3.8.1/docs/README.md 0000664 0000000 0000000 00000020110 14762117372 0015200 0 ustar 00root root 0000000 0000000 CIL (Common Intermediate Language)
===============
## Table of Contents
* [Introduction](cil_introduction.md#Introduction)
* [Design Philosophy](cil_introduction.md#design-philosophy)
* [Goals and Primary Features](cil_introduction.md#goals-and-primary-features)
* [Design Overview](cil_introduction.md#design-overview)
* [CIL Information](cil_reference_guide.md#cil-information)
* [Declarations](cil_reference_guide.md#declarations)
* [Definitions](cil_reference_guide.md#definitions)
* [Symbol Character Set](cil_reference_guide.md#symbol-character-set)
* [String Character Set](cil_reference_guide.md#string-character-set)
* [Comments](cil_reference_guide.md#comments)
* [Namespaces](cil_reference_guide.md#namespaces)
* [Global Namespace](cil_reference_guide.md#global-namespace)
* [Expressions](cil_reference_guide.md#expressions)
* [Name String](cil_reference_guide.md#name-string)
* [Example CIL Policy](../test/policy.cil)
* [Access Vector Rules](cil_access_vector_rules.md#access-vector-rules)
* [allow](cil_access_vector_rules.md#allow)
* [auditallow](cil_access_vector_rules.md#auditallow)
* [dontaudit](cil_access_vector_rules.md#dontaudit)
* [neverallow](cil_access_vector_rules.md#neverallow)
* [allowx](cil_access_vector_rules.md#allowx)
* [auditallowx](cil_access_vector_rules.md#auditallowx)
* [dontauditx](cil_access_vector_rules.md#dontauditx)
* [neverallowx](cil_access_vector_rules.md#neverallowx)
* [Call / Macro Statements](cil_call_macro_statements.md#call--macro-statements)
* [call](cil_call_macro_statements.md#call)
* [macro](cil_call_macro_statements.md#macro)
* [Class and Permission Statements](cil_class_and_permission_statements.md#class-and-permission-statements)
* [common](cil_class_and_permission_statements.md#common)
* [classcommon](cil_class_and_permission_statements.md#classcommon)
* [class](cil_class_and_permission_statements.md#class)
* [classorder](cil_class_and_permission_statements.md#classorder)
* [classpermission](cil_class_and_permission_statements.md#classpermission)
* [classpermissionset](cil_class_and_permission_statements.md#classpermissionset)
* [classmap](cil_class_and_permission_statements.md#classmap)
* [classmapping](cil_class_and_permission_statements.md#classmapping)
* [permissionx](cil_class_and_permission_statements.md#permissionx)
* [Conditional Statements](cil_conditional_statements.md#conditional-statements)
* [boolean](cil_conditional_statements.md#boolean)
* [booleanif](cil_conditional_statements.md#booleanif)
* [tunable](cil_conditional_statements.md#tunable)
* [tunableif](cil_conditional_statements.md#tunableif)
* [Constraint Statements](cil_constraint_statements.md#constraint-statements)
* [constrain](cil_constraint_statements.md#constrain)
* [validatetrans](cil_constraint_statements.md#validatetrans)
* [mlsconstrain](cil_constraint_statements.md#mlsconstrain)
* [mlsvalidatetrans](cil_constraint_statements.md#mlsvalidatetrans)
* [Container Statements](cil_container_statements.md#container-statements)
* [block](cil_container_statements.md#block)
* [blockabstract](cil_container_statements.md#blockabstract)
* [blockinherit](cil_container_statements.md#blockinherit)
* [optional](cil_container_statements.md#optional)
* [in](cil_container_statements.md#in)
* [Context Statement](cil_context_statement.md#context-statement)
* [context](cil_context_statement.md#context)
* [Default Object Statements](cil_default_object_statements.md#default-object-statements)
* [defaultuser](cil_default_object_statements.md#defaultuser)
* [defaultrole](cil_default_object_statements.md#defaultrole)
* [defaulttype](cil_default_object_statements.md#defaulttype)
* [defaultrange](cil_default_object_statements.md#defaultrange)
* [File Labeling Statements](cil_file_labeling_statements.md#file-labeling-statements)
* [filecon](cil_file_labeling_statements.md#filecon)
* [fsuse](cil_file_labeling_statements.md#fsuse)
* [genfscon](cil_file_labeling_statements.md#genfscon)
* [Multi-Level Security Labeling Statements](cil_mls_labeling_statements.md#multi-level-security-labeling-statements)
* [sensitivity](cil_mls_labeling_statements.md#sensitivity)
* [sensitivityalias](cil_mls_labeling_statements.md#sensitivityalias)
* [sensitivityaliasactual](cil_mls_labeling_statements.md#sensitivityaliasactual)
* [sensitivityorder](cil_mls_labeling_statements.md#sensitivityorder)
* [category](cil_mls_labeling_statements.md#category)
* [categoryalias](cil_mls_labeling_statements.md#categoryalias)
* [categoryaliasactual](cil_mls_labeling_statements.md#categoryaliasactual)
* [categoryorder](cil_mls_labeling_statements.md#categoryorder)
* [categoryset](cil_mls_labeling_statements.md#categoryset)
* [sensitivitycategory](cil_mls_labeling_statements.md#sensitivitycategory)
* [level](cil_mls_labeling_statements.md#level)
* [levelrange](cil_mls_labeling_statements.md#levelrange)
* [rangetransition](cil_mls_labeling_statements.md#rangetransition)
* [mlsconstrain](cil_mls_labeling_statements.md#mlsconstrain)
* [mlsvalidatetrans](cil_mls_labeling_statements.md#mlsvalidatetrans)
* [Network Labeling Statements](cil_network_labeling_statements.md#network-labeling-statements)
* [ipaddr](cil_network_labeling_statements.md#ipaddr)
* [netifcon](cil_network_labeling_statements.md#netifcon)
* [nodecon](cil_network_labeling_statements.md#nodecon)
* [portcon](cil_network_labeling_statements.md#portcon)
* [Policy Configuration Statements](cil_policy_config_statements.md#policy-configuration-statements)
* [mls](cil_policy_config_statements.md#mls)
* [handleunknown](cil_policy_config_statements.md#handleunknown)
* [policycap](cil_policy_config_statements.md#policycap)
* [Role Statements](cil_role_statements.md#role-statements)
* [role](cil_role_statements.md#role)
* [roletype](cil_role_statements.md#roletype)
* [roleattribute](cil_role_statements.md#roleattribute)
* [roleattributeset](cil_role_statements.md#roleattributeset)
* [roleallow](cil_role_statements.md#roleallow)
* [roletransition](cil_role_statements.md#roletransition)
* [rolebounds](cil_role_statements.md#rolebounds)
* [SID Statements](cil_sid_statements.md#sid-statements)
* [sid](cil_sid_statements.md#sid)
* [sidorder](cil_sid_statements.md#sidorder)
* [sidcontext](cil_sid_statements.md#sidcontext)
* [Type Statements](cil_type_statements.md#type-statements)
* [type](cil_type_statements.md#type)
* [typealias](cil_type_statements.md#typealias)
* [typealiasactual](cil_type_statements.md#typealiasactual)
* [typeattribute](cil_type_statements.md#typeattribute)
* [typeattributeset](cil_type_statements.md#typeattributeset)
* [expandtypeattribute](cil_type_statements.md#expandtypeattribute)
* [typebounds](cil_type_statements.md#typebounds)
* [typechange](cil_type_statements.md#typechange)
* [typemember](cil_type_statements.md#typemember)
* [typetransition](cil_type_statements.md#typetransition)
* [typepermissive](cil_type_statements.md#typepermissive)
* [User Statements](cil_user_statements.md#user-statements)
* [user](cil_user_statements.md#user)
* [userrole](cil_user_statements.md#userrole)
* [userattribute](cil_user_statements.md#userattribute)
* [userattributeset](cil_user_statements.md#userattributeset)
* [userlevel](cil_user_statements.md#userlevel)
* [userrange](cil_user_statements.md#userrange)
* [userbounds](cil_user_statements.md#userbounds)
* [userprefix](cil_user_statements.md#userprefix)
* [selinuxuser](cil_user_statements.md#selinuxuser)
* [selinuxuserdefault](cil_user_statements.md#selinuxuserdefault)
* [Infiniband Statements](cil_infiniband_statements.md#infiniband-statements)
* [ibpkeycon](cil_infiniband_statements.md#ibpkeycon)
* [ibendportcon](cil_infiniband_statements.md#ibendportcon)
* [Xen Statements](cil_xen_statements.md#xen-statements)
* [iomemcon](cil_xen_statements.md#iomemcon)
* [ioportcon](cil_xen_statements.md#ioportcon)
* [pcidevicecon](cil_xen_statements.md#pcidevicecon)
* [pirqcon](cil_xen_statements.md#pirqcon)
* [devicetreecon](cil_xen_statements.md#devicetreecon)
* [Example Policy](../test/policy.cil#example-policy)
secilc-3.8.1/docs/cil_access_vector_rules.md 0000664 0000000 0000000 00000027365 14762117372 0021152 0 ustar 00root root 0000000 0000000 Access Vector Rules
===================
Rules involving a source type, a target type, and class permissions or extended permissions.
**Rule definition:**
```secil
(av_flavor source_id target_id|self|notself|other classpermission_id|permissionx_id)
```
**Where:**
av_flavor
|
The flavor of access vector rule. Possible flavors are allow , auditallow , dontaudit , neverallow , deny , allowx , auditallowx , dontauditx , and neverallowx . |
source_id
|
A single previously defined source type , typealias or typeattribute identifier. |
target_id
|
A single previously defined target type , typealias or typeattribute identifier.
Instead it can be one of the special keywords self , notself or other .
The self keyword may be used to signify that source and target are the same. If the source is an attribute, each type of the source will be paired with itself as the target. The notself keyword may be used to signify that the target is all types except for the types of the source. The other keyword may be used as a short-hand way of writing a rule for each type of the source where it is paired with all of the other types of the source as the target. |
classpermission_id
|
A single named or anonymous classpermissionset or a single set of classmap /classmapping identifiers. Used for allow , auditallow , dontaudit , neverallow rules. |
permissionx_id
|
A single named or anonymous permissionx . Used for allowx , auditallowx , dontauditx , neverallowx rules. |
allow
-----
Specifies the access allowed between a source and target type. Note that access may be refined by constraint rules based on the source, target and class ([`validatetrans`](cil_constraint_statements.md#validatetrans) or [`mlsvalidatetrans`](cil_constraint_statements.md#mlsvalidatetrans)) or source, target class and permissions ([`constrain`](cil_constraint_statements.md#constrain) or [`mlsconstrain`](cil_constraint_statements.md#mlsconstrain) statements).
**Rule definition:**
```secil
(allow source_id target_id|self|notself|other classpermissionset_id ...)
```
**Examples:**
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 property_service (set))
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
(classpermission cps_zygote)
(classpermissionset cps_zygote (zygote (not (specifyids))))
(classmap android_classes (set_1 set_2 set_3))
(classmapping android_classes set_1 (binder (all)))
(classmapping android_classes set_1 (property_service (set)))
(classmapping android_classes set_1 (zygote (not (specifycapabilities))))
(classmapping android_classes set_2 (binder (impersonate call set_context_mgr transfer)))
(classmapping android_classes set_2 (zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith)))
(classmapping android_classes set_3 cps_zygote)
(classmapping android_classes set_3 (binder (impersonate call set_context_mgr)))
(block av_rules
(type type_1)
(type type_2)
(type type_3)
(type type_4)
(type type_5)
(typeattribute all_types)
(typeattributeset all_types (all))
; These examples have named and anonymous classpermissionset's and
; classmap/classmapping statements
(allow type_1 self (property_service (set))) ; anonymous
(allow type_2 self (zygote (specifyids))) ; anonymous
(allow type_3 self cps_zygote) ; named
(allow type_4 self (android_classes (set_3))) ; classmap/classmapping
(allow all_types all_types (android_classes (set_2))) ; classmap/classmapping
;; This rule will cause the build to fail unless --disable-neverallow
; (neverallow type_5 all_types (property_service (set)))
(allow type_5 type_5 (property_service (set)))
(allow type_1 all_types (property_service (set)))
)
```
auditallow
----------
Audit the access rights defined if there is a valid allow rule. Note: It does NOT allow access, it only audits the event.
**Rule definition:**
```secil
(auditallow source_id target_id|self|notself|other classpermissionset_id)
```
**Example:**
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)))
(auditallow release_app.process secmark_demo.browser_packet (packet (send recv)))
```
dontaudit
---------
Do not audit the access rights defined when access denied. This stops excessive log entries for known events.
Note that these rules can be omitted by the CIL compiler command line parameter `-D` or `--disable-dontaudit` flags.
**Rule definition:**
```secil
(dontaudit source_id target_id|self|notself|other classpermissionset_id ...)
```
**Example:**
This example will not audit the denied access:
```secil
(dontaudit zygote.process self (capability (fsetid)))
```
neverallow
----------
Never allow access rights defined. This is a compiler enforced action that will stop compilation until the offending rules are modified.
Note that these rules can be over-ridden by the CIL compiler command line parameter `-N` or `--disable-neverallow` flags.
**Rule definition:**
```secil
(neverallow source_id target_id|self|notself|other classpermissionset_id ...)
```
**Example:**
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))
(block av_rules
(type type_1)
(type type_2)
(type type_3)
(typeattribute all_types)
(typeattributeset all_types ((all)))
(neverallow type_3 all_types (property_service (set)))
; This rule will fail compilation:
(allow type_3 self (property_service (set)))
)
```
deny
----------
Remove the access rights defined from any matching allow rules. These rules are processed before [`neverallow`](cil_access_vector_rules.md#neverallow) checking.
**Rule definition:**
```secil
(deny source_id target_id|self classpermissionset_id ...)
```
**Example:**
```secil
(class class1 (perm1 perm2))
(type type1)
(type type2)
(allow type1 type2 (class1 (perm1))) ; Allow-1
(deny type1 type2 (class1 (perm1))) ; Deny-1
; Allow-1 will be complete removed by Deny-1.
(type type3)
(type type4)
(allow type3 type4 (class1 (perm1 perm2))) ; Allow-2
(deny type3 type4 (class1 (perm1))) ; Deny-2
; Allow-2 will be removed and replaced with the following when Deny-2 is evaluated
; (allow type3 type4 (class1 (perm2)))
(type type5)
(type type6)
(typeattribute attr1)
(typeattributeset attr1 (type5 type6))
(allow attr1 attr1 (class1 (perm1))) ; Allow-3
(deny type5 type6 (class1 (perm1))) ; Deny-3
; Allow-3 will be removed and replaced with the following when Deny-3 is evaluated
; (allow type6 attr1 (class1 (perm1)))
; (allow type5 type5 (class1 (perm1)))
```
allowx
------
Specifies the access allowed between a source and target type using extended permissions. Unlike the [`allow`](cil_access_vector_rules.md#allow) statement, the statements [`validatetrans`](cil_constraint_statements.md#validatetrans), [`mlsvalidatetrans`](cil_constraint_statements.md#mlsvalidatetrans), [`constrain`](cil_constraint_statements.md#constrain), and [`mlsconstrain`](cil_constraint_statements.md#mlsconstrain) do not limit accesses granted by [`allowx`](cil_access_vector_rules.md#allowx).
Note that for this to work there must *also* be valid equivalent [`allow`](cil_access_vector_rules.md#allow) rules present.
**Rule definition:**
```secil
(allowx source_id target_id|self|notself|other permissionx_id)
```
**Examples:**
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
(allowx type_1 type_2 (ioctl tcp_socket (range 0x2000 0x20FF)))
(permissionx ioctl_nodebug (ioctl udp_socket (not (range 0x4000 0x4010))))
(allow type_3 type_4 (udp_socket (ioctl))) ;; pre-requisite
(allowx type_3 type_4 ioctl_nodebug)
```
auditallowx
-----------
Audit the access rights defined if there is a valid [`allowx`](cil_access_vector_rules.md#allowx) rule. It does NOT allow access, it only audits the event.
Note that for this to work there must *also* be valid equivalent [`auditallow`](cil_access_vector_rules.md#auditallow) rules present.
**Rule definition:**
```secil
(auditallowx source_id target_id|self|notself|other permissionx_id)
```
**Examples:**
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)))
(auditallow type_1 type_2 (tcp_socket (ioctl))) ;; pre-requisite
(auditallowx type_1 type_2 (ioctl tcp_socket (range 0x2005 0x2010)))
```
dontauditx
----------
Do not audit the access rights defined when access denied. This stops excessive log entries for known events.
Note that for this to work there must *also* be at least one [`allowx`](cil_access_vector_rules.md#allowx) rule associated with the target type.
Note that these rules can be omitted by the CIL compiler command line parameter `-D` or `--disable-dontaudit` flags.
**Rule definition:**
```secil
(dontauditx source_id target_id|self|notself|other permissionx_id)
```
**Examples:**
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
(dontauditx type_1 type_2 (ioctl tcp_socket (range 0x3000 0x30FF)))
```
neverallowx
----------
Never allow access rights defined for extended permissions. This is a compiler enforced action that will stop compilation until the offending rules are modified.
Note that these rules can be over-ridden by the CIL compiler command line parameter `-N` or `--disable-neverallow` flags.
**Rule definition:**
```secil
(neverallowx source_id target_id|self|notself|other permissionx_id)
```
**Examples:**
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))
(block av_rules
(type type_1)
(type type_2)
(type type_3)
(typeattribute all_types)
(typeattributeset all_types ((all)))
(neverallowx type_3 all_types (ioctl property_service (range 0x2000 0x20FF)))
; This rule will fail compilation:
(allowx type_3 self (ioctl property_service (0x20A0)))
)
```
secilc-3.8.1/docs/cil_call_macro_statements.md 0000664 0000000 0000000 00000014346 14762117372 0021453 0 ustar 00root root 0000000 0000000 Call / Macro Statements
=======================
call
----
Instantiate a [macro](#macro) within the current namespace. There may be zero or more parameters passed to the macro (with zero parameters this is similar to the [`blockinherit`](cil_container_statements.md#blockinherit) ([`call`](cil_call_macro_statements.md#call)) / [`blockabstract`](cil_container_statements.md#blockabstract) ([`macro`](cil_call_macro_statements.md#macro)) statements).
Each parameter passed contains an argument to be resolved by the [macro](#macro), these can be named or anonymous but must conform to the parameter types defined in the [`macro`](cil_call_macro_statements.md#macro) statement.
Macro rules are resolved by searching in the following order:
- The macro namespace (If found this means that the name was declared in the macro and is now declared in the namespace of one of the parents of the call.)
- The call arguments
- The parent namespaces of the macro being called (if any) with the exception of the global namespace.
- The parent namespaces of the call (if any) with the exception of the global namespace.
- The global namespace
**Statement definition:**
```secil
(call macro_id [(param ...)])
```
**Where:**
call
|
The call keyword. |
macro_id
|
The identifier of the macro to be instantiated. |
param
|
Zero or more parameters that are passed to the macro. |
**Example:**
See the [`macro`](cil_call_macro_statements.md#macro) statement for an example.
macro
-----
Declare a macro in the current namespace with its associated parameters. The macro identifier is used by the [`call`](cil_call_macro_statements.md#call) statement to instantiate the macro and resolve any parameters. The call statement may be within the body of a macro.
[`tunable`](cil_conditional_statements.md#tunable), [`in`](cil_container_statements.md#in), [`block`](cil_container_statements.md#block), [`blockinherit`](cil_container_statements.md#blockinherit), [`blockabstract`](cil_container_statements.md#blockabstract), and other [`macro`](cil_call_macro_statements.md#macro) statements are not allowed in [`macro`](cil_call_macro_statements.md#macro) blocks.
Duplicate [`macro`](cil_call_macro_statements.md#macro) declarations in the same namespace will normally cause an error, but inheriting a macro into a namespace (with [`blockinherit`](cil_container_statements.md#blockinherit)) that already has a macro with the same name will only result in a warning message and not cause an error. This behavior allows inherited macros to be overridden with local ones.
**Statement definition:**
```secil
(macro macro_id ([(param_type param_id) ...])
cil_statements
...
)
```
**Where:**
macro
|
The macro keyword. |
macro_id
|
The macro identifier. |
param_type
|
Zero or more parameters that are passed to the macro. The param_type is a keyword used to determine the declaration type (e.g. type , class , categoryset ).
The list of valid param_type entries are: string , name , type , role , user , sensitivity , category , bool , categoryset , level , levelrange , ipaddr , class , classmap , and classpermission .
The param_types categoryset , level , levelrange , classpermission , and ipaddr can by named or anonymous.
The param_types type , role , and user can be used for attributes.
The param_types type , sensitivity and category can be used for aliases.
The param_types name and string can be used interchangeably for an object_name in [`typetransition`](cil_type_statements.md#typetransition) and the path in [`filecon`](cil_file_labeling_statements.md#filecon) statements. |
param_id
|
The parameter identifier used to reference the entry within the macro body (e.g. ARG1 ). |
cil_statement
|
Zero or more valid CIL statements. |
**Examples:**
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
(call binder_call (appdomain binderservicedomain))
)
(macro binder_call ((type ARG1) (type ARG2))
(allow ARG1 ARG2 (binder (call transfer)))
(allow ARG2 ARG1 (binder (transfer)))
(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:
```secil
(block unconfined
(call add_type)
....
(macro add_type ()
(type exec)
)
)
```
This example passes an anonymous and named IP address to the macro:
```secil
(ipaddr netmask_1 255.255.255.0)
(context netlabel_1 (system.user object_r unconfined.object low_low))
(call build_nodecon ((192.168.1.64) netmask_1))
(macro build_nodecon ((ipaddr ARG1) (ipaddr ARG2))
(nodecon ARG1 ARG2 netlabel_1)
)
```
secilc-3.8.1/docs/cil_class_and_permission_statements.md 0000664 0000000 0000000 00000045666 14762117372 0023567 0 ustar 00root root 0000000 0000000 Class and Permission Statements
===============================
common
------
Declares a common identifier in the current namespace with a set of common permissions that can be used by one or more [`class`](cil_class_and_permission_statements.md#class) identifiers. The [`classcommon`](cil_class_and_permission_statements.md#classcommon) statement is used to associate a [`common`](cil_class_and_permission_statements.md#common) identifier to a specific [`class`](cil_class_and_permission_statements.md#class) identifier.
**Statement definition:**
```secil
(common common_id (permission_id ...))
```
**Where:**
common
|
The common keyword. |
common_id
|
The common identifier. |
permission_id
|
One or more permissions. |
**Example:**
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))
```
classcommon
-----------
Associate a [`class`](cil_class_and_permission_statements.md#class) identifier to a one or more permissions declared by a [`common`](cil_class_and_permission_statements.md#common) identifier.
**Statement definition:**
```secil
(classcommon class_id common_id)
```
**Where:**
classcommon
|
The classcommon keyword. |
class_id
|
A single previously declared class identifier. |
common_id
|
A single previously declared common identifier that defines the common permissions for that class. |
**Example:**
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))
(classcommon dir file)
```
class
-----
Declares a class and zero or more permissions in the current namespace.
**Statement definition:**
```secil
(class class_id (permission_id ...))
```
**Where:**
class
|
The class keyword. |
class_id
|
The class identifier. |
permission_id
|
Zero or more permissions declared for the class. Note that if zero permissions, an empty list is required as shown in the example. |
**Examples:**
This example defines a set of permissions for the `binder` class identifier:
```secil
(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):
```secil
(common ipc (create destroy getattr setattr read write associate unix_read unix_write))
(classcommon sem ipc)
(class sem ())
```
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))
```
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))
(classcommon dir file)
(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:
```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))
```
classorder
----------
Defines the order of [class](#class)'s. This is a mandatory statement. Multiple [`classorder`](cil_class_and_permission_statements.md#classorder) statements declared in the policy will form an ordered list.
**Statement definition:**
```secil
(classorder (class_id ...))
```
**Where:**
classorder
|
The classorder keyword. |
class_id
|
One or more class identifiers. |
**Example:**
This will produce an ordered list of "`file dir process`"
```secil
(class process)
(class file)
(class dir)
(classorder (file dir))
(classorder (dir process))
```
**Unordered Classorder Statement:**
If users do not have knowledge of the existing [`classorder`](#classorder), the `unordered` keyword may be used in a [`classorder`](#classorder) statement. The [classes](#class) in an unordered statement are appended to the existing [`classorder`](#classorder). A class in an ordered statement always supersedes the class redeclaration in an unordered statement. The `unordered` keyword must be the first item in the [`classorder`](#classorder) listing.
**Example:**
This will produce an unordered list of "`file dir foo a bar baz`"
```secil
(class file)
(class dir)
(class foo)
(class bar)
(class baz)
(class a)
(classorder (file dir))
(classorder (dir foo))
(classorder (unordered a))
(classorder (unordered bar foo baz))
```
classpermission
---------------
Declares a class permission set identifier in the current namespace that can be used by one or more [`classpermissionset`](cil_class_and_permission_statements.md#classpermissionset)s to associate one or more classes and permissions to form a named set.
**Statement definition:**
```secil
(classpermission classpermissionset_id)
```
**Where:**
classpermission
|
The classpermission keyword. |
classpermissionset_id
|
The classpermissionset identifier. |
**Example:**
See the [`classpermissionset`](cil_class_and_permission_statements.md#classpermissionset) statement for examples.
classpermissionset
------------------
Defines a class permission set identifier in the current namespace that associates a class and one or more permissions to form a named set. Nested expressions may be used to determine the required permissions as shown in the examples. Anonymous [`classpermissionset`](cil_class_and_permission_statements.md#classpermissionset)s may be used in av rules and constraints.
**Statement definition:**
```secil
(classpermissionset classpermissionset_id (class_id (permission_id | expr ...)))
```
**Where:**
classpermissionset
|
The classpermissionset keyword. |
classpermissionset_id
|
The classpermissionset identifier. |
class_id
|
A single previously declared class identifier. |
permission_id
|
Zero or more permissions required by the class.
Note that there must be at least one permission identifier or expr declared). |
expr
|
Zero or more expr 's, the valid operators and syntax are:
(and (permission_id ...) (permission_id ...))
(or (permission_id ...) (permission_id ...))
(xor (permission_id ...) (permission_id ...))
(not (permission_id ...))
(all)
|
**Examples:**
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))
(type test_1)
(type test_2)
(type test_3)
(type test_4)
(type test_5)
; NOT
(classpermission zygote_1)
(classpermissionset zygote_1 (zygote
(not
(specifyinvokewith specifyseinfo)
)
))
(allow unconfined.process test_1 zygote_1)
;; allow unconfined.process test_1 : zygote { specifyids specifyrlimits specifycapabilities } ;
; AND - ALL - NOT - Equiv to test_1
(classpermission zygote_2)
(classpermissionset zygote_2 (zygote
(and
(all)
(not (specifyinvokewith specifyseinfo))
)
))
(allow unconfined.process test_2 zygote_2)
;; allow unconfined.process test_2 : zygote { specifyids specifyrlimits specifycapabilities } ;
; OR
(classpermission zygote_3)
(classpermissionset zygote_3 (zygote ((or (specifyinvokewith) (specifyseinfo)))))
(allow unconfined.process test_3 zygote_3)
;; allow unconfined.process test_3 : zygote { specifyinvokewith specifyseinfo } ;
; XOR - This will not produce an allow rule as the XOR will remove all the permissions:
(classpermission zygote_4)
(classpermissionset zygote_4 (zygote (xor (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo) (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))))
; ALL
(classpermission zygote_all_perms)
(classpermissionset zygote_all_perms (zygote (all)))
(allow unconfined.process test_5 zygote_all_perms)
;; allow unconfined.process test_5 : zygote { specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo } ;
```
classmap
--------
Declares a class map identifier in the current namespace and one or more class mapping identifiers. This will allow:
1. Multiple [`classpermissionset`](cil_class_and_permission_statements.md#classpermissionset)s to be linked to a pair of [`classmap`](cil_class_and_permission_statements.md#classmap) / [`classmapping`](cil_class_and_permission_statements.md#classmapping) identifiers.
2. Multiple [`class`](cil_class_and_permission_statements.md#class)s to be associated to statements and rules that support a list of classes:
typetransition
typechange
typemember
rangetransition
roletransition
defaultuser
defaultrole
defaulttype
defaultrange
validatetrans
mlsvalidatetrans
**Statement definition:**
```secil
(classmap classmap_id (classmapping_id ...))
```
**Where:**
classmap
|
The classmap keyword. |
classmap_id
|
The classmap identifier. |
classmapping_id
|
One or more classmapping identifiers. |
**Example:**
See the [`classmapping`](cil_class_and_permission_statements.md#classmapping) statement for examples.
classmapping
------------
Define sets of [`classpermissionset`](cil_class_and_permission_statements.md#classpermissionset)s (named or anonymous) to form a consolidated [`classmapping`](cil_class_and_permission_statements.md#classmapping) set. Generally there are multiple [`classmapping`](cil_class_and_permission_statements.md#classmapping) statements with the same [`classmap`](cil_class_and_permission_statements.md#classmap) and [`classmapping`](cil_class_and_permission_statements.md#classmapping) identifiers that form a set of different [`classpermissionset`](cil_class_and_permission_statements.md#classpermissionset)'s. This is useful when multiple class / permissions are required in rules such as the [`allow`](cil_access_vector_rules.md#allow) rules (as shown in the examples).
**Statement definition:**
```secil
(classmapping classmap_id classmapping_id classpermissionset_id)
```
**Where:**
classmapping
|
The classmapping keyword. |
classmap_id
|
A single previously declared classmap identifier. |
classmapping_id
|
The classmapping identifier. |
classpermissionset_id
|
A single named classpermissionset identifier or a single anonymous classpermissionset using expr 's as required (see the classpermissionset statement). |
**Examples:**
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 property_service (set))
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
(classpermission cps_zygote)
(classpermissionset cps_zygote (zygote (not (specifyids))))
(classmap android_classes (set_1 set_2 set_3))
(classmapping android_classes set_1 (binder (all)))
(classmapping android_classes set_1 (property_service (set)))
(classmapping android_classes set_1 (zygote (not (specifycapabilities))))
(classmapping android_classes set_2 (binder (impersonate call set_context_mgr transfer)))
(classmapping android_classes set_2 (zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith)))
(classmapping android_classes set_3 cps_zygote)
(classmapping android_classes set_3 (binder (impersonate call set_context_mgr)))
(block map_example
(type type_1)
(type type_2)
(type type_3)
(allow type_1 self (android_classes (set_1)))
(allow type_2 self (android_classes (set_2)))
(allow type_3 self (android_classes (set_3)))
)
; The above will resolve to the following AV rules:
;; allow map_example.type_1 map_example.type_1 : binder { impersonate call set_context_mgr transfer receive } ;
;; allow map_example.type_1 map_example.type_1 : property_service set ;
;; allow map_example.type_1 map_example.type_1 : zygote { specifyids specifyrlimits specifyinvokewith specifyseinfo } ;
;; allow map_example.type_2 map_example.type_2 : binder { impersonate call set_context_mgr transfer } ;
;; allow map_example.type_2 map_example.type_2 : zygote { specifyids specifyrlimits specifycapabilities specifyinvokewith } ;
;; 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 } ;
```
permissionx
-----------
Defines a named extended permission, which can be used in the [`allowx`](cil_access_vector_rules.md#allowx), [`auditallowx`](cil_access_vector_rules.md#auditallowx), [`dontauditx`](cil_access_vector_rules.md#dontauditx), and [`neverallowx`](cil_access_vector_rules.md#neverallowx) statements.
**Statement definition:**
```secil
(permissionx permissionx_id (kind class_id (permission ... | expr ...)))
```
**Where:**
permissionx
|
The permissionx keyword. |
kind
|
A keyword specifying how to interpret the extended permission values. Must be one of:
ioctl |
Permissions define a whitelist of ioctl values. Permission values must range from 0x0000 to 0xFFFF , inclusive. |
|
class_id
|
A single previously declared class or classmap identifier. |
permission
|
One or more numeric values, specified in decimal, or hexadecimal if prefixed with 0x, or octal if prefixed with 0. Values are interpreted based on the value of kind . |
expr
|
An expression, with valid operators and syntax:
(range (permission ...) (permission ...))
(and (permission ...) (permission ...))
(or (permission ...) (permission ...))
(xor (permission ...) (permission ...))
(not (permission ...))
(all)
|
**Examples:**
```secil
(permissionx ioctl_1 (ioctl tcp_socket (0x2000 0x3000 0x4000)))
(permissionx ioctl_2 (ioctl tcp_socket (range 0x6000 0x60FF)))
(permissionx ioctl_3 (ioctl tcp_socket (and (range 0x8000 0x90FF) (not (range 0x8100 0x82FF)))))
```
secilc-3.8.1/docs/cil_conditional_statements.md 0000664 0000000 0000000 00000020341 14762117372 0021652 0 ustar 00root root 0000000 0000000 Conditional Statements
======================
boolean
-------
Declares a run time boolean as true or false in the current namespace. The [`booleanif`](cil_conditional_statements.md#booleanif) statement contains the CIL code that will be in the binary policy file.
[`boolean`](cil_conditional_statements.md#boolean) are not allowed in [`booleanif`](cil_conditional_statements.md#booleanif) blocks.
**Statement definition:**
```secil
(boolean boolean_id true|false)
```
**Where:**
boolean
|
The boolean keyword. |
boolean_id
|
The boolean identifier. |
true | false
|
The initial state of the boolean. This can be changed at run time using setsebool (8) and its status queried using getsebool (8) . |
**Example:**
See the [`booleanif`](cil_conditional_statements.md#booleanif) statement for an example.
booleanif
---------
Contains the run time conditional statements that are instantiated in the binary policy according to the computed boolean identifier(s) state.
[`call`](cil_call_macro_statements.md#call) statements are allowed within a [`booleanif`](cil_conditional_statements.md#booleanif), however the contents of the resulting macro must be limited to those of the [`booleanif`](cil_conditional_statements.md#booleanif) statement (i.e. [`allow`](cil_access_vector_rules.md#allow), [`auditallow`](cil_access_vector_rules.md#auditallow), [`dontaudit`](cil_access_vector_rules.md#dontaudit), [`typemember`](cil_type_statements.md#typemember), [`typetransition`](cil_type_statements.md#typetransition), [`typechange`](cil_type_statements.md#typechange) and the compile time [`tunableif`](cil_conditional_statements.md#tunableif) statement)).
**Statement definition:**
```secil
(booleanif boolean_id | expr ...
(true
cil_statements
...)
(false
cil_statements
...)
)
```
**Where:**
booleanif
|
The booleanif keyword. |
boolean_id
|
Either a single boolean identifier or one or more expr 's. |
expr
|
Zero or more expr 's, the valid operators and syntax are:
(and boolean_id boolean_id)
(or boolean_id boolean_id)
(xor boolean_id boolean_id)
(eq boolean_id boolean_id)
(neq boolean_id boolean_id)
(not boolean_id)
|
true
|
An optional set of CIL statements that will be instantiated when the boolean is evaluated as true . |
false
|
An optional set of CIL statements that will be instantiated when the boolean is evaluated as false . |
**Examples:**
The second example also shows the kernel policy language equivalent:
```secil
(boolean disableAudio false)
(booleanif disableAudio
(false
(allow process mediaserver.audio_device (chr_file_set (rw_file_perms)))
)
)
(boolean disableAudioCapture false)
;;; if(!disableAudio && !disableAudioCapture) {
(booleanif (and (not disableAudio) (not disableAudioCapture))
(true
(allow process mediaserver.audio_capture_device (chr_file_set (rw_file_perms)))
)
)
```
tunable
-------
Tunables are similar to booleans, however they are used to manage areas of CIL statements that may or may not be in the final CIL policy that will be compiled (whereas booleans are embedded in the binary policy and can be enabled or disabled during run-time).
Note that tunables can be treated as booleans by the CIL compiler command line parameter `-P` or `--preserve-tunables` flags.
Since [`tunableif`](cil_conditional_statements.md#tunableif) statements are resolved first, [`tunable`](cil_conditional_statements.md#tunable) statements are not allowed in [`in`](cil_container_statements.md#in), [`macro`](cil_call_macro_statements.md#macro), [`optional`](cil_container_statements.md#optional), and [`booleanif`](cil_conditional_statements.md#booleanif) blocks. To simplify processing, they are also not allowed in [`tunableif`](cil_conditional_statements.md#tunableif) blocks.
**Statement definition:**
```secil
(tunable tunable_id true|false)
```
**Where:**
tunable
|
The tunable keyword. |
tunable_id
|
The tunable identifier. |
true | false
|
The initial state of the tunable . |
**Example:**
See the [`tunableif`](cil_conditional_statements.md#tunableif) statement for an example.
tunableif
---------
Compile time conditional statement that may or may not add CIL statements to be compiled.
If tunables are being treated as booleans (by using the CIL compiler command line parameter `-P` or `--preserve-tunables` flag), then only the statements allowed in a [`booleanif`](cil_conditional_statements.md#booleanif) block are allowed in a [`tunableif`](cil_conditional_statements.md#tunableif) block. Otherwise, [`tunable`](cil_conditional_statements.md#tunable) statements are not allowed in a [`tunableif`](cil_conditional_statements.md#tunableif) block.
**Statement definition:**
```secil
(tunableif tunable_id | expr ...
(true
cil_statements
...)
(false
cil_statements
...)
)
```
**Where:**
tunableif
|
The tunableif keyword. |
tunable_id
|
Either a single tunable identifier or one or more expr 's. |
expr
|
Zero or more expr 's, the valid operators and syntax are:
(and tunable_id tunable_id)
(or tunable_id tunable_id)
(xor tunable_id tunable_id)
(eq tunable_id tunable_id)
(neq tunable_id tunable_id)
(not tunable_id)
|
true
|
An optional set of CIL statements that will be instantiated when the tunable is evaluated as true . |
false
|
An optional set of CIL statements that will be instantiated when the tunable is evaluated as false . |
**Example:**
This example will not add the range transition rule to the binary policy:
```secil
(tunable range_trans_rule false)
(block init
(class process (process))
(type process)
(tunableif range_trans_rule
(true
(rangetransition process sshd.exec process low_high)
)
) ; End tunableif
) ; End block
```
secilc-3.8.1/docs/cil_constraint_statements.md 0000664 0000000 0000000 00000027050 14762117372 0021537 0 ustar 00root root 0000000 0000000 Constraint Statements
=====================
constrain
---------
Enable constraints to be placed on the specified permissions of the object class based on the source and target security context components.
**Statement definition:**
```secil
(constrain classpermissionset_id ... expression | expr ...)
```
**Where:**
constrain
|
The constrain keyword. |
classpermissionset_id
|
A single named or anonymous classpermissionset or a single set of classmap /classmapping identifiers. |
expression
|
There must be one constraint expression or one or more expr 's. The expression consists of an operator and two operands as follows:
(op u1 u2)
(role_op r1 r2)
(op t1 t2)
(op u1 user_id | (user_id ...))
(op u2 user_id | (user_id ...))
(op r1 role_id | (role_id ...))
(op r2 role_id | (role_id ...))
(op t1 type_id | (type_id ...))
(op t2 type_id | (type_id ...))
where:
u1, r1, t1 = Source context: user, role or type
u2, r2, t2 = Target context: user, role or type
and:
op : eq neq
role_op : eq neq dom domby incomp
user_id : A single user or userattribute identifier.
role_id : A single role or roleattribute identifier.
type_id : A single type, typealias or typeattribute identifier.
|
expr
|
Zero or more expr 's, the valid operators and syntax are:
(and expression expression)
(or expression expression)
(not expression)
|
**Examples:**
Two constrain statements are shown with their equivalent kernel policy language statements:
```secil
;; constrain { file } { write }
;; (( t1 == unconfined.process ) and ( t2 == unconfined.object ) or ( r1 eq r2 ));
(constrain (file (write))
(or
(and
(eq t1 unconfined.process)
(eq t2 unconfined.object)
)
(eq r1 r2)
)
)
;; constrain { file } { read }
;; (not( t1 == unconfined.process ) and ( t2 == unconfined.object ) or ( r1 eq r2 ));
(constrain (file (read))
(not
(or
(and
(eq t1 unconfined.process)
(eq t2 unconfined.object)
)
(eq r1 r2)
)
)
)
```
validatetrans
-------------
The [`validatetrans`](cil_constraint_statements.md#validatetrans) statement is only used for `file` related object classes where it is used to control the ability to change the objects security context based on old, new and the current process security context.
**Statement definition:**
```secil
(validatetrans class_id expression | expr ...)
```
**Where:**
validatetrans
|
The validatetrans keyword. |
class_id
|
A single previously declared class or classmap identifier. |
expression
|
There must be one constraint expression or one or more expr 's. The expression consists of an operator and two operands as follows:
(op u1 u2)
(role_op r1 r2)
(op t1 t2)
(op u1 user_id)
(op u2 user_id)
(op u3 user_id)
(op r1 role_id)
(op r2 role_id)
(op r3 role_id)
(op t1 type_id)
(op t2 type_id)
(op t3 type_id)
where:
u1, r1, t1 = Old context: user, role or type
u2, r2, t2 = New context: user, role or type
u3, r3, t3 = Process context: user, role or type
and:
op : eq neq
role_op : eq neq dom domby incomp
user_id : A single user or userattribute identifier.
role_id : A single role or roleattribute identifier.
type_id : A single type, typealias or typeattribute identifier.
|
expr
|
Zero or more expr 's, the valid operators and syntax are:
(and expression expression)
(or expression expression)
(not expression)
|
**Example:**
A validate transition statement with the equivalent kernel policy language statement:
```secil
; validatetrans { file } ( t1 == unconfined.process );
(validatetrans file (eq t1 unconfined.process))
```
mlsconstrain
------------
Enable MLS constraints to be placed on the specified permissions of the object class based on the source and target security context components.
**Statement definition:**
```secil
(mlsconstrain classpermissionset_id ... expression | expr ...)
```
**Where:**
mlsconstrain
|
The mlsconstrain keyword. |
classpermissionset_id
|
A single named or anonymous classpermissionset or a single set of classmap /classmapping identifiers. |
expression
|
There must be one constraint expression or one or more expr 's. The expression consists of an operator and two operands as follows:
(op u1 u2)
(mls_role_op r1 r2)
(op t1 t2)
(mls_role_op l1 l2)
(mls_role_op l1 h2)
(mls_role_op h1 l2)
(mls_role_op h1 h2)
(mls_role_op l1 h1)
(mls_role_op l2 h2)
(op u1 user_id)
(op u2 user_id)
(op r1 role_id)
(op r2 role_id)
(op t1 type_id)
(op t2 type_id)
where:
u1, r1, t1, l1, h1 = Source context: user, role, type, low level or high level
u2, r2, t2, l2, h2 = Target context: user, role, type, low level or high level
and:
op : eq neq
mls_role_op : eq neq dom domby incomp
user_id : A single user or userattribute identifier.
role_id : A single role or roleattribute identifier.
type_id : A single type, typealias or typeattribute identifier.
|
expr
|
Zero or more expr 's, the valid operators and syntax are:
(and expression expression)
(or expression expression)
(not expression)
|
**Example:**
An MLS constrain statement with the equivalent kernel policy language statement:
```secil
;; mlsconstrain { file } { open }
;; (( l1 eq l2 ) and ( u1 == u2 ) or ( r1 != r2 ));
(mlsconstrain (file (open))
(or
(and
(eq l1 l2)
(eq u1 u2)
)
(neq r1 r2)
)
)
```
mlsvalidatetrans
----------------
The [`mlsvalidatetrans`](cil_constraint_statements.md#mlsvalidatetrans) statement is only used for `file` related object classes where it is used to control the ability to change the objects security context based on old, new and the current process security context.
**Statement definition:**
```secil
(mlsvalidatetrans class_id expression | expr ...)
```
**Where:**
mlsvalidatetrans
|
The mlsvalidatetrans keyword. |
class_id
|
A single previously declared class or classmap identifier. |
expression
|
There must be one constraint expression or one or more expr 's. The expression consists of an operator and two operands as follows:
(op u1 u2)
(mls_role_op r1 r2)
(op t1 t2)
(mls_role_op l1 l2)
(mls_role_op l1 h2)
(mls_role_op h1 l2)
(mls_role_op h1 h2)
(mls_role_op l1 h1)
(mls_role_op l2 h2)
(op u1 user_id)
(op u2 user_id)
(op u3 user_id)
(op r1 role_id)
(op r2 role_id)
(op r3 role_id)
(op t1 type_id)
(op t2 type_id)
(op t3 type_id)
where:
u1, r1, t1, l1, h1 = Source context: user, role, type, low level or high level
u2, r2, t2, l2, h2 = Target context: user, role, type, low level or high level
u3, r3, t3 = Process context: user, role or type
and:
op : eq neq
mls_role_op : eq neq dom domby incomp
user_id : A single user or userattribute identifier.
role_id : A single role or roleattribute identifier.
type_id : A single type, typealias or typeattribute identifier.
|
expr
|
Zero or more expr 's, the valid operators and syntax are:
(and expression expression)
(or expression expression)
(not expression)
|
**Example:**
An MLS validate transition statement with the equivalent kernel policy language statement:
```secil
;; mlsvalidatetrans { file } ( l1 domby h2 );
(mlsvalidatetrans file (domby l1 h2))
```
secilc-3.8.1/docs/cil_container_statements.md 0000664 0000000 0000000 00000026207 14762117372 0021340 0 ustar 00root root 0000000 0000000 Container Statements
====================
block
-----
Start a new namespace.
Not allowed in [`macro`](cil_call_macro_statements.md#macro) and [`optional`](cil_container_statements.md#optional) blocks.
[`sensitivity`](cil_mls_labeling_statements.md#sensitivity) and [`category`](cil_mls_labeling_statements.md#category) statements are not allowed in [`block`](cil_container_statements.md#block) blocks.
Duplicate declarations of a [`block`](cil_container_statements.md#block) in the same namespace will normally cause an error, but inheriting a block into a namespace (with [`blockinherit`](cil_container_statements.md#blockinherit)) that already has a block with the same name will only result in a warning message and not cause an error. The policy from both blocks will end up in the binary policy. This behavior was used in the past to allow a block to be declared so that an [`in-statement`](cil_container_statements.md#in) could be used on it, but now an [`in-statement`](cil_container_statements.md#in) can be specified to occur after inheritance, so this behavior is not necessary (but is still allowed).
**Statement definition:**
```secil
(block block_id
cil_statement
...
)
```
**Where:**
block
|
The block keyword. |
block_id
|
The namespace identifier. |
cil_statement
|
Zero or more valid CIL statements. |
**Example:**
See the [`blockinherit`](cil_container_statements.md#blockinherit) statement for an example.
blockabstract
-------------
Declares the namespace as a 'template' and does not generate code until instantiated by another namespace that has a [`blockinherit`](cil_container_statements.md#blockinherit) statement.
Not allowed in [`macro`](cil_call_macro_statements.md#macro) and [`optional`](cil_container_statements.md#optional) blocks.
**Statement definition:**
```secil
(block block_id
(blockabstract template_id)
cil_statement
...
)
```
**Where:**
block
|
The block keyword. |
block_id
|
The namespace identifier. |
blockabstract
|
The blockabstract keyword. |
template_id
|
The abstract namespace identifier. This must match the block_id entry. |
cil_statement
|
Zero or more valid CIL statements forming the abstract block. |
**Example:**
See the [`blockinherit`](cil_container_statements.md#blockinherit) statement for an example.
blockinherit
------------
Used to add common policy rules to the current namespace via a template that has been defined with the [`blockabstract`](cil_container_statements.md#blockabstract) statement. All [`blockinherit`](cil_container_statements.md#blockinherit) statements are resolved first and then the contents of the block are copied. This is so that inherited blocks will not be inherited. For a concrete example, please see the examples section.
Inherited rules are resolved by searching namespaces in the following order:
- The parent namespaces (if any) where the [`blockinherit`](cil_container_statements.md#blockinherit) rule is located with the exception of the global namespace.
- The parent namespaces of the block being inherited (but not that block's namespace) with the exception of the global namespace.
- The global namespace.
Not allowed in [`macro`](cil_call_macro_statements.md#macro) blocks.
**Statement definition:**
```secil
(block block_id
(blockinherit template_id)
cil_statement
...
)
```
**Where:**
block
|
The block keyword. |
block_id
|
The namespace identifier. |
blockinherit
|
The blockinherit keyword. |
template_id
|
The inherited namespace identifier. |
cil_statement
|
Zero or more valid CIL statements. |
**Example:**
This example contains a template `client_server` that is instantiated in two blocks (`netserver_app` and `netclient_app`):
```secil
; This is the template block:
(block client_server
(blockabstract client_server)
; Log file labeling
(type log_file)
(typeattributeset file_type (log_file))
(typeattributeset data_file_type (log_file))
(allow process log_file (dir (write search create setattr add_name)))
(allow process log_file (file (create open append getattr setattr)))
(roletype object_r log_file)
(context log_file_context (u object_r log_file low_low))
; Process labeling
(type process)
(typeattributeset domain (process))
(call app_domain (process))
(call net_domain (process))
)
; This is a policy block that will inherit the abstract block above:
(block netclient_app
; Add common policy rules to namespace:
(blockinherit client_server)
; Label the log files
(filecon "/data/data/com.se4android.netclient/.*" file log_file_context)
)
; This is another policy block that will inherit the abstract block above:
(block netserver_app
; Add common policy rules to namespace:
(blockinherit client_server)
; Label the log files
(filecon "/data/data/com.se4android.netserver/.*" file log_file_context)
)
; This is an example of how blockinherits resolve inherits before copying
(block a
(type one))
(block b
; Notice that block a is declared here as well
(block a
(type two)))
; This will first copy the contents of block b, which results in type b.a.two being copied.
; Next, the contents of block a will be copied which will result in type a.one.
(block ab
(blockinherit b)
(blockinherit a))
```
optional
--------
Declare an [`optional`](cil_container_statements.md#optional) namespace. All CIL statements in the optional block must be satisfied before instantiation in the binary policy.
Not allowed in [`booleanif`](cil_conditional_statements.md#booleanif) blocks.
[`tunable`](cil_conditional_statements.md#tunable), [`in`](cil_container_statements.md#in), [`block`](cil_container_statements.md#block), [`blockabstract`](cil_container_statements.md#blockabstract), and [`macro`](cil_call_macro_statements.md#macro) statements are not allowed in [`optional`](cil_container_statements.md#optional) blocks.
**Statement definition:**
```secil
(optional optional_id
cil_statement
...
)
```
**Where:**
optional
|
The optional keyword. |
optional_id
|
The optional namespace identifier. |
cil_statement
|
Zero or more valid CIL statements. |
**Example:**
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
......
(optional move_file
(typetransition process msg_filter.move_file.in_queue file msg_filter.move_file.in_file)
(allow process msg_filter.move_file.in_queue (dir (read getattr write search add_name)))
(allow process msg_filter.move_file.in_file (file (write create getattr)))
(allow msg_filter.move_file.in_file unconfined.object (filesystem (associate)))
(typetransition msg_filter.int_gateway.process msg_filter.move_file.out_queue file
msg_filter.move_file.out_file)
(allow msg_filter.int_gateway.process msg_filter.move_file.out_queue (dir (read write search)))
(allow msg_filter.int_gateway.process msg_filter.move_file.out_file (file (read getattr unlink)))
) ; End optional block
.....
) ; End block
```
in
--
Allows the insertion of CIL statements into a named container ([`block`](cil_container_statements.md#block), [`optional`](cil_container_statements.md#optional) or [`macro`](cil_call_macro_statements.md#macro)). This insertion can be specified to occur either before or after block inheritance has been resolved.
Not allowed in [`macro`](cil_call_macro_statements.md#macro), [`booleanif`](cil_conditional_statements.md#booleanif), and other [`in`](cil_container_statements.md#in) blocks.
[`tunable`](cil_conditional_statements.md#tunable) and [`in`](cil_container_statements.md#in) statements are not allowed in [`in`](cil_container_statements.md#in) blocks.
**Statement definition:**
```secil
(in [before|after] container_id
cil_statement
...
)
```
**Where:**
in
|
The in keyword. |
before|after
|
An optional value that specifies whether to process the [`in`](cil_container_statements.md#in) before or after block inheritance. If no value is specified, then the [`in`](cil_container_statements.md#in) will be processed before block inheritance. |
container_id
|
A valid block , optional or macro namespace identifier. |
cil_statement
|
Zero or more valid CIL statements. |
**Example:**
This will add rules to the container named `system_server`:
```secil
(in system_server
(dontaudit process secmark_demo.dns_packet (packet (send recv)))
(allow process secmark_demo.dns_packet (packet (send recv)))
)
```
secilc-3.8.1/docs/cil_context_statement.md 0000664 0000000 0000000 00000006064 14762117372 0020656 0 ustar 00root root 0000000 0000000 Context Statement
=================
Contexts are formed using previously declared parameters and may be named or anonymous where:
- Named - The context is declared with a context identifier that is used as a reference.
- Anonymous - They are defined within the CIL labeling statement using user, role etc. identifiers.
Each type is shown in the examples.
context
-------
Declare an SELinux security context identifier for labeling. The range (or current and clearance levels) MUST be defined whether the policy is MLS/MCS enabled or not.
**Statement definition:**
```secil
(context context_id (user_id role_id type_id levelrange_id)))
```
**Where:**
context
|
The context keyword. |
context_id
|
The context identifier. |
user_id
|
A single previously declared user identifier. |
role_id
|
A single previously declared role identifier. |
type_id
|
A single previously declared type or typealias identifier. |
levelrange_id
|
A single previously declared levelrange identifier. This entry may also be defined by anonymous or named level , sensitivity , sensitivityalias , category , categoryalias or categoryset as discussed in the Multi-Level Security Labeling Statements section and shown in the examples. |
**Examples:**
This example uses a named context definition:
```secil
(context runas_exec_context (u object_r exec low_low))
(filecon "/system/bin/run-as" file runas_exec_context)
```
to resolve/build a `file_contexts` entry of (assuming MLS enabled policy):
```
/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:
```secil
(portcon udp 1024 (test.user object_r test.process ((s0) (s1))))
(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:
```secil
(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)
```
secilc-3.8.1/docs/cil_default_object_statements.md 0000664 0000000 0000000 00000015434 14762117372 0022330 0 ustar 00root root 0000000 0000000 Default Object Statements
=========================
These rules allow a default user, role, type and/or range to be used when computing a context for a new object. These require policy version 27 or 28 with kernels 3.5 or greater.
defaultuser
-----------
Allows the default user 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.
**Statement definition:**
```secil
(defaultuser class_id default)
```
**Where:**
defaultuser
|
The defaultuser keyword. |
class_id
|
A single previously declared class or classmap identifier, or a list of previously declared class or classmap identifiers enclosed within parentheses. |
default
|
A keyword of either source or target . |
**Example:**
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 property_service (set))
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
(class memprotect (mmap_zero))
(classmap android_classes (android))
(classmapping android_classes android (binder (all)))
(classmapping android_classes android (property_service (set)))
(classmapping android_classes android (zygote (not (specifycapabilities))))
(defaultuser (android_classes memprotect) source)
; Will produce the following in the binary policy file:
;; default_user binder source;
;; default_user zygote source;
;; default_user property_service source;
;; default_user memprotect source;
```
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.
```secil
(defaultrole class_id default)
```
**Where:**
defaultrole
|
The defaultrole keyword. |
class_id
|
A single previously declared class or classmap identifier, or a list of previously declared class or classmap identifiers enclosed within parentheses. |
default
|
A keyword of either source or target . |
**Example:**
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 property_service (set))
(class zygote (specifyids specifyrlimits specifycapabilities specifyinvokewith specifyseinfo))
(defaultrole (binder property_service zygote) target)
; Will produce the following in the binary policy file:
;; default_role binder target;
;; default_role zygote target;
;; default_role property_service target;
```
defaulttype
-----------
Allows the default type 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 28.
**Statement definition:**
```secil
(defaulttype class_id default)
```
**Where:**
defaulttype
|
The defaulttype keyword. |
class_id
|
A single previously declared class or classmap identifier, or a list of previously declared class or classmap identifiers enclosed within parentheses. |
default
|
A keyword of either source or target . |
**Example:**
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)
```
defaultrange
------------
Allows the default level or range to be taken from the source, target, or both contexts when computing a new context for the object [`class`](cil_class_and_permission_statements.md#class) identifier. Requires policy version 27. glblub as the default requires policy version 32.
**Statement definition:**
```secil
(defaultrange class_id default )
```
**Where:**
defaultrange
|
The defaultrange keyword. |
class_id
|
A single previously declared class or classmap identifier, or a list of previously declared class or classmap identifiers enclosed within parentheses. |
default
|
A keyword of either source , target , or glblub . |
range
|
A keyword of either low , high , or low-high . |
**Example:**
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)
```
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)
```
secilc-3.8.1/docs/cil_design.dia 0000664 0000000 0000000 00000015200 14762117372 0016504 0 ustar 00root root 0000000 0000000 ‹ í]moãF’þî_A8À!h{úý%ÚÉ"»›Ã ÉáîÛ€–h[7´¨#åqüå~ûU5)¿HÔŒÆÍ–‡JÉÌØ¦ºØduÕSUOWÿíïܔه¢nÕòí9#ô<+–³j¾X^½=ÿÏßÿý¯öüïßým¾È¿…ÿ¯êü&ƒO,üîíùõz½úöÍ›»»;RÞ7ùºªI¹¸%Mñæÿò²ÌßÀEoο;˲§ÌóuŽ?ë~š¯×õââv]dËü¦x{~‘ÏÞ_ÕÕír~Þ^Õ]7«ÊªÎ>äåÛó¯.ý×ù›n˜7ÏÆùÈØ«üª¸¨‹üýþ¡)|9÷’¡WE½=ìͪjpÉú~µsÉžqðÏ'×tW5pÑò껯~*Öë¢þª½î‡ãõÝì^A뛼¾Z,weÁó)Û‡Á‰¿4³JPnÄæ¹|¾¸‹ãŠ++®>®¸EónUÕë:_¬wE^TUYäËV꺾-^.§™å%¨ØÇ¦Å^>úåb½®>qÿ—yÙ2öÇ+îsWïU½˜|ñ>»bÏ(w‹ùúúÝ‘W;ú}¤Ñ?,šÅEYôÝýb¹løûa†ß~;Þ‚?~ßE\Ý.æEó 5{~Íž‘®»ËÞ|ê©o_wèƒi´å°½ˆ2¿/ênø<ºê¬{ÁÅyòª‹ÿ)fënz¿óå<¯çÙ_³Tœ?"À‹ùÛóŸéódz=!,ßÎóYUJDÄ„¡¶ç¼k1öq±=|
È—We±Áʘ2Fœš0
ß¿L\Q7ïfU½ÜŃMÉËð¶cwZvƒ0úu±¸º^ïÞ+Ý“/k_&¬¹®îÞõàÃO;¾þEúæQ?PØß‹?ÖO4–uËB5V JDDDõ"(1ʨ©MByÚ™jÔÄ'òÖ5û^¨G°Ï®Û¼ÿüñ§=h÷#.bÞ¨–ë>Yøóì2¿Y”÷pKù²9Ïšõ=Ú2°JíGÿ£(?ëÅ,jr?ÿvJÏb¡ÄÒç_2Lèsí;L_"ç¹×üHxEi˜ À¤WË›¢ÿeËÛ›îA(¥×'~ÞŠøàoi{M<ÞŠ8Š%âá¾SgS
Q½'
‘ÄQ0F<ƒiå¬Ñ×e5{ŸåÉ$Å6I}ª˜ŒÒ’7JÖ¨‰&2ªMB`… iB5G‰fék.[ÕÕ¬hš¿$Ëß2íèc2L#4LrÃd¢neó‘›$†z‰zD†©¬®’Q:’Q2)„¹QR„p[I9‚›@àf9b%)P å|iVæM“].`&_Ãzÿ%™¦cDrÛ™LÓM“/ÙØÙ¥Öúì–5HIr)/ËênÉ!pzf©’©:в)é4[õÓbYôT‘M°bÄAØÅMT[Ű.j&Šç´2ø‡ä‚æþ2ɳj¹|W,ç~2Ÿ;Åž«àžàªÆ¸ðÚg«í{èã{|VÉy9—×uu·_Ë8ú]Y,¯>V1§D…ŠøDMþ` øÆA±`4;žjó›ì–LgÉוçYd¿}{.w)"[ƒ~æÂìgwØàu©ˆ…ØÃÅ\•¸
1¾QS>ÜŽJîšÑ!äIÜ3ö…©’èçT}BT¬¾†0_hpqô1:sD[€Äl1úO?ü÷¿fÿ–߬¦g¿|ÿëo?üšpotÜÛ«– ùŽù²`%÷
ˆ(TQcYD3’ŒÄê†p̈)—ÈL3˜ÅvZ«Èðwï4{.•„+*—;É\‚§…ís(lwT¡ç³¬û,c{?G³`Ò).¶ Ò—c®o\7(dª"MÙ„Ibc‚éÀY‚¦9xIJÙ£wVÑ4ã[`€MÿP–‹UÓë‚)‹‚{¢'<*¢1Ò †¤EI(ÇQÆåý‡Ïí î?‘ÇaÏ…¹£©Z0MP|XËŠš1Æ}Él*1ž©M\UžÛ—¨jj_€ËLÒ}À¾pËâª#T†’£r
’-·ÉÙšêØ è½óì¹5Çë§Òö¥Æ0!ð/€à"2ß·ï+˜«Ã5î»QQ „Ù¹#VøDÏ8„?¯ŠeöK^Ë”ŒìQÆ” ü’€ºzËÄ=Ó8*þ 1¢%4ÔåÓÏÈÖ‰uÃç– n§gf€J2ovàþ©j†®8î(T‰)J¶¨mœ íb#Ý}ÓìÑNÐK«P=s/M÷$¤ûÅ"]‚tõ+!];@¶Yáb3q³Í^óHWO¡£ ¹ž“žðmt|»«‚ ߎßóp ææøÖù¬j‹os|<·?¾Ý×Oƒ gT'Òq•ÌË ]†ÇIøÆÂõáö†äù¢{¾]%Lžo„Ô.NúÀ‹”õª¸±¶5 bXo‘ÀiD^Ñ)]½Óë÷ÜßR*%\€Cl9ÀÞiy8†çqŸá‘kÆn“>
ái1öå|öé ÁsK9ÛNφ ÁýõÔR°¸L•֓aœÕÞ•XDü¤mÿ<ûÕ“ïx¬Ò‰ |j>ÅøÎ_'iËå …¡Íåq½ à Zµ¼J…•ÔxÈ «DN8FÛ£Š)„gò–Ó¦„öm¢ópAàáZÒ§"ópƒç–€n§gz ÿ§ý;§‘ã)Ý2[AËàí[*‘';WÒ;¹~}þŽhJ•œ8A~¬U¯—*‚v„éF㯘'qÄ©i·{ˆ±—béƒ7q„L+yŽN¿ì›Ò$Å|€cÌÄu†iEeE
ꙡŽá‰4BrÿFï,{¯äŒ¼/¦LŽä´ Ù¾ÖüÙ‡ù±ò#n€UnýéO6îÆSÛ1ÕfH˜öŽ„"G‚Sv$zv¤GSzdŒgeÐr#b"ãfEî|÷ÖÈÒˆHùÚd‘>ª†É3Y+‚)GBùÐ76ÓÅ<2mµƒ£3mÃçö§¹?¢já‹<Çèšf7ZÞï::©ÃTL?}çLéÓËêˆpâ‹Á¬ŠÆ"°ÜƵfÎ8u Ã¥˜‚dIlÛÚ»èÄ—}óìõó€ñÆ´f&íV<µÄŽ
Hìö:Ä!À,lâHäŽ"Ú¤Ž&Ú—èH²:þÔDE¢vÔ0…Q#ܶ!† ¼8ÛŠá›mwRuŒmýÓë‡ÂÔßRÚ¶qjHã#`á ¤ñJ[¡YçD
X[¢KÙrÚb
>
¬‘ŽZ3v•0‘ækƒ©Q’Ýn´Šh’PˆÏiM%Gb7î‹™DTbFuêÎŒrD;ç1œV,j¡$I«ýæ1*ìÔë€ó{Ç¢7¶Ý7É~ͤ”ùc,-qr°6„%Ì+ÁZ7„Á§Tl¢aõ ª•’PÇd""$lû MLØvœØVÒÌ7ÊÓ£ãž"½ /Ï‘;1¤mF>1dˆ&N£ÊÓ_$ž¨Ð¾Wåx§c^Ð#
ÞªœŠ¬rÌ0ÅW¾s`ÀÔpËÛ=±¸6N9jýÖC59å¤öz@¥Žbígï¥Ôu›O ÆJ!Ö‰…X& Ä’4rˆµo¡‹º1BxÖ¿ 1OAIœI¿°µe˜²³²Ý„"ñzÿ<{=‘1ÚùKµ3i¡ŸÖBÿÈZ=`¡¿IÊ2¦
'BÅÍ–*¿¤Ï§À
“AªEJGKÉ”è…Â>ULé”n4“*<°EEqCZ4H®KðréUÏŽÂêjV¤SŽßÝQÃdFšÞ
&SIûrV|£î 9Ê´r8˜&KJµÄÅÝ 4ÀôRžÓ53@^×óVåLÄMëR¤p|¸È+óûΤxióÝÃïþYöê¦_wÙz§Û“Ðû•N-“Ád%©ÚšŠ‰{oÄè.øFŠnkç!ÁÝ42AÞ‘B^7€…’]ñ•»¸&JlªËAˆëŠËÒE…¼áÓKl†uSáûH/‰bÙ
çÞ%>h"YÌ0EY¾…³g¡†ûØZp×¾9¥|M)X8C˜°Õ@É—¶z8<ÌÚ3ÍÞ8n§UOËEгN¬Ärx•t¯ÃeP|€Äóé},ÜS7ug
æŒ) hÜ‚æÞ
ÏePRÆ^çûæÙò¤%«d"-ÚB9QHÑ×I¨(1@¸bq·SôÊáFΦ|îœr=žúaâ3)›Ò§Ž)2BFƒ’·ú(Æi#gcœ‘®•;ãTVWÉ6E·MýÚ˜lÓmS0ÛŠKÌCè 6zyp÷ƒ–‰¢„ÑAø(Ó/yÝÙïu‘°StûÔ¯‘É<°AÒtÆåLØ “Ä8§ãö¨ÓÎ/I:ß×P*&Ì IÅÆïŒÛ?ÏþKñ®R«º“;6/öV’TôÒðSﱨ’*êFA°½HÁ]$JMxÜ#ïçtHN£‰yòõR3sPOSyúe_hM›kX'ùìýU]Ý.çÛ/ªª,òe+s]ßÇÂv€Ǫ̈^xªbÜîÌIÛž‰‚‚"ã¡zc€Á³EùîâvQ‚µlÖ ¡Mó®J& ü%á=6˜Ž…;ã&LÇ=0„€Œ)·àù¸"q»{„ÎèÿÊõ–Ïsý«#LŽß¿î‰ä4#:•Ý…ª+¥C9Ìáñȯõ–S½ÝxÏ{߃i/É…ojk/ƒ8ÞÁå:˜Ç$î³Aƒ÷+”Ã[9\MÑþ·A]äî˜^âû>ª[01¬çÛ²¸êÆP€—ƒêÆqc¥·"«[øôþtê¶'²×ÁÜ Gô„Y\ÿBE«fß>nÜåcë˼i²ËE™ª[Ñcú>eL!ýk[Z ¹Œð¥mDLn2Ú#c—D…›‚`Ky©h9(Ú7Ëž+9QÌP‚ëDL>±èH‡œÃ¤cŸÃô¬L±±êL8‹¼³Í;/!õ„óØÛÚÂ'—€n§hÁd M$Æ6.ªšuB$]G$ouNŒè®Šú&ƒ=O876ÎíÓÅ„sLjsÍ ¹I…O»0õd&G”R{Iœ±©ßÕ-,(ûÒmþ‡Ý}ÓìÓJà}IúÒ:Q‚º_,Ô
9›I«×Ùƒ§Ã›a{!ÜXs‰?Dªv‹QØVéMcàÐBúˆ¾Ç¥Gúg/#íH´‰®#ã–6y[k¢nÊ^ÓRû"6ç–âïVÏL0Å…i$P9laSÍ:)ÂbžÇ‚ÛóZÆÇ€_”Õì}–NÞŽî {U1yÀÆß&œÚÉc2R鸅&nµg·qf}¡É0Ë<ýŽ¹èø¾yözM[·i˜“) Oøc î^ÖdÂyUÂÓë0#„,,uu»´6E>r€é¥Š®‰Â*+h‹>™ˆ¬mÏdD?"D¿â”òy]Å©ŒÏ`èŸgï¥R;攲´A÷ÔüJHs5Ã_'±k‰JØÓpÂÅËϘ>l•·b8±>²•„úŠ v±-Ž–¥ã™ŽàöêdŠpÇ™ã5j€Üë¨(2nòu|'o‘ÓØÂÞ¸9Þà¹%ÐÛéY0Çʇ:RâËpTF.'8#=–”ŒŠ©×+=§ÑèÉ”}óìWO®´¿”ÑÄf81ÐkB’)æ•ØÆ°ÐÕ1@o+fz
qžQ9*ЛÚvðöêc¼#¼Ál+æ6|w{’rÂ_´ƒ¼‘wІO/ÞN× 4èHÿ6y()
âtJÉÀ‚Xª=ä}±>òî™e¿rrÕ^)y¼'xU൯xm8{ ûÒpŠ´µ˜+¼“ÂîrK´ØlZÜÍ˲ºËλ,ïyvÐþÄóðî,:OH8:îSÔ„Ç×ϲðX +wÇ£ð2°¯‡A¢ö
Òa}g·Ú⩨}gÕ 5šµÁ@™j"hÜ>³!¾Í,cÄZp³‚¨Ïl]4x±Ôiö.µO'“G![ØÐ-Ë`óW·YcÔµMf5¾[—Õ/=“òà8¿g†½}šg'¦©¨u*1þ&L·¯sÔ‚
æbqÑ&`5‰Z|F1Ü‹÷Øb
X˜¨ý ƒ'öÅu„Æ3¾é³–ÐcÂû‹V
pèX}C¨Ž|èê2ˆaj*4v7·„ë¨õ‹à™¥v³z~Œh;á`Çâ*ÃÌHa¾õ¸ô˜ÚDV´à©¥
Àš…ŸƒDýflìðWÏäHlö&ð¨