Bug 865759 - Root can ssh when ssh_sysadm_login --> off in MLS
Root can ssh when ssh_sysadm_login --> off in MLS
Status: CLOSED ERRATA
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy (Show other bugs)
6.4
All Linux
urgent Severity urgent
: rc
: ---
Assigned To: Miroslav Grepl
Milos Malik
:
Depends On:
Blocks: 895654
  Show dependency treegraph
 
Reported: 2012-10-12 07:06 EDT by Michal Trunecka
Modified: 2014-09-30 19:33 EDT (History)
7 users (show)

See Also:
Fixed In Version: selinux-policy-3.7.19-193.el6
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2013-02-21 03:31:22 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Michal Trunecka 2012-10-12 07:06:35 EDT
Description of problem:
Root/sysadm_r can ssh even when ssh_sysadm_login is set to OFF in MLS.

Version-Release number of selected component (if applicable):
selinux-policy-doc-3.7.19-169.el6.noarch
selinux-policy-mls-3.7.19-169.el6.noarch
selinux-policy-3.7.19-169.el6.noarch
selinux-policy-minimum-3.7.19-169.el6.noarch
selinux-policy-targeted-3.7.19-169.el6.noarch


How reproducible:
always

Steps to Reproduce:
1. set MLS in /etc/selinux/config
2. setenforce 1
3. setsebool ssh_sysadm_login 0
4. ssh root/sysadm_r@IPADDR
  
Actual results:
$ ssh root/sysadm_r@192.168.122.19
root/sysadm_r@192.168.122.19's password: 
Last login: Fri Oct 12 12:14:28 2012 from 192.168.122.1
[root@dhcp-25-224 ~]# 

Expected results: (The same as in targeted policy)
$ ssh root/sysadm_r@192.168.122.19
root/sysadm_r@192.168.122.19's password: 
Last login: Fri Oct 12 13:02:36 2012 from 192.168.122.1
Connection to 192.168.122.19 closed.
Comment 1 Miroslav Grepl 2012-10-12 07:11:05 EDT
What does

# id -Z
Comment 2 Michal Trunecka 2012-10-12 07:19:52 EDT
As root after ssh:

# id -Z
root:sysadm_r:sysadm_t:s0-s15:c0.c1023
Comment 4 Miroslav Grepl 2012-10-15 15:19:53 EDT
Miro,
does we break MLS? Is there a test which contain this boolean?
Comment 6 RHEL Product and Program Management 2012-12-14 03:17:22 EST
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.
Comment 7 Miroslav Grepl 2012-12-14 05:29:26 EST
It looks like we will need to remove this boolean because of privsep patch.
Comment 8 David Egts 2013-01-08 14:14:09 EST
To add, not adding a role, sensitivity, and category fails as desired...

# ssh root@localhost
root@localhost's password: 
Unable to get valid context for root
Last login: Tue Jan  8 14:09:14 2013 from localhost
Connection to localhost closed.

But adding a role like sysadm_r causes it to succeed which isn't the desired behavior...

# ssh root/sysadm_r@localhost
root/sysadm_r@localhost's password: 
Last login: Tue Jan  8 14:09:36 2013 from localhost
[root@rhel6 ~]#

And adding a role and a sensitivity and/or category also causes a succeess which again isn't desired...

# ssh root/sysadm_r/U-TS@localhost
root/sysadm_r/U-TS@localhost's password: 
Last login: Tue Jan  8 14:10:37 2013 from localhost
[root@rhel6 ~]#
Comment 10 David Egts 2013-01-09 09:15:27 EST
For the sake of completeness, here are the cases w/ssh_sysadm_login disabled (default) and enabled on a RHEL 6 system fully patched with the MLS policy.

Essentially, the results are the same whether ssh_sysadm_login is disabled or enabled.  In other words, the boolean appears to have no effect.  The root login behavior is the same no matter what the boolean setting is.


# ssh_sysadm_login disabled (default) -- sysadm_r may not ssh in
================================================================
# boolean off (default)
[root@rhel6 ~]# getsebool ssh_sysadm_login
ssh_sysadm_login --> off
# root by itself cannot get in (desired result)
[root@rhel6 ~]# ssh root@localhost
root@localhost's password: 
Unable to get valid context for root
Last login: Wed Jan  9 08:57:21 2013 from localhost
Connection to localhost closed.
# root/sysadm_r can get in (not desired result)
[root@rhel6 ~]# ssh root/sysadm_r@localhost
root/sysadm_r@localhost's password: 
Last login: Wed Jan  9 08:59:22 2013 from localhost
[root@rhel6 ~]# logout
Connection to localhost closed.
# root/sysadm_r/U-TS can get in (not desired result)
[root@rhel6 ~]# ssh root/sysadm_r/U-TS@localhost
root/sysadm_r/U-TS@localhost's password: 
Last login: Wed Jan  9 08:59:43 2013 from localhost
[root@rhel6 ~]# logout
Connection to localhost closed.


# ssh_sysadm_login enabled -- sysadm_r may ssh in
=================================================
# boolean on
[root@rhel6 ~]# setsebool -P ssh_sysadm_login on
[root@rhel6 ~]# getsebool ssh_sysadm_login
ssh_sysadm_login --> on
# root by itself cannot get in (not desired result)
[root@rhel6 ~]# ssh root@localhost
root@localhost's password: 
Unable to get valid context for root
Last login: Wed Jan  9 09:00:09 2013 from localhost
Connection to localhost closed.
# root/sysadm_r can get in (desired result)
[root@rhel6 ~]# ssh root/sysadm_r@localhost
root/sysadm_r@localhost's password: 
Last login: Wed Jan  9 09:01:48 2013 from localhost
[root@rhel6 ~]# logout
Connection to localhost closed.
# root/sysadm_r/U-TS can get in (desired result)
[root@rhel6 ~]# ssh root/sysadm_r/U-TS@localhost
root/sysadm_r/U-TS@localhost's password: 
Last login: Wed Jan  9 09:02:09 2013 from localhost
[root@rhel6 ~]# logout
Connection to localhost closed.
Comment 11 Miroslav Grepl 2013-01-09 09:27:29 EST
> In other words, the boolean appears to have no effect.

Yes, this is caused by privsep patch in openssh. We have been discussing it with Dan and we believe we have a solution. But it needs to be tested. I will do a scratch build.
Comment 12 Miroslav Grepl 2013-01-14 03:56:38 EST
Ok, it looks fine with our solution. We need to get a fix ASAP for testing.
Comment 16 Miroslav Grepl 2013-01-15 07:35:24 EST
Fixed in selinux-policy-3.7.19-193.el6
Comment 30 errata-xmlrpc 2013-02-21 03:31:22 EST
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

http://rhn.redhat.com/errata/RHBA-2013-0314.html

Note You need to log in before you can comment on or make changes to this bug.