The confusing dot operator
Hi,
I've been doing some MCS lately and I particularly started disliking the dot range operator, as in 'c0.c1023'.
It seems to be an underdeveloped way of saying 'all categories' or perhaps grouping them. I would welcome a 'star' operator that would do the former and a more intelligent naming mechanism to express the latter (ie. let's have a facility that can group 'dogs,cats,horses' as 'mammals' and 'mammals,insects' as 'animals').
It imposes a range where there isn't. The range is in fact dependent on the exact order of delaration. If you declare 'category c1; category c0; category c2;' then 'c0.c2' does not include c1. If you use named cats rather than c0-cN then even this little sense of range goes away.
Finally and most importantly sets of such 'consecutive' categories tend to get 'range-ized' at numerous places. If a seuser is assigned to have 'dogs,cats,rats' then semanage will tell you he's got 'dogs.rats', leaving you to figure out what's 'in between'.
What do the list members think about this?
Michal Svoboda
Quoted 16 lines · Michal Svoboda
Hi,
I've been doing some MCS lately and I particularly started disliking the dot range operator, as in 'c0.c1023'.
It seems to be an underdeveloped way of saying 'all categories' or perhaps grouping them. I would welcome a 'star' operator that would do the former and a more intelligent naming mechanism to express the latter (ie. let's have a facility that can group 'dogs,cats,horses' as 'mammals' and 'mammals,insects' as 'animals').
It imposes a range where there isn't. The range is in fact dependent on the exact order of delaration. If you declare 'category c1; category c0; category c2;' then 'c0.c2' does not include c1. If you use named cats rather than c0-cN then even this little sense of range goes away.
Quoted 6 lines
Finally and most importantly sets of such 'consecutive' categories tend to get 'range-ized' at numerous places. If a seuser is assigned to have 'dogs,cats,rats' then semanage will tell you he's got 'dogs.rats', leaving you to figure out what's 'in between'.
What do the list members think about this?
The c0.cN notation was introduced as a convenient shorthand as part of the rewrite of the MLS support in SELinux. It is as you say limited in its expressiveness and not well suited to general configuration of the category definitions, but nonetheless quite useful for MLS users, where most of the semantics for the categories are expressed in the mcstransd configuration and the user does not see the raw kernel contexts. It also serves a practical end - keeping context string sizes sane for kernel interfaces (/selinux/* and /proc/self/attr/*).
I think we're open to improvements in this area, but naturally we will need to retain compatibility for the current users of the dot notation. We have talked in the past about improving direct kernel support for complex label encodings, but unfortunately no one has really moved forward in that space.
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.
Quoted 1 line · Stephen Smalley
mcstransd
I tried to use this daemon at first but it appeared to require one translation line for each possible combination of the categories and even ranges of them. For example, on a particular centos 5 machine I have to specify
s0-s0:c0=coreprocess
s0-s0:c1=webprocess
s0:c0=core
s0:c1=web
Actually the same behavior is illustrated by the default
s0-s0:c0.c1023=SystemLow-SystemHigh
s0:c0.c1023=SystemHigh
confusingly enough, s0 does not equal SystemLow but an empty string.
I recall reading a presentation (IIRC from a symposium proceeding) that would suggest an improvement was planned here, but how far has that effort progressed?
OTOH I somehow feel safer to have the words 'core' and 'web' stored directly in the inode of the disk rather than rely on a run time mapping from some generic number. (That's why I don't like unix UID/GIDs too much either.)
Finally, it would appear that even the most smart mcstransd can't do too much about the 'rangeizing' feature. The kernel itself presents c0,c1,c2 as c0.c2, so mcstrans can only *guess* that there is a c1 in between. Or is there a way to query the kernel about the exact list of categories?
Quoted 2 lines
It also serves a practical end - keeping context string sizes sane for kernel interfaces (/selinux/* and
/proc/self/attr/*).
Does a category length such as 16 characters classify as 'sane' too, or is there a noticeable overhead?
Quoted 5 lines
I think we're open to improvements in this area, but naturally we will need to retain compatibility for the current users of the dot notation. We have talked in the past about improving direct kernel support for complex label encodings, but unfortunately no one has really moved forward in that space.
Do you have some pointers to these talks?
Regards,
Michal Svoboda
Quoted 15 lines · Michal Svoboda
Quoted 1 line · Stephen Smalley
mcstransd
I tried to use this daemon at first but it appeared to require one translation line for each possible combination of the categories and even ranges of them. For example, on a particular centos 5 machine I have to specify
s0-s0:c0=coreprocess
s0-s0:c1=webprocess
s0:c0=core
s0:c1=webActually the same behavior is illustrated by the default
Quoted 8 lines
s0-s0:c0.c1023=SystemLow-SystemHigh
s0:c0.c1023=SystemHighconfusingly enough, s0 does not equal SystemLow but an empty string.
I recall reading a presentation (IIRC from a symposium proceeding) that would suggest an improvement was planned here, but how far has that effort progressed?
A version of mcstrans that can associate bits to words and has considerably more flexibility is in fedora these days.
http://github.com/joenall/mcstrans
There has been some discussion of moving the master to userspace.selinuxproject.org.
Quoted 4 lines
OTOH I somehow feel safer to have the words 'core' and 'web' stored directly in the inode of the disk rather than rely on a run time mapping from some generic number. (That's why I don't like unix UID/GIDs too much either.)
I disagree. I prefer something on the inode with predictable, portable mathematical meaning. Adding web/code/fu/bar means that the policy on the object is dependent on yet another config file/policy because you need to encode the semantic meaning of those words somewhere. The beauty of the current approach is that the kernel doesn't have to know word semantics to do range dominance checks.
joe
Quoted 18 lines
Finally, it would appear that even the most smart mcstransd can't do too much about the 'rangeizing' feature. The kernel itself presents c0,c1,c2 as c0.c2, so mcstrans can only *guess* that there is a c1 in between. Or is there a way to query the kernel about the exact list of categories?
Quoted 2 lines
It also serves a practical end - keeping context string sizes sane for kernel interfaces (/selinux/* and
/proc/self/attr/*).Does a category length such as 16 characters classify as 'sane' too, or is there a noticeable overhead?
Quoted 5 lines
I think we're open to improvements in this area, but naturally we will need to retain compatibility for the current users of the dot notation. We have talked in the past about improving direct kernel support for complex label encodings, but unfortunately no one has really moved forward in that space.
Quoted 6 lines
Do you have some pointers to these talks?
Regards,
Michal Svoboda
--
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 1 line · Joe Nall
Thank you I will take a look when I get to it.
Quoted 11 lines
Quoted 4 lines
OTOH I somehow feel safer to have the words 'core' and 'web' stored directly in the inode of the disk rather than rely on a run time mapping from some generic number. (That's why I don't like unix UID/GIDs too much either.)
I disagree. I prefer something on the inode with predictable, portable mathematical meaning. Adding web/code/fu/bar means that the policy on the object is dependent on yet another config file/policy because you need to encode the semantic meaning of those words somewhere. The beauty of the current approach is that the kernel doesn't have to know word semantics to do range dominance checks.
I always thought that it was the c0 stuff that needed run time support to be semantical, at least to humans using it.
There is nothing more mathematical about c0.c1023 than there is about apple, banana and cherry. Categories have no ordering. What really matters here is the set inclusion operator (dominance).
About predictability I dare say that c0.c1023 attempts to create a fake sense of ordering where there is not. Therefore is slightly less predictable.
And I'm not sure what you mean by portability. If it means transferring categories between systems then with fixed notation like c0 there is only higher chance of conflicting with other uses for the categories on the target system.
While experimenting with this I found out that the biggest plus of the generic categories is that you do not need to reload policy, restart sshd, crond, etc. when you add new ones. (And God forbid removing them, I even managed to get a kernel panic while playing with MCS too much ;)
But I'm not sure if this is a problem. Change of categories is a change in security policy and that is a major enough event to require restart of services which authenticate users.
Michal Svoboda