Received: from goalie.tycho.ncsc.mil (goalie [144.51.242.250]) by tarius.tycho.ncsc.mil (8.14.4/8.14.4) with ESMTP id t7VCsTah016574 for ; Mon, 31 Aug 2015 08:54:36 -0400 From: Steve Lawrence To: SELinux List Subject: [PATCH v2 3/3] secilc: Add documentation/examples for allowx, auditallowx, dontauditx, and permissionx Date: Mon, 31 Aug 2015 08:53:57 -0400 Message-ID: <1441025637-18267-4-git-send-email-slawrence@tresys.com> In-Reply-To: <1441025637-18267-1-git-send-email-slawrence@tresys.com> References: <1441025637-18267-1-git-send-email-slawrence@tresys.com> MIME-Version: 1.0 Content-Type: text/plain List-Id: "Security-Enhanced Linux \(SELinux\) mailing list" List-Post: List-Help: Also removes *bounds statements in policy.cil, which had bounds violations and are better tested in other test files. Signed-off-by: Steve Lawrence --- secilc/docs/cil_access_vector_rules.xml | 172 +++++++++++++++++++++ .../docs/cil_class_and_permission_statements.xml | 95 ++++++++++++ secilc/docs/cil_container_statements.xml | 23 ++- secilc/test/policy.cil | 9 +- 4 files changed, 288 insertions(+), 11 deletions(-) diff --git a/secilc/docs/cil_access_vector_rules.xml b/secilc/docs/cil_access_vector_rules.xml index d3ce095..985fc3d 100644 --- a/secilc/docs/cil_access_vector_rules.xml +++ b/secilc/docs/cil_access_vector_rules.xml @@ -276,4 +276,176 @@ + + allowx + Specifies the access allowed between a source and target type using extended permissions. Unlike the allow statement, the statements validatetrans, mlsvalidatetrans, constrain, and mlsconstrain do not limit accesses granted by allowx. + Rule definition: + + Where: + + + + + + + + allowx + + + The allowx keyword. + + + + + source_id + + + A single previously defined source type, typealias, or typeattribute identifier. + + + + + target_id + + + A single previously defined target type, typealias, or typeattribute identifier. + The self keyword may be used instead to signify that source and target are the same. + + + + + permissionx_id + + + A single named or anonymous permissionx. + + + + + + Examples: + These examples show a selection of possible permutations of allowx rules: + + + + + + + auditallowx + Audit the access rights defined if there is a valid allowx rule. It does NOT allow access, it only audits the event. + Rule definition: + + Where: + + + + + + + + auditallowx + + + The auditallowx keyword. + + + + + source_id + + + A single previously defined source type, typealias or typeattribute identifier. + + + + + target_id + + + A single previously defined target type, typealias or typeattribute identifier. + The self keyword may be used instead to signify that source and target are the same. + + + + + permissionx_id + + + A single named or anonymous permissionx. + + + + + + Examples: + This example will log an audit event whenever the corresponding allowx rule grants access to the specified extended permissions: + + + + + + dontauditx + 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: + + Where: + + + + + + + + dontauditx + + + The dontauditx keyword. + + + + + source_id + + + A single previously defined source type, typealias or typeattribute identifier. + + + + + target_id + + + A single previously defined target type, typealias or typeattribute identifier. + The self keyword may be used instead to signify that source and target are the same. + + + + + permissionx_id + + + A single named or anonymous permissionx. + + + + + + Examples: + This example will not audit the denied access: + + + + diff --git a/secilc/docs/cil_class_and_permission_statements.xml b/secilc/docs/cil_class_and_permission_statements.xml index 25929b1..2926d7c 100644 --- a/secilc/docs/cil_class_and_permission_statements.xml +++ b/secilc/docs/cil_class_and_permission_statements.xml @@ -490,4 +490,99 @@ + + permissionx + Defines a named extended permission, which can be used in the allowx, auditallowx, and dontauditx statements. + Statement definition: + + Where: + + + + + + + + permissionx + + + The permissionx keyword. + + + + + kind + + + A keyword specifying how to interpret the extended permission values. Must be one of: + + + + + + + + + kind + + + description + + + + + + + ioctl + + + Permissions define a whitelist of ioctl values. Permission values must range from 0x0000 to 0xFFFF, inclusive. + + + + + + + + + + class_id + + + A single previously declared class 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: + + + + diff --git a/secilc/docs/cil_container_statements.xml b/secilc/docs/cil_container_statements.xml index 6bdd1ab..3e3d2f6 100644 --- a/secilc/docs/cil_container_statements.xml +++ b/secilc/docs/cil_container_statements.xml @@ -241,19 +241,30 @@ allow + allowx + + auditallow + auditallowx + + + + booleanif dontaudit - - + + dontauditx + typepermissive + + rangetransition @@ -263,11 +274,11 @@ roleallow - - roleattribute + + roletransition @@ -277,11 +288,11 @@ typealias - - typeattribute + + typechange diff --git a/secilc/test/policy.cil b/secilc/test/policy.cil index 25c8545..0b532a9 100644 --- a/secilc/test/policy.cil +++ b/secilc/test/policy.cil @@ -91,6 +91,9 @@ ;;(allow console_t console_device_t file_rw) (allow console_t console_device_t (files (read))) + (permissionx ioctl_test (ioctl files (and (range 0x1600 0x19FF) (not (range 0x1750 0x175F))))) + (allowx console_t console_device_t ioctl_test) + (boolean secure_mode false) (boolean console_login true) @@ -114,9 +117,6 @@ (typealias sbin_t) (typealiasactual sbin_t bin_t) (typepermissive device_t) - (typebounds device_t bin_t) - ;;(typebounds bin_t kernel_t) ;; This statement and the next can be used - ;;(typebounds kernel_t device_t) ;; to verify that circular bounds can be found (typemember device_t bin_t file exec_t) (typetransition device_t console_t files console_device_t) @@ -203,7 +203,6 @@ (roletype exec_role bin_t) (roletype exec_role exec_type) (roleallow system_r user_r) - (rolebounds system_r user_r) (roletransition system_r bin_t file user_r) (userrole foo_u foo_role) @@ -213,7 +212,6 @@ (userrole system_u system_r) (userlevel system_u low) (userrange system_u low_high) - (userbounds system_u user_u) (userrole user_u user_r) (userlevel user_u (s0 (range c0 c2))) @@ -286,6 +284,7 @@ (macro all ((type x)) (allow x bin_t (policy.file (execute))) + (allowx x bin_t (ioctl policy.file (range 0x1000 0x11FF))) ) (call all (bin_t)) -- 2.4.3