Making MCS mandatory
I have implemented a change to the MCS policy to make it mandatory. So far in my own tests it does what it is supposed to do. I would like to get some feedback from people on this list before putting it in to rawhide, it's the most significant change to MCS since it's inception...
The low level of the range for a process determines the default context for a created file. The default configuration of the MCS policy has a low level of "s0" for all user login sessions. I believe that the vast majority of systems will not differ from the default in this regard. Therefore what I propose below will not make an impact on most users. Targeted policy is designed to be minimally invasive, I expect that at least 90% of Fedora users don't notice it's presence or even know that it is there. MCS is an extension to the same theme, people who use targeted policy can choose to ignore it (whether they have no interest in SE Linux or just no interest in anything other than the domain-type model) and it won't affect them. Mandatory MCS will be just as minimally invasive to MCS users. People who really use MCS now (as opposed to people who just have the default configuration and have everything running at s0-s0:c0.c255) will probably have all accounts with s0 as the low level and thus notice no immediate difference from my changes.
The latest MCS policy does not permit increases in the high level of the sensitivity range except through logging in again, but does allow changes to the low level without restriction.
For MCS to be a mandatory policy there would need to be controls over changing the low level of the range for a child process. So if the process was not permitted to lower the low level of it's range then it would be mandatory for all files created by the user to have all categories assigned to the low level of their range. Similar restrictions would also be needed on file relabel, ptrace, etc.
Finally if the low level of the process range is not dominated by the level of a file then writes to the file would be denied. This final point could potentially make a Mandatory MCS system difficult to use, however as such a configuration is optional (as explained in para 1) it should not cause any problems.
The changes to the MCS constraints are:
For file write operations { write setattr append unlink link rename create relabelto } I added ((l1 domby l2) or (t2 == mcstrustedobject)).
The mcstrustedobject attribute is an analogy of mlstrustedobject. I am only using it to override the mandatory access of the file (currently the only file type in question that matches is security_t and I want the high level enforced, if we extend MCS to control access to device nodes then we will still want it this way as the devices in question all default to s0). Let me know if you think I should use a different attribute name for this.
For process transition and dyntransition I changed ( h1 dom h2 ) to ( ( h1 dom h2 ) and ((l1 domby l2) or (t1 == mcssetlow)) ). Note that I haven't actually used the mcssetlow attribute yet. If you think that mcssetlow is a bad name then please suggest another.
For ptrace I added (l1 domby l2) to the constraint. This prevents a process from escaping from it's level by ptracing a process which runs at a lower level.
Finally as an independent issue to MMCS I have put the more important parts of /selinux as c0.c255.
Here is a summary of the differences between Mandatory MCS and MLS:
MLS bases read access controls on the effective clearance (the low level of the range) and thus effective read access equals the minimum level for writes. This makes it impossible to relabel data to a lower level. In MCS it is sometimes desirable that discretion to relabel data to a lower level be granted. So a user running at s0:c0.c10:s0:c0.c100 can read a file that has s0:c11 and write the data to a file running at s0:c0.c10. This is considered a benefit in the MCS design, the user has some categories for which they have discretionary access and some for which the access is mandatory. Which categories are mandatory is initially determined by the administrator through semanage, but can also be determined by the user for their child processes. Under MMCS if my shell runs at s0:c1-s0:c0.c10 I can run the command
"runcon -l s0:c1.c2-s0:c1.c4 bash" and then prevent all further processes from accessing data with categories c0 and c5.c10 and also forcing all written data to have categories c1.c2.
The RPMs for rawhide and the patch are at the following URL:
http://people.redhat.com/rcoker/pol/
Signature · 9 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.
Quoted 4 lines · Russell Coker
I have implemented a change to the MCS policy to make it mandatory. So far in my own tests it does what it is supposed to do. I would like to get some feedback from people on this list before putting it in to rawhide, it's the most significant change to MCS since it's inception...
It seems ok, but I don't understand the requirements for the change.
- James
Signature · 7 lines
James Morris <[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.
Quoted 7 lines · James Morris
Quoted 4 lines · Russell Coker
I have implemented a change to the MCS policy to make it mandatory. So far in my own tests it does what it is supposed to do. I would like to get some feedback from people on this list before putting it in to rawhide, it's the most significant change to MCS since it's inception...
It seems ok, but I don't understand the requirements for the change.
Firstly having all processes run with a low level of s0 such that all files are created with no categories by default is not adequate, particularly with no MCS controls on directories. I believe that using other low level values is necessary for correct MCS functionality.
Once we accept the need for a low level for serious use (which will mean less than 10% of users at a rough guess) it logically follows that it is desirable to have the low level not be lowered arbitrarily.
Dan has just suggested an issue with this change, it requires changes to home directory labeling to give the home directory the correct low level, otherwise the user won't be able to write to their .bashrc etc. Incidentally this is also a MLS issue which demonstrates a benefit for MMCS in terms of MLS development.
Signature · 9 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.