Skip to contentSkip to conversation

Type attributes

DISCUSSION Carlos Anísio Monteiro 3 participants 3 messages Nov 26, 2003 – Nov 27, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi.

The type attributes are used only as identifier to SELinux or to administrator of the SELinux. As the type attributes is optional not have needed of declare them. Then, can I pass over ? or I am not undertanding them right.

Thanks.

Signature · 10 lines
Carlos Anisio Monteiro  <[email protected]>
IPEN/CNEN-SP
Sao Paulo - Brasil



--
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.
#1 lore raw
Quoted 4 lines · Carlos Anísio Monteiro

The type attributes are used only as identifier to SELinux or to administrator of the SELinux. As the type attributes is optional not have needed of declare them. Then, can I pass over ? or I am not undertanding them right.

I'm not sure I understand your question. A type attribute in a policy rule is expanded to the set of types that have that attribute. Are you asking:
1) Whether a type attribute name needs to be declared before using it in a type declaration?
Answer: Yes. At one time, type attribute names were implicitly declared upon their first use in a type declaration, but explicit declarations were added and required to allow the compiler to catch mistakes. Type attribute names are typically declared in attrib.te.
2) Whether a type declaration must have type attributes associated with it?
Answer: No. However, if you define a new type and it does fit into one of the existing attribute definitions (see the comments in attrib.te), then you should associate that attribute with it unless you have a specific reason not to do so. For example, if you define a new type for a process, and you fail to associate the 'domain' attribute with it, then many existing allow rules that use 'domain' will not be applied to it, which could be a problem for normal system operation (e.g. init needs to be able to reap it, administrators should be able to kill it, etc). Also, you may end up violation an assertion if you fail to use the attribute, as assertions are often based on attributes.

Signature · 8 lines
Stephen Smalley <[email protected]>
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.
#2 lore raw
Quoted 4 lines · Stephen Smalley

Answer: Yes. At one time, type attribute names were implicitly declared upon their first use in a type declaration, but explicit declarations were added and required to allow the compiler to catch mistakes. Type attribute names are typically declared in attrib.te.

Currently the published policy only has them declared in attrib.te. I strongly recommend that this practise be continued.

As Stephen explains below a defined attribute does not have to be used. One thing he did not mention is that a defined attribute which is not used has no affect on the policy binary (try adding some attributes that are not assigned to any types and you will notice that the md5sum of the compiled policy does not change).

So there is no cost to defining extra attributes.

Quoted 2 lines

etc). Also, you may end up violation an assertion if you fail to use the attribute, as assertions are often based on attributes.

Recently I have been adding new assertions to more strictly check these things. So a policy which creates a process type without the "domain" attribute will not compile. These assertions unfortunately significantly increase the time taken to compile the policy, however there are only a small number of people who do thousands of compiles of policy, but a large number of people who might be expected to make such mistakes so the net result is positive.

Also I found a few policy mistakes that I had made when I added these rules. ;)

Signature · 10 lines
http://www.coker.com.au/selinux/   My NSA Security Enhanced Linux packages
http://www.coker.com.au/bonnie++/  Bonnie++ hard drive benchmark
http://www.coker.com.au/postal/    Postal SMTP/POP benchmark
http://www.coker.com.au/~russell/  My home page


--
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.