Use of type_change and type_transition declarations
I don't understand what means type_change declaration.
Anyone can give me an explanation? What are the difference between type_change and type_transition declarations?
If I declare a type_transition like type_transition dom1_t dom2_exec_t:process dom2_t, why I have to use an allow rule?
Quoted 7 lines · Mario Fanelli
I don’t understand what means
type_changedeclaration.Anyone can give me an explanation? What are the difference between
type_changeandtype_transitiondeclarations?If I declare a
type_transitionliketype_transitiondom1_tdom2_exec_t:processdom2_t, why I have to use an allow rule?
type_change is information that userland programs use for relabeling (retrieved by security_compute_relabel()), it does not do anything by itself. The current use of type_change is to tell login programs what label the user's terminal should be relabeled to.
type_transition changes the default type when a new object is created, it does not allow access. The default type is the type of the container; for example, a file's default type is the type of the directory it is being created in. When used on processes like your example above, dom1_t will exec() dom2_exec_t and the new process will be in dom2_t, assuming the transition is allowed.
Signature · 10 lines
Chris PeBenito Tresys Technology, LLC (410) 290-1411 x150 -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.
Quoted 14 lines · Christopher J. PeBenito
Quoted 7 lines · Mario Fanelli
I don’t understand what means
type_changedeclaration.Anyone can give me an explanation? What are the difference between
type_changeandtype_transitiondeclarations?If I declare a
type_transitionliketype_transitiondom1_tdom2_exec_t:processdom2_t, why I have to use an allow rule?
type_changeis information that userland programs use for relabeling (retrieved bysecurity_compute_relabel()), it does not do anything by itself. The current use oftype_changeis to tell login programs what label the user's terminal should be relabeled to.
Quoted 6 lines
type_transitionchanges the default type when a new object is created, it does not allow access. The default type is the type of the container; for example, a file's default type is the type of the directory it is being created in. When used on processes like your example above,dom1_twillexec()dom2_exec_tand the new process will be indom2_t, assuming the transition is allowed.
To answer the latter question (why does one have to specify an allow rule given that one has specified a type_transition rule), we chose to keep separate the default labeling rules (type_transition) from the access rules (allow) so that:
1) The full set of permitted accesses is captured in the allow rules, so they are sufficient for analysis of potential information flow, and
2) The precise set of permitted accesses can be customized for different transitions.
Note that type transitions only specify default behaviors; security-aware applications can override those defaults via the SELinux API if allowed to do so by policy. Only the allow rules are authoritative.
The policy compiler could auto-generate the minimal set of allow rules required to allow a given type_transition, but one would still need to specify some allow rules related to the transition (e.g. inheritance of state) and that would then require analyzers to factor in the type_transition rules as well.
Note that at least some of your questions could be answered by reading the existing (admittedly stale) documentation, e.g.
http://www.nsa.gov/selinux/papers/policy2/t1.html
Signature · 8 lines
Stephen Smalley National Security Agency -- This message was distributed to subscribers of the selinux mailing list. If you no longer wish to subscribe, send mail to [email protected] with the words "unsubscribe selinux" without quotes as the message.