Inherited tpe definition
I was thinking about two of the long-standing complications to writing selinux policy: type splitting and creating new types similar to old types. (these problems were pointed out to me in some private discussions with Dan and Steve). It occurred to me that on old suggestion from KaiGai helped with these problems if we could overcome some of the concerns. So I wanted to start that discussion again. First
- the problems.
Type splitting refers to what happens when you have an existing type that isn't specific enough and you want to split it into two or more types. As an example, take some log files:
/var/log/messages -> var_log_t/var/log/secure -> var_log_t/var/log/spooler -> var_log_t/var/log/maillog -> var_log_t
Say I want to create a new domain that can only read /var/log/messages but shouldn't be able to read the other log files (no idea if there is security advantage there - this is a made up example). I can create a new log type (var_messages_t), but I must carefully track down all domains that currently have/need access to /var/log/messages and allow them access to the new type. This is somewhat possible - but difficult and error prone - and fails if there are third party modules of which I am unaware. And this is a simple example - more complicated examples require re-factoring certain access as attributes and changing existing policy.
The second problem is if I want to create a new domain based on an existing domain (this is what Dan is doing with guest_t and xguest_t). Basically, now there is no language support for this and you end up defining lots of templates. Works fine if you plan for it ahead of time, but fails miserably if the templates weren't created.
KaiGai suggested these problems (and some others) could be solved via inheritance - his suggestion is discussed starting at
http://marc.info/?l=selinux&m=111073215428407&w=2. Looking at that again, it seems to solve the splitting problem _very_ well and provides a basis for solving the second problem.
The main objections were (that I can remember - there may be more):
1) Extending an existing type often means understanding a set of related types. For example, creating a new domain based on httpd_t probably requires a new httpd_log_t and httpd_conf_t (again - made up example). Straight inheritance doesn't capture this relationship and makes it difficult to define the related types, give the correct inter-set access, and (most importantly) maintain the right separation between the old set and new set. There were some suggestions to address this but no consensus.
2) Extending often has two incompatible goals - extending to add access and extending to remove access. The inheritance proposal only addressed the first (though there was some discussion about the second). It is very hard to address access removal without adding deny rules (or some such) which is a path with _many_ potential problems.
3) I had suggested in that thread that reference policy interfaces / templates was a better solution to these problems. I think that I was wrong - these problems seem to still exist and haven't been adequately addressed via interfaces.
So - I'd like to consider this proposal again and see if anyone has any ideas on solving the objections.
Thanks,
Karl
--
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.
On Wed, 2007-09-12 at 12:24 -0400, Karl MacMillan wrote:
[...[
Quoted 8 lines
3) I had suggested in that thread that reference policy interfaces / templates was a better solution to these problems. I think that I was wrong - these problems seem to still exist and haven't been adequately addressed via interfaces.
So - I'd like to consider this proposal again and see if anyone has any ideas on solving the objections.
Just to note - using the inheritance technique would likely break the current reference policy encapsulation rules. In my view, that is not a large problem but I know others place more value on the encapsulation.
Karl
--
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.
On Thu, 2007-09-13 at 08:56 -0400, Daniel J Walsh wrote:
[...]
Quoted 16 lines
The best example of the need for inheritance is java/wine/mono/aida apps.
If a user runs one of these applications then they would need execmem, execstack Plus all of the existing privs of the user, plus all of the communications paths
So
xguest_tandxguest_java_tneed to be able to communicate fully together. Any time I add access toxguest_tI would expect that access to be added toxguest_java_t.I have experimented with doing this with attributes, attribute $1_user_type
allow $1_user_type ...Then you define
xguest_tandxguest_java_tasxguest_user_types
Quoted 9 lines
But this falls down when you call an interface that uses self
allow
xguest_user_typeself:fifo_filerw_fifo_file_perms;Does not allow
xguest_txguest_java_t:fifo_filerw_fifo_file_perms;So we need to look at every interface and make sure they don't use self.
But that is also the best example of the complication of this language
feature: sometimes you want the new type to be confined from the old type (the the related types - like httpd_conf_t in my example) and sometimes you don't want them confined as you describe above.
I'd like to have some way for the person defining the inherited type to make that choice so that it is useful when extending existing policies (i.e., make it useful for admins rather in addition to upstream policy developers).
Karl
--
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.