Skip to contentSkip to conversation

Core policy

DISCUSSION Stephen D. Smalley 3 participants 3 messages Feb 25, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw
Quoted 1 line · Wayne Salamon

The use of macros has grown to be a large problem. The current policy makes

use

Quoted 6 lines

of macros that call other macros which call macros. Some macros should be eliminated; every_domain, every_test_domain for example. Others should be pared down to least privilege; the xx_file_perms and xx_dir_perms for example. The use of parameterized macros makes it very difficult to analyze the policy source files. Also, there are several instances of rules being duplicated in the generated policy due to macro usage.

In addition to the problem of overly permissive macros, there are also a number of problems caused by the use of type attributes such as 'domain' and 'file_type' (as well as the other attributes like pidfile) in allow rules. Although there are legitimate cases where this is appropriate (e.g. allowing init to kill all processes, allowing setfiles to relabel all files), there is a tendency to misuse type attributes that map to a very large set of domains/types in allow rules that should only be applied to a more specific set. This prevents people from creating new domains or types that are rigorously isolated from the rest of the system (unless they omit these attributes from those domains or types, which then requires them to explicitly enumerate the legitimate cases that are normally handled by those attributes and causes problems with assertions that expect those attributes to include certain functional classes of types). It would be helpful to audit the existing macros and domains for such rules and to consider how we can refine them, e.g. defining new attributes for more specific sets, explicitly enumerating the sets in certain cases, eliminating the rule entirely if it isn't truly necessary.

With regard to macros, I think that they are helpful when they provide a useful abstraction and are carefully limited to that abstraction (i.e. no granting of permissions only weakly related to that abstraction). For example, domain_auto_trans and file_type_auto_trans provide useful abstractions of the higher level concepts of domain transitions and file type transitions, although we should audit them to ensure that they are not being overly permissive. They would actually have been incorporated into the base language as primitives except for the fact that there is some potential variance in the specific set of permissions that you may want to grant in certain cases (the macros merely express the common case). In contrast, every_domain does not provide any useful abstraction and merely conceals many permissions. Some of its finer-grained macros might be ok (e.g. general_domain_access) while others need to be split up further or eliminated entirely. Likewise, can_exec_any should likely be eliminated entirely.

--
Stephen Smalley, NSA
[email protected]

--
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 8 lines · Stephen D. Smalley

With regard to macros, I think that they are helpful when they provide a useful abstraction and are carefully limited to that abstraction (i.e. no granting of permissions only weakly related to that abstraction). For example, domain_auto_trans and file_type_auto_trans provide useful abstractions of the higher level concepts of domain transitions and file type transitions, although we should audit them to ensure that they are not being overly permissive.

I agree with the above. The macros that I was (mostly) referring to are
the ones in macros/program. The idea behind these seems to have parameterized domain/type definitions. I'm not convinced they're a good idea, and many have dependencies to types defined in other .te files.

--
Wayne Salamon
[email protected]

--
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
In reply to Stephen D. Smalley
Quoted 6 lines · Stephen D. Smalley

merely express the common case). In contrast, every_domain does not provide any useful abstraction and merely conceals many permissions. Some of its finer-grained macros might be ok (e.g. general_domain_access) while others need to be split up further or eliminated entirely. Likewise, can_exec_any should likely be eliminated entirely.

I think that the reason that not much has been done on this issue is that the macros in question have to be removed from the main tree.

Once those macros get removed from the main tree I'll copy the change into my tree and start work on fixing whatever breaks (and I'm sure that other people will do the same).

While things are working moderately well I'm not in a hurry to make such changes on my own.

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.