Skip to contentSkip to conversation

newrole failed in enforcing mode

DISCUSSION Carsten Grohmann 3 participants 8 messages Mar 10, 2004 – Mar 17, 2004 SELinux security module

lore
Share & tools
lore
#0 lore raw

Hi,

last week I've installed a topical fedora system (fc1) with the topical packages from the nsa site. After the installation the system runs fine, but today i want to change the role of the user root in the enforcing mode. This failed in contrast to the permissive mode. Newrole means invalid password and the syslog have only an entry "pam_unix authentication failure".

I've the same/similar problem using Chris LiveCD.

Have anybody similar problems? Does anybody know what the reason of this behavior?

Thanks

Carsten

--
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

On Mittwoch, 10. März 2004 16:50, Carsten Grohmann wrote:

[...]

Today I used strace to localize my pam problem and I get follow output:
2226 execve("/usr/bin/newrole", ["/usr/bin/newrole", "-r", "staff_r"], [/* 20 vars */]) = 0
2226 +++ killed by SIGKILL ++

"killed by SIGKILL" - which process send a sigkill only in the enforcing mode? In the permissive mode it runs and I don't get avc messages.

I use strace with various prgrams successfull:
- strace newrole in permissive mode
- strace ps ax --context in permissive and enforcing mode But an strace of passwd failed in the enforcing mode with an similar output?

Could it be that the pam libraries are reason of this behavior? Have anybody an idea to encircle this problem?

Thanks

Carsten

--
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 9 lines · Carsten Grohmann

Today I used strace to localize my pam problem and I get follow output:
2226 execve("/usr/bin/newrole", ["/usr/bin/newrole", "-r", "staff_r"], [/* 20 vars */]) = 0
2226 +++ killed by SIGKILL ++

"killed by SIGKILL" - which process send a sigkill only in the enforcing mode? In the permissive mode it runs and I don't get avc messages.

SELinux controls process tracing across domain transitions, for obvious reasons. On a ptrace permission failure during a domain-changing exec, SELinux will not perform the domain transition and will also send SIGKILL to the process to abort it, as this is the only way to convey an error from compute_creds.

Quoted 8 lines

I use strace with various prgrams successfull:
- strace newrole in permissive mode
- strace ps ax --context in permissive and enforcing mode But an strace of passwd failed in the enforcing mode with an similar output?

Could it be that the pam libraries are reason of this behavior? Have anybody an idea to encircle this problem?

To debug the newrole failure in enforcing mode, do a 'make enableaudit reload' in policy and then try using newrole, and review the audit messages. Some will be noise (and normally suppressed by dontaudit rules) but some may be relevant.

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

To debug the newrole failure in enforcing mode, do a 'make enableaudit reload' in policy and then try using newrole, and

"make enableaudit" was a good hint. The newrole domain needs read access to shadow_t. The attached patch grant this by using the auth attribute.

Greetings

Carsten

program/newrole_macros.te renamed from program/newrole_macros.te.orig +1 -1
@@ -10,7 +10,7 @@
 # $1_t is the domain for the program.
 # $1_exec_t is the type of the executable.
 #
-type $1_t, domain, privrole, privowner, privlog, auth_chkpwd, privfd $2;
+type $1_t, domain, privrole, privowner, privlog, auth_chkpwd, auth, privfd $2;
 in_user_role($1_t)
 role sysadm_r types $1_t;
 
#4 lore raw
Quoted 7 lines · Carsten Grohmann
Quoted 2 lines · Stephen Smalley

To debug the newrole failure in enforcing mode, do a 'make enableaudit reload' in policy and then try using newrole, and

"make enableaudit" was a good hint. The newrole domain needs read access to shadow_t. The attached patch grant this by using the auth attribute.

This should be handled by having pam_unix run the helper program when it cannot directly read /etc/shadow, and the helper program should run in a domain that can read /etc/shadow. Do you have the same problem with the latest pam package from the Fedora Core 2 development tree? The SRPMS from nsa.gov/selinux are a little old; I've hesitated to update them to the FC2 devel packages because some of those SRPMS wouldn't build or would fail regression tests for me on FC1 or even on FC2 test1.

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.
#5 lore raw
Quoted 5 lines · Stephen Smalley
Quoted 4 lines · Carsten Grohmann
Quoted 2 lines · Stephen Smalley

To debug the newrole failure in enforcing mode, do a 'make enableaudit reload' in policy and then try using newrole, and

Quoted 7 lines
Quoted 3 lines

"make enableaudit" was a good hint. The newrole domain needs read access to shadow_t. The attached patch grant this by using the auth attribute.

This should be handled by having pam_unix run the helper program when it cannot directly read /etc/shadow, and the helper program should run in a domain that can read /etc/shadow. Do you have the same problem with the

Of course that might not be the problem. Even when things are working perfectly with the correct PAM modules it will still try to access /etc/shadow and run unix_chkpwd when direct access fails.

I have found a problem where I can't change role from sysadm_r to staff_r, I still haven't got time to debug this.

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

Of course that might not be the problem. Even when things are working perfectly with the correct PAM modules it will still try to access /etc/shadow and run unix_chkpwd when direct access fails.

I have found a problem where I can't change role from sysadm_r to staff_r, I still haven't got time to debug this.

I just tried that, and it failed for me as well. After looking into it briefly, it appears that the 'role sysadm_r types system_chkpwd_t;' rule was dropped at some point, and that prevents correct operation of newrole from sysadm_r. If I add that back (e.g. to domains/programs/chkpwd.te), then newrole -r staff_r works again for me from root:sysadm_r:sysadm_t.

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

Of course that might not be the problem. Even when things are working perfectly with the correct PAM modules it will still try to access /etc/shadow and run unix_chkpwd when direct access fails.

I have found a problem where I can't change role from sysadm_r to staff_r, I still haven't got time to debug this.

Quoted 6 lines

I just tried that, and it failed for me as well. After looking into it briefly, it appears that the 'role sysadm_r types system_chkpwd_t;' rule was dropped at some point, and that prevents correct operation of newrole from sysadm_r. If I add that back (e.g. to domains/programs/chkpwd.te), then newrole -r staff_r works again for me from root:sysadm_r:sysadm_t.

role sysadm_r types system_chkpwd_t;
in_user_role(system_chkpwd_t)

I've put the above in newrole.te in my tree to solve this.

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.