Samba and NFSv4 user-space server
For Samba it's possible for a single TCP connection to be used for multiple identities. This is standard practise for "Windws Terminal Server", and would be used when you specify different user-id's for different "net use" commands if the Windows SMB client code wasn't so buggy.
This means that having a separate SE Linux context for each copy of smbd would be impossible if full functionality is to be maintained, and in spite of this it would be really difficult to change the smbd code to make it re-exec itself every time someone authenticates.
I spent some time discussing the matter with Tridge, he seems quite convinced that SE Linux needs some method to allow an smbd to change security context for file system operations (similar in concept to setfsuid() perhaps).
After that Tridge and Linus spent some time discussing the possibility of having a method of storing all process context (UID, GID, supplemental GIDs, signal state, etc) and allowing a process to switch some large amount of it's process state with a single system call. They suggested having SE Linux context be part of this process state to be changed.
We don't want to allow wide and arbitary changing of context as setuid() allows. But allowing transitions between samba_user_t and samba_staff_t should be OK.
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.
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Russell" == Russell Coker <[email protected]> writes:
Russell> For Samba it's possible for a single TCP connection to be Russell> used for multiple identities. This is standard practise Russell> for "Windws Terminal Server", and would be used when you Russell> specify different user-id's for different "net use" Russell> commands if the Windows SMB client code wasn't so buggy.
[...]
Russell> We don't want to allow wide and arbitary changing of Russell> context as setuid() allows. But allowing transitions Russell> between samba_user_t and samba_staff_t should be OK.
Could you have the incoming TCP request go to a "wrapper" service that does nothing but redirect it to the "real" process that is already running with the correct UID/SE-Linux domain?
Not sure how feasible this is, or what sort of performance penalty it might have though.
Signature · 6 lines
Brian May <[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 10 lines · Brian May
Russell> We don't want to allow wide and arbitary changing of Russell> context as
setuid()allows. But allowing transitions Russell> betweensamba_user_tandsamba_staff_tshould be OK.Could you have the incoming TCP request go to a "wrapper" service that does nothing but redirect it to the "real" process that is already running with the correct UID/SE-Linux domain?
Not sure how feasible this is, or what sort of performance penalty it might have though.
That won't work. Samba supports having multiple identities on a single TCP connection, and NFSv4 supports similar things.
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.
Quoted 8 lines
Quoted 8 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Russell" == Russell Coker <[email protected]> writes:
Could you have the incoming TCP request go to a "wrapper"
service that does nothing but redirect it to the "real" process that is already running with the correct UID/SE-Linux domain?Not sure how feasible this is, or what sort of performance penalty it might have though.
Russell> That won't work. Samba supports having multiple Russell> identities on a single TCP connection, and NFSv4 supports Russell> similar things.
I may not have been very clear.
I am assuming that while the connection can have multiple identities, each request can only have on identity. I think this is the case for Samba, I could be mistaken.
My suggestion was to have one connection go to one process, which redirects the individual requests to other processes depending on the identity of that request.
I am suspicious this will fall into the "easier said then done" category.
Signature · 6 lines
Brian May <[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 9 lines · Brian May
Russell> That won't work. Samba supports having multiple Russell> identities on a single TCP connection, and NFSv4 supports Russell> similar things.
I may not have been very clear.
I am assuming that while the connection can have multiple identities, each request can only have on identity. I think this is the case for Samba, I could be mistaken.
You are correct.
Quoted 3 lines
My suggestion was to have one connection go to one process, which redirects the individual requests to other processes depending on the identity of that request.
Yes, this can be done, but requires proxying the operation to another process. It's something that we can look into, of course it will significantly increase the number of processes, and unless some trickery with shared file handles is done it will prevent using sendfile().
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.
Quoted 4 lines · Russell Coker
I spent some time discussing the matter with Tridge, he seems quite convinced that SE Linux needs some method to allow an smbd to change security context for file system operations (similar in concept to
setfsuid()perhaps).
I have implemented a fssid in my nfs work (which, hopefully, I will be releasing real soon now). The fssid is set based on the security context of the user passed in the nfs request. My modified SELinux will use the fssid to make the security decision for file operations if it is set. After the request is processed, the fssid is cleared. Of course, all of this is in the kernel, I haven't made that functionality available to the user space.
Signature · 7 lines
James Carter <[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.