Skip to contentSkip to conversation

Yet another question - newrole and xterm's

DISCUSSION Michael Reilly 3 participants 10 messages Oct 16, 2003 – Oct 18, 2003 SELinux security module

lore
Share & tools
lore
#0 lore raw

Sorry to keep asking questions - I am still relatively new to this and would like to make things as secure as possible. I am hoping to run selinux on my laptop along with an encrypted file system when I travel. (Disclaimers all read and understood - I know I am on my own and there are no guarantees, etc.)

Anyway on my system in enforcing mode -
% id
uid=200(michaelr) gid=200(staff) groups=200(staff),1(bin),6(disk),10(wheel),300(vmware) context=michaelr:staff_r:staff_t sid=287
% newrole -r sysadm_r
Authenticating michaelr.
Password:
newrole: incorrect password for michaelr
% id
uid=200(michaelr) gid=200(staff) groups=200(staff),1(bin),6(disk),10(wheel),300(vmware) context=michaelr:staff_r:staff_t sid=287

I found this in newrole.te.
# Failed reads to /proc cause no harm, so do not audit them dontaudit newrole_t proc_t:dir search;

changing the dontaudit line to this and reloading the policy allow newrole_t proc_t:dir search;

% newrole -r sysadm_r
Authenticating michaelr.
Password:
% id
uid=200(michaelr) gid=200(staff) groups=200(staff),1(bin),6(disk),10(wheel),300(vmware) context=michaelr:sysadm_r:sysadm_t sid=286
%

What is wrong on my system that I need to allow this instead of not auditing it? USE_PAM is defined and I am using PAM for login, etc.

Thanks,

michael

Signature · 8 lines
---- ---- ----
Michael Reilly    [email protected]
    Cisco Systems, Santa Cruz, CA

--
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.
#1 lore raw
Quoted 6 lines · Michael Reilly

I found this in newrole.te.
# Failed reads to /proc cause no harm, so do not audit them dontaudit newrole_t proc_t:dir search;

changing the dontaudit line to this and reloading the policy allow newrole_t proc_t:dir search;

This is peculiar, as newrole.te also includes:
can_setexec(newrole_t)

and can_setexec() includes:

	allow $1 proc_t:dir search;

So this permission should already be allowed. In fact, I see the following result in policy.conf without making any change:

$ grep 'allow newrole_t proc_t:dir' /etc/security/selinux/src/policy.conf
allow newrole_t proc_t:dir search;

I assume that the dontaudit rule is a legacy from the old SELinux, before the /proc/pid/attr API, where newrole did not have a legitimate need to access it.

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.
#2 lore raw
Quoted 8 lines · Stephen Smalley
Quoted 2 lines

changing the dontaudit line to this and reloading the policy allow newrole_t proc_t:dir search;

This is peculiar, as newrole.te also includes:
can_setexec(newrole_t)

and can_setexec() includes:

	allow $1 proc_t:dir search;

Yes, the idea is that you can use the same policy on old or new SE Linux. If you use it on the old SE Linux then /proc is unavailable. If you use it on the new SE Linux then can_setexec() covers it.

Michael, are you running old or new SE Linux?

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.
#3 lore raw
Quoted 5 lines · Russell Coker

Yes, the idea is that you can use the same policy on old or new SE Linux. If you use it on the old SE Linux then /proc is unavailable. If you use it on the new SE Linux then can_setexec() covers it.

Michael, are you running old or new SE Linux?

I understand now - he is using the old SELinux, based on his original posting to the selinux list (Slackware base with Russell's policy and the old 2.4-based SELinux from the August release).

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.
#4 lore raw

Exactly - I am using Russells' policy with the OLD_SELINUX variable on a 2.4.21 kernel patched using the August (old API) release of SElinux.

On two of my machines I use reiserfs on all of my partitions except for swap. I use jfs on the other machine (except for swap). I read that the backport of the new API to 2.4 kernels does not have extended attributes for reiserfs nor jfs. Since it would be difficult to switch to ext3 I stick with the old API until someone conforms that I can use the new API with my filesystems and have everything work. (more than you wanted to knwo, right? :-)).

thanks,

michael

Quoted 14 lines · On 16 Oct 2003 12:21:50 -0400 Stephen Smalley <[email protected]> wrote:
Quoted 5 lines · Russell Coker

Yes, the idea is that you can use the same policy on old or new SE Linux. If you use it on the old SE Linux then /proc is unavailable. If you use it on the new SE Linux then can_setexec() covers it.

Michael, are you running old or new SE Linux?

