trouble with ssh in today's rawhide + refpolicy
On a rawhide box updated this afternoon, running refpolicy trunk in mcs mode, I get the following after rebooting the box and logging in over ssh:
$ id -Z sysadm_u:sysadm_r:system_chkpwd_t:s0
After issuing a "service sshd restart" on the box and trying again, it changes to:
$ id -Z sysadm_u:sysadm_r:sysadm_t:s0
I've seen this on 2 different machines, and it persists even after a full filesystem relabel. Am i missing something from the refpolicy merge? I haven't changed my seusers file from when I was running strict.
Signature · 7 lines
Eamon Walsh <[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 6 lines · Eamon Walsh
On a rawhide box updated this afternoon, running refpolicy trunk in mcs mode, I get the following after rebooting the box and logging in over ssh:
$ id -Z sysadm_u:sysadm_r:system_chkpwd_t:s0After issuing a "service sshd restart" on the box and trying again, it changes to:
Should have used run_init to restart sshd. When I do this, it remains system_chkpwd_t. Also, I'm running in permissive mode and using public key to authenticate.
Some searching revealed previous bug reports, most recently Sept 21:
http://archives.gentoo.org/gentoo-hardened/msg_07021.xml
Signature · 7 lines
Eamon Walsh <[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.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 11 lines · Eamon Walsh
Quoted 9 lines · Eamon Walsh
On a rawhide box updated this afternoon, running refpolicy trunk in mcs mode, I get the following after rebooting the box and logging in over ssh:
$ id -Z sysadm_u:sysadm_r:system_chkpwd_t:s0After issuing a "service sshd restart" on the box and trying again, it changes to:
Quoted 8 lines
Should have used
run_initto restart sshd. When I do this, it remainssystem_chkpwd_t. Also, I'm running in permissive mode and using public key to authenticate.Some searching revealed previous bug reports, most recently Sept 21:
http://archives.gentoo.org/gentoo-hardened/msg_07021.xml
It sounds to me like sshd is not labeled correctly. Or perhaps the entire machine. What is sshd running as?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFHHdNQrlYvE4MpobMRAmNRAJ9XjTkqPfN3e18y+Ofhn4vWqg6vPwCfVMOt Wi8iSuVsdSkNvamccgS6dwc=
=ksSk
-----END PGP SIGNATURE-----
--
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 · Eamon Walsh
On a rawhide box updated this afternoon, running refpolicy trunk in mcs mode, I get the following after rebooting the box and logging in over ssh:
$ id -Z sysadm_u:sysadm_r:system_chkpwd_t:s0
Do you have ssh_sysadm_login on? Also, it seems odd that this would happen, since this combination doesn't show up in default_contexts, and the only auto transition to system_chkpwd_t from sshd_t is via chkpwd_exec_t.
Signature · 9 lines
Chris PeBenito Tresys Technology, LLC (410) 290-1411 x150 -- 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 11 lines · Christopher J. PeBenito
Quoted 5 lines · Eamon Walsh
On a rawhide box updated this afternoon, running refpolicy trunk in mcs mode, I get the following after rebooting the box and logging in over ssh:
$ id -Z sysadm_u:sysadm_r:system_chkpwd_t:s0Do you have
ssh_sysadm_loginon? Also, it seems odd that this would happen, since this combination doesn't show up indefault_contexts, and the only auto transition tosystem_chkpwd_tfromsshd_tis viachkpwd_exec_t.
We've seen this kind of behavior before when the get_ordered_context_list() logic fails to get any contexts from security_compute_user() that correspond with any of the partial contexts in default_contexts - it then falls back to just returning the entire reachable list.
get_ordered_context_list() really needs to be overhauled and replaced with a mostly userland solution, only consulting the kernel to get the list of roles and the default level for the user.
Signature · 8 lines
Stephen Smalley 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 13 lines · Stephen Smalley
Quoted 11 lines · Christopher J. PeBenito
Quoted 5 lines · Eamon Walsh
On a rawhide box updated this afternoon, running refpolicy trunk in mcs mode, I get the following after rebooting the box and logging in over ssh:
$ id -Z sysadm_u:sysadm_r:system_chkpwd_t:s0Do you have
ssh_sysadm_loginon? Also, it seems odd that this would happen, since this combination doesn't show up indefault_contexts, and the only auto transition tosystem_chkpwd_tfromsshd_tis viachkpwd_exec_t.
Quoted 5 lines
We've seen this kind of behavior before when the
get_ordered_context_list()logic fails to get any contexts fromsecurity_compute_user()that correspond with any of the partial contexts indefault_contexts- it then falls back to just returning the entire reachable list.
Ok. For some reason I always thought it would just fail if nothing worked from default_contexts.
Signature · 9 lines
Chris PeBenito Tresys Technology, LLC (410) 290-1411 x150 -- 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.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 12 lines · Christopher J. PeBenito
Quoted 11 lines · Stephen Smalley
Quoted 10 lines · Christopher J. PeBenito
Quoted 5 lines · Eamon Walsh
On a rawhide box updated this afternoon, running refpolicy trunk in mcs mode, I get the following after rebooting the box and logging in over ssh:
$ id -Z sysadm_u:sysadm_r:system_chkpwd_t:s0Do you have
ssh_sysadm_loginon? Also, it seems odd that this would happen, since this combination doesn't show up indefault_contexts, and the only auto transition tosystem_chkpwd_tfromsshd_tis viachkpwd_exec_t.
Quoted 9 lines
Quoted 5 lines
We've seen this kind of behavior before when the
get_ordered_context_list()logic fails to get any contexts fromsecurity_compute_user()that correspond with any of the partial contexts indefault_contexts- it then falls back to just returning the entire reachable list.Ok. For some reason I always thought it would just fail if nothing worked from
default_contexts.
I think that is what should happen, but it does not. -----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFHHfyXrlYvE4MpobMRAvQNAKCR6fWOHP0X6JWnq6eDNcgrl4soxQCgwrRr tO7ZGg5rSyioXl4LwdJD/9U=
=KTjm
-----END PGP SIGNATURE-----
--
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 · Christopher J. PeBenito
Quoted 4 lines · Eamon Walsh
On a rawhide box updated this afternoon, running refpolicy trunk in mcs mode, I get the following after rebooting the box and logging in over ssh:
$ id -Z sysadm_u:sysadm_r:system_chkpwd_t:s0Do you have
ssh_sysadm_loginon?
Nope, didn't have this set. That solves the problem, thanks.
Signature · 7 lines
Eamon Walsh <[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 22 lines · Daniel J Walsh
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1Quoted 18 lines · Christopher J. PeBenito
Quoted 16 lines · Stephen Smalley
Quoted 10 lines · Christopher J. PeBenito
Quoted 5 lines · Eamon Walsh
On a rawhide box updated this afternoon, running refpolicy trunk in mcs mode, I get the following after rebooting the box and logging in over ssh:
$ id -Z sysadm_u:sysadm_r:system_chkpwd_t:s0Do you have
ssh_sysadm_loginon? Also, it seems odd that this would happen, since this combination doesn't show up indefault_contexts, and the only auto transition tosystem_chkpwd_tfromsshd_tis viachkpwd_exec_t.We've seen this kind of behavior before when the
get_ordered_context_list()logic fails to get any contexts fromsecurity_compute_user()that correspond with any of the partial contexts indefault_contexts- it then falls back to just returning the entire reachable list.
Quoted 4 lines
Quoted 3 lines
Ok. For some reason I always thought it would just fail if nothing worked from
default_contexts.I think that is what should happen, but it does not.
Well, two observations:
- originally default_contexts was only supposed to specify defaults, not everything, so the system was supposed to work even if it was empty (but we have already migrated away from that to some degree),
- if we fail entirely in that case, then we'll fail even in permissive mode, unless the caller is also checking for permissive mode and has some fallback behavior in that case.
Signature · 8 lines
Stephen Smalley 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.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Quoted 6 lines · Eamon Walsh
Quoted 5 lines · Christopher J. PeBenito
Quoted 4 lines · Eamon Walsh
On a rawhide box updated this afternoon, running refpolicy trunk in mcs mode, I get the following after rebooting the box and logging in over ssh:
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
$ id -Z sysadm_u:sysadm_r:system_chkpwd_t:s0Do you have
ssh_sysadm_loginon?Nope, didn't have this set. That solves the problem, thanks.
You should never log in as root via ssh. :^)
I think you should fail to login in enforcing mode and return anything in permissive mode. Allowing the user to reach a shell as a random context is dangerous. As system_chkpwd_t I can read the /etc/shadow file. Although in reality I would figure the shell would not have access to the tty.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org
iD8DBQFHHjHkrlYvE4MpobMRAnyqAJ4stfK0JgY6Fe8292atFcrUXRmsegCg5biQ jWqGKGSVKrvvtrKzY13aec4=
=tS7D
-----END PGP SIGNATURE-----
--
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 · Eamon Walsh
Quoted 6 lines · Christopher J. PeBenito
Quoted 4 lines · Eamon Walsh
On a rawhide box updated this afternoon, running refpolicy trunk in mcs mode, I get the following after rebooting the box and logging in over ssh:
$ id -Z sysadm_u:sysadm_r:system_chkpwd_t:s0Do you have
ssh_sysadm_loginon?Nope, didn't have this set. That solves the problem, thanks.
I observed the same erroneous type today when I logged into X without xdm_sysadm_login set.
Signature · 7 lines
Eamon Walsh <[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.