Difference between revisions of "ObjectClassStatements"
(New page: = Object Class and Permission Statements = For those who write or manager SELinux policy, there is no need to define new objects and their associated permissions as these would be done by ...) |
|||
(One intermediate revision by the same user not shown) | |||
Line 2: | Line 2: | ||
For those who write or manager SELinux policy, there is no need to define new objects and their associated permissions as these would be done by those who actually design and/or write object managers. | For those who write or manager SELinux policy, there is no need to define new objects and their associated permissions as these would be done by those who actually design and/or write object managers. | ||
− | + | A list of object classes used by the Reference Policy can be found in the <tt>./policy/flask/security_classes</tt> file. | |
− | A list of object classes used by | + | |
− | Object classes are | + | There are two variants of the class statement for writing policy: |
+ | # There is the <tt>[[#class | class]]</tt> statement that declares the actual class identifier or name. | ||
+ | # There is a further refinement of the <tt>class</tt> statement that associates permissions to the class as discussed in the [[#Associating Permissions to a Class | Associating Permissions to a Class]] section. | ||
+ | |||
+ | == class == | ||
+ | Object classes are declared within a policy as follows: | ||
'''The statement definition is:''' | '''The statement definition is:''' | ||
Line 13: | Line 17: | ||
'''Where:''' | '''Where:''' | ||
− | {|border="1" | + | |
− | |class | + | {| border="1" |
− | |The class keyword. | + | | class |
+ | | The class keyword. | ||
|- | |- | ||
− | |class_id | + | | class_id |
− | |The class identifier. | + | | The class identifier. |
|} | |} | ||
Line 26: | Line 31: | ||
'''The statement is valid in:''' | '''The statement is valid in:''' | ||
− | + | {| border="1" | |
− | {|border="1" | + | |
|<center>'''Monolithic Policy'''</center> | |<center>'''Monolithic Policy'''</center> | ||
|<center>'''Base Policy'''</center> | |<center>'''Base Policy'''</center> | ||
Line 33: | Line 37: | ||
|- | |- | ||
− | |<center>Yes</center> | + | | <center>'''Yes'''</center> |
− | |<center>Yes</center> | + | | <center>'''Yes'''</center> |
− | |<center>No</center> | + | | <center>'''No'''</center> |
|- | |- | ||
− | |<center> | + | | <center>[[ConditionalStatements#if | if Statement]]</center> |
− | |<center> | + | | <center>[[PolicyStatements#optional | optional Statement]] </center> |
− | |<center> | + | | <center>[[PolicyStatements#require | require Statement]] </center> |
|- | |- | ||
− | |<center>No</center> | + | | <center>'''No'''</center> |
− | |<center>No</center> | + | | <center>'''No'''</center> |
− | |<center>Yes</center> | + | | <center>'''Yes'''</center> |
|} | |} | ||
Line 52: | Line 56: | ||
'''Example:''' | '''Example:''' | ||
<pre> | <pre> | ||
− | + | # Define the PostgreSQL db_tuple object class | |
− | + | # | |
− | + | ||
class db_tuple | class db_tuple | ||
</pre> | </pre> | ||
− | == Permissions == | + | == Associating Permissions to a Class == |
− | + | ||
− | + | ||
Permissions can be defined within policy in two ways: | Permissions can be defined within policy in two ways: | ||
+ | # Define a set of common permissions that can then be inherited by one or more object classes using further <tt>class</tt> statements. | ||
+ | # Define <tt>class</tt> specific permissions. This is where permissions are declared for a specific object class only (i.e. the permission is not inherited by any other object class). | ||
− | + | A list of classes and their permissions used by the Reference Policy can be found in the <tt>./policy/flask/access_vectors</tt> file. | |
− | + | ||
− | '''The | + | === common === |
+ | Declare a common identifier and associate one or more common permissions. | ||
+ | |||
+ | '''The statement definition is:''' | ||
<pre> | <pre> | ||
− | + | common common_id { perm_set } | |
</pre> | </pre> | ||
'''Where:''' | '''Where:''' | ||
− | |||
− | |||
− | |||
− | | | + | {| border="1" |
− | | | + | | common |
− | |The | + | | The common keyword. |
|- | |- | ||
− | | | + | | common_id |
− | |The | + | | The common identifier. |
|- | |- | ||
− | + | | perm_set | |
− | + | | One or more permission identifiers in a space separated list enclosed within braces ({}). | |
− | + | ||
− | + | ||
− | |perm_set | + | |
− | |One or more | + | |
|} | |} | ||
− | ''' | + | '''The statement is valid in:''' |
− | + | {| border="1" | |
− | + | ||
− | + | ||
− | {|border="1" | + | |
|<center>'''Monolithic Policy'''</center> | |<center>'''Monolithic Policy'''</center> | ||
|<center>'''Base Policy'''</center> | |<center>'''Base Policy'''</center> | ||
Line 106: | Line 101: | ||
|- | |- | ||
− | |<center>Yes</center> | + | | <center>'''Yes'''</center> |
− | |<center>Yes</center> | + | | <center>'''Yes'''</center> |
− | |<center>No</center> | + | | <center>'''No'''</center> |
|- | |- | ||
− | |<center> | + | | <center>[[ConditionalStatements#if | if Statement]]</center> |
− | |<center> | + | | <center>[[PolicyStatements#optional | optional Statement]] </center> |
− | |<center> | + | | <center>[[PolicyStatements#require | require Statement]] </center> |
|- | |- | ||
− | |<center>No</center> | + | | <center>'''No'''</center> |
− | |<center>No</center> | + | | <center>'''No'''</center> |
− | |<center> | + | | <center>'''No'''</center> |
|} | |} | ||
− | ''' | + | '''Example:''' |
<pre> | <pre> | ||
− | + | # Define the common PostgreSQL permissions | |
− | + | # | |
− | + | common database { create drop getattr setattr relabelfrom relabelto } | |
− | + | ||
</pre> | </pre> | ||
− | + | === class === | |
− | + | Inherit and / or associate permissions to a previously declared class identifier. | |
− | + | ||
− | + | ||
− | class | + | |
− | + | ||
+ | '''The statement definition is:''' | ||
<pre> | <pre> | ||
− | + | class class_id [ inherits common_set ] [ { perm_set } ] | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
</pre> | </pre> | ||
+ | '''Where:''' | ||
− | = | + | {| border="1" |
− | + | | class | |
+ | | The class keyword. | ||
− | + | |- | |
+ | | class_id | ||
+ | | The previously declared class identifier. | ||
− | + | |- | |
− | + | | inherits | |
− | + | | The optional inherits keyword that allows a set of common permissions to be inherited. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | | | + | |
− | |The common | + | |
|- | |- | ||
− | | | + | | common_set |
− | | | + | | A previously declared common identifier. |
|- | |- | ||
− | |perm_set | + | | perm_set |
− | |One or more permission identifiers in a space separated list enclosed within braces ({}). | + | | One or more optional permission identifiers in a space separated list enclosed within braces ({}). |
|} | |} | ||
+ | |||
+ | '''Note:''' | ||
+ | : There must be at least one <tt>common_set</tt> or one <tt>perm_set</tt> defined within the statement. | ||
'''The statement is valid in:''' | '''The statement is valid in:''' | ||
− | {|border="1" | + | |
+ | {| border="1" | ||
|<center>'''Monolithic Policy'''</center> | |<center>'''Monolithic Policy'''</center> | ||
|<center>'''Base Policy'''</center> | |<center>'''Base Policy'''</center> | ||
Line 181: | Line 169: | ||
|- | |- | ||
− | |<center>Yes</center> | + | | <center>'''Yes'''</center> |
− | |<center>Yes</center> | + | | <center>'''Yes'''</center> |
− | |<center>No</center> | + | | <center>'''No'''</center> |
|- | |- | ||
− | |<center> | + | | <center>[[ConditionalStatements#if | if Statement]]</center> |
− | |<center> | + | | <center>[[PolicyStatements#optional | optional Statement]] </center> |
− | |<center> | + | | <center>[[PolicyStatements#require | require Statement]] </center> |
|- | |- | ||
− | |<center>No</center> | + | | <center>'''No'''</center> |
− | |<center>No</center> | + | | <center>'''No'''</center> |
− | |<center> | + | | <center>'''Yes'''</center> |
|} | |} | ||
− | ''' | + | '''Examples:''' |
<pre> | <pre> | ||
− | + | # The following example shows the db_tuple object class being | |
− | + | # allocated two permissions: | |
− | + | class db_tuple { relabelfrom relabelto } | |
+ | |||
+ | # The following example shows the db_blob object class | ||
+ | # inheriting permissions from the database set of common | ||
+ | # permissions (as described in the "Associating Permissions | ||
+ | # to a Class" section): | ||
+ | |||
+ | class db_blob inherits database | ||
</pre> | </pre> | ||
+ | <pre> | ||
+ | # The following example (from the access_vector file) shows the | ||
+ | # db_blob object class inheriting permissions from the database | ||
+ | # set of common permissions and adding a further four permissions: | ||
+ | |||
+ | class db_blob inherits database { read write import export } | ||
+ | </pre> | ||
+ | |||
+ | |||
+ | {| style="width: 100%;" border="0" | ||
+ | |- | ||
+ | | [[AVCRules | '''Previous''']] | ||
+ | | <center>[[NewUsers | '''Home''']]</center> | ||
+ | | <center>[[ConditionalStatements | '''Next''']]</center> | ||
+ | |} | ||
+ | |||
+ | |||
+ | ---- | ||
+ | <references/> | ||
+ | |||
+ | [[Category:Notebook]] |
Latest revision as of 12:11, 13 December 2014
Contents
Object Class and Permission Statements
For those who write or manager SELinux policy, there is no need to define new objects and their associated permissions as these would be done by those who actually design and/or write object managers.
A list of object classes used by the Reference Policy can be found in the ./policy/flask/security_classes file.
There are two variants of the class statement for writing policy:
- There is the class statement that declares the actual class identifier or name.
- There is a further refinement of the class statement that associates permissions to the class as discussed in the Associating Permissions to a Class section.
class
Object classes are declared within a policy as follows:
The statement definition is:
class class_id
Where:
class | The class keyword. |
class_id | The class identifier. |
The statement is valid in:
|
|
|
|
|
|
|
|
|
Example:
# Define the PostgreSQL db_tuple object class # class db_tuple
Associating Permissions to a Class
Permissions can be defined within policy in two ways:
- Define a set of common permissions that can then be inherited by one or more object classes using further class statements.
- Define class specific permissions. This is where permissions are declared for a specific object class only (i.e. the permission is not inherited by any other object class).
A list of classes and their permissions used by the Reference Policy can be found in the ./policy/flask/access_vectors file.
common
Declare a common identifier and associate one or more common permissions.
The statement definition is:
common common_id { perm_set }
Where:
common | The common keyword. |
common_id | The common identifier. |
perm_set | One or more permission identifiers in a space separated list enclosed within braces ({}). |
The statement is valid in:
|
|
|
|
|
|
|
|
|
Example:
# Define the common PostgreSQL permissions # common database { create drop getattr setattr relabelfrom relabelto }
class
Inherit and / or associate permissions to a previously declared class identifier.
The statement definition is:
class class_id [ inherits common_set ] [ { perm_set } ]
Where:
class | The class keyword. |
class_id | The previously declared class identifier. |
inherits | The optional inherits keyword that allows a set of common permissions to be inherited. |
common_set | A previously declared common identifier. |
perm_set | One or more optional permission identifiers in a space separated list enclosed within braces ({}). |
Note:
- There must be at least one common_set or one perm_set defined within the statement.
The statement is valid in:
|
|
|
|
|
|
|
|
|
Examples:
# The following example shows the db_tuple object class being # allocated two permissions: class db_tuple { relabelfrom relabelto } # The following example shows the db_blob object class # inheriting permissions from the database set of common # permissions (as described in the "Associating Permissions # to a Class" section): class db_blob inherits database
# The following example (from the access_vector file) shows the # db_blob object class inheriting permissions from the database # set of common permissions and adding a further four permissions: class db_blob inherits database { read write import export }
Previous | |
|