I understand now - he is using the old SELinux, based on his original posting to the selinux list (Slackware base with Russell's policy and the old 2.4-based SELinux from the August release).

Signature · 2 lines
Stephen Smalley <[email protected]>
National Security Agency
Signature · 8 lines
---- ---- ----
Michael Reilly    [email protected]
    Cisco Systems, Santa Cruz, CA

--
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.
#5 lore raw
In reply to Russell Coker

Hi,

I am running old SElinux. I verified last night - put the entry back as dontaudit and newrole says the password does not match - looking at the newrole.c code I think this is the result it received from PAM.

michael

Quoted 21 lines · On Fri, 17 Oct 2003 02:16:37 +1000 Russell Coker <[email protected]> wrote:
Quoted 8 lines · Stephen Smalley
Quoted 2 lines

changing the dontaudit line to this and reloading the policy allow newrole_t proc_t:dir search;

This is peculiar, as newrole.te also includes:
can_setexec(newrole_t)

and can_setexec() includes:

	allow $1 proc_t:dir search;

Yes, the idea is that you can use the same policy on old or new SE Linux. If you use it on the old SE Linux then /proc is unavailable. If you use it on the new SE Linux then can_setexec() covers it.

Michael, are you running old or new SE Linux?

Signature · 4 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
Signature · 8 lines
---- ---- ----
Michael Reilly    [email protected]
    Cisco Systems, Santa Cruz, CA

--
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.
#6 lore raw
Quoted 3 lines · Michael Reilly

I am running old SElinux.  I verified last night - put the entry back as dontaudit and newrole says the password does not match - looking at the newrole.c code I think this is the result it received from PAM.

What PAM modules are you using? Is anything logged to auth.log?

Signature · 11 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.
#7 lore raw

I am using the newrole entry in /etc/pam.d provided by the selinux install. I do not have it in front of me but I do recall it matches the one for su minus the rootok line.

I forgot about auth.log. I'll take a look tonight.

Thank you,

michael

Quoted 12 lines · On Fri, 17 Oct 2003 13:39:33 +1000 Russell Coker <[email protected]> wrote:
Quoted 3 lines · Michael Reilly

I am running old SElinux.  I verified last night - put the entry back as dontaudit and newrole says the password does not match - looking at the newrole.c code I think this is the result it received from PAM.

What PAM modules are you using? Is anything logged to auth.log?

Signature · 4 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
Signature · 9 lines
---- ---- ----
Michael Reilly    [email protected]
    Cisco Systems, Santa Cruz, CA


--
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.
#8 lore raw
In reply to Russell Coker

Thank you Russell - once again your help was invaluable.

su on my system requires pam_wheel.so so when newrole was installed newrole also required pam_wheel. No problem on a normal terminal.

However xterm is not allowed to update utmp so the getlogin() call made by pam_wheel.so returned NULL which made pam_wheel.so fail so newrole printed the "bad password" message.

You can pass an option to pam_wheel.so to use the UID and call getpwuid(getuid()) instead of getlogin() to determine the who the user is. Since using UIDs to identify a user is generally a bad thing for security reasons I did not take this approach.

Instead I commented out pam_wheel.so so any user may run newrole. Sounds like the way to go anyway.

Is there any reason to use pam_wheel.so with newrole? If so it would be fairly esy to modify pam_wheel.c to sue the same calls newrole uses to get the user name (get the context and call context_user_get(context); For now I'll leave pam_wheel.so commented out for newrole.

BTW - nothing was logged in auth.log. I enabled debug of the pam modules for newrole and found the problem quickly once I was pointed at the pam modules.

michael

Quoted 12 lines · On Fri, 17 Oct 2003 13:39:33 +1000 Russell Coker <[email protected]> wrote:
Quoted 3 lines · Michael Reilly

I am running old SElinux.  I verified last night - put the entry back as dontaudit and newrole says the password does not match - looking at the newrole.c code I think this is the result it received from PAM.

What PAM modules are you using? Is anything logged to auth.log?

Signature · 4 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
Signature · 9 lines
---- ---- ----
Michael Reilly    [email protected]
    Cisco Systems, Santa Cruz, CA


--
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.
#9 lore raw
Quoted 7 lines · Michael Reilly

Thank you Russell - once again your help was invaluable.

su on my system requires pam_wheel.so so when newrole was installed newrole also required pam_wheel. No problem on a normal terminal.

Instead I commented out pam_wheel.so so any user may run newrole. Sounds like the way to go anyway.

I agree. SE Linux determines who gets to change role/domain and how they can do it. pam_wheel is a clumsy attempt to do similar things and provides no benefit.

However a module similar to pam_wheel which checks the SE Linux context and does not permit changing UID unless the role is right could be a handy thing to make password guessing more difficult.

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.