Setting loginuid
Hi,
The 2.6.11 kernel will have the /proc/pid/loginuid attribute that can be accessed to see what the original login uid was for a user's process. I remember several people on this list interested in this being implemented. There's 2 ways I'm considering for implementing the userspace portion of this feature and I wanted to get opinions/feedback.
1) Use pam to set the information "pre-fork" and let the child inherit the loginuid from the parent process. This muddies up the entry point program's information, but is easier to do.
2) patch all entry point programs to explicitly set the loginuid after the fork. This keep the parent process clean, but creates a lot of patches (20 - 30 programs).
Thanks,
-Steve Grubb
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
--
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 5 lines · --- Steve G
2) patch all entry point programs to explicitly set the loginuid after the fork.
This keep the parent process clean, but creates a lot of patches (20 - 30
programs).
Some programs that use PAM, including su, are not login sessions and hence must not set the loginuid. Because the definition of a login session is less clear than it might be I suggest that the individual programs will have to be responsible for determining if the loginuid should be set. There are also programs, cron comes to mind, that do not use pam (does it?) that do create login sessions.
=====
Casey Schaufler
[email protected]
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - Get yours free!
http://my.yahoo.com
--
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 3 lines · Casey Schaufler
Some programs that use PAM, including su, are
not login sessions and hence must not set the
loginuid.
That can be handled by not including the pam_audit or pam_loginuid (whatever it is called) module in the pam configuration for su (i.e. /etc/pam.d/su). It doesn't necessarily requiring patching the individual programs; it just means that you have to insert individual pam_audit entries in desired program-specific pam configuration files rather than just putting it in the generic system-auth one.
Signature · 8 lines
Stephen Smalley <[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.
Quoted 5 lines · --- Stephen Smalley
Quoted 3 lines · Casey Schaufler
Some programs that use PAM, including su, are
not login sessions and hence must not set the
loginuid.
Quoted 12 lines
That can be handled by not including the
pam_auditorpam_loginuid
(whatever it is called) module in the pam configuration for su (i.e./etc/pam.d/su). It doesn't necessarily requiring patching the
individual programs; it just means that you have to insert individualpam_auditentries in desired program-specific pam configuration files
rather than just putting it in the generic system-auth one.
You're correct. It would be possible to do su correctly using the PAM scheme. It would also be simple^H^H^H^H^H^H possible to configure the system incorrectly. There is never a case where you want the wrong behavior. It is better to hard code correctness that to make correct behavior a configuration option.
And that does not address cron.
=====
Casey Schaufler
[email protected]
__________________________________
Do you Yahoo!?
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
http://info.mail.yahoo.com/mail_250
--
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 2 lines
And that does not address cron.
vixie-cron 4.x is pamified so that should work for RHEL4/FC3.
Thanks,
-Steve Grubb
__________________________________
Do you Yahoo!?
The all-new My Yahoo! - What will yours do?
http://my.yahoo.com
--
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 · Casey Schaufler
You're correct. It would be possible to do su correctly using the PAM scheme. It would also be simple^H^H^H^H^H^H possible to configure the system incorrectly. There is never a case where you want the wrong behavior. It is better to hard code correctness that to make correct behavior a configuration option.
That seems like an argument against PAM in general, not just for this purpose. And somehow I doubt that PAM is going away any time soon...
Signature · 8 lines
Stephen Smalley <[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.
Quoted 3 lines · Steve G
1) Use pam to set the information "pre-fork" and let the child inherit the loginuid from the parent process. This muddies up the entry point program's information, but is easier to do.
One caveat with this approach: any pam modules run (and any helpers that they run) after the pam_audit module will then execute with this loginuid. We had an issue in this regard for pam_selinux that was resolved by bracketing the module stack with two instances of pam_selinux with separate open/close arguments to indicate whether each instance should perform its processing upon session open or close. This then ensured that the exec security context wasn't set until after all other pam modules (and their helpers) had run upon session open, and that it was cleared before any other pam modules upon session close.
Signature · 8 lines
Stephen Smalley <[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.