RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 865759 - Root can ssh when ssh_sysadm_login --> off in MLS
Summary: Root can ssh when ssh_sysadm_login --> off in MLS
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: selinux-policy
Version: 6.4
Hardware: All
OS: Linux
urgent
urgent
Target Milestone: rc
: ---
Assignee: Miroslav Grepl
QA Contact: Milos Malik
URL:
Whiteboard:
Depends On:
Blocks: 895654
TreeView+ depends on / blocked
 
Reported: 2012-10-12 11:06 UTC by Michal Trunecka
Modified: 2014-09-30 23:33 UTC (History)
7 users (show)

Fixed In Version: selinux-policy-3.7.19-193.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2013-02-21 08:31:22 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2013:0314 0 normal SHIPPED_LIVE selinux-policy bug fix and enhancement update 2013-02-20 20:35:01 UTC

Description Michal Trunecka 2012-10-12 11:06:35 UTC
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.122.19
root/sysadm_r.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.122.19
root/sysadm_r.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 11:11:05 UTC
What does

# id -Z

Comment 2 Michal Trunecka 2012-10-12 11:19:52 UTC
As root after ssh:

# id -Z
root:sysadm_r:sysadm_t:s0-s15:c0.c1023

Comment 4 Miroslav Grepl 2012-10-15 19:19:53 UTC
Miro,
does we break MLS? Is there a test which contain this boolean?

Comment 6 RHEL Program Management 2012-12-14 08:17:22 UTC
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 10:29:26 UTC
It looks like we will need to remove this boolean because of privsep patch.

Comment 8 David Egts 2013-01-08 19:14:09 UTC
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 14:15:27 UTC
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 14:27:29 UTC
> 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 08:56:38 UTC
Ok, it looks fine with our solution. We need to get a fix ASAP for testing.

Comment 16 Miroslav Grepl 2013-01-15 12:35:24 UTC
Fixed in selinux-policy-3.7.19-193.el6

Comment 30 errata-xmlrpc 2013-02-21 08:31:22 UTC
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.