Bug 1154567 - Selinux blocks ssh
Summary: Selinux blocks ssh
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: selinux-policy
Version: 21
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Grepl
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-10-20 08:11 UTC by Tzach Shefi
Modified: 2014-10-28 21:49 UTC (History)
7 users (show)

Fixed In Version: selinux-policy-3.13.1-90.fc21
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-10-28 21:49:51 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)
Selinux audit.log (366.96 KB, text/plain)
2014-10-20 08:11 UTC, Tzach Shefi
no flags Details
Sealert parse of audit.log (10.18 KB, text/plain)
2014-10-20 08:13 UTC, Tzach Shefi
no flags Details

Description Tzach Shefi 2014-10-20 08:11:48 UTC
Created attachment 948456 [details]
Selinux audit.log

Description of problem:  While trying to ssh to my system : 
[tshefi@tshefi ~]$ ssh cougar12                                    
Warning: Permanently added 'cougar12,X.Y.Z.W' (RSA) to the list of known hosts.
root@cougar12's password:                                                            
                (*** There is delay of a few seconds here***) 
Last login: Mon Oct 20 09:29:37 2014
/bin/bash: Permission denied        
Connection to cougar12 closed. 

Note I've bypassed on my box the need to add user prefix root.z.w. when running ssh (I know less secure). 
I've also tired it with ssh root@cougar12, same error.

Version-Release number of selected component (if applicable):
Fedora release 21 (Twenty One)


How reproducible:
Not sure first time it happened to me.

Steps to Reproduce:
1. In my case the system was installed with Fedora20 and then upgraded to 21.
2. Try to ssh into machine, got error.
3. Using console via IPMI setenforce 0 
4. ssh now works.

Actual results: Can't ssh to system while selinux is enforceing
ssh cougar12
Warning: Permanently added 'cougar12,X.Y.Z.W' (RSA) to the list of known hosts.
root@cougar12's password:                                                            

Last login: Mon Oct 20 09:29:37 2014
/bin/bash: Permission denied        
Connection to cougar12 closed.

Expected results:
If ssh is enabled by default, a proper rule should be added on selinux.

Additional info:
Attached:
selinux audit log 
sealert -a /var/log/audit/audit.log

Comment 1 Tzach Shefi 2014-10-20 08:13:20 UTC
Created attachment 948457 [details]
Sealert parse of audit.log

Comment 2 Petr Lautrbach 2014-10-20 08:24:54 UTC
(In reply to Tzach Shefi from comment #0)
> Steps to Reproduce:
> 1. In my case the system was installed with Fedora20 and then upgraded to 21.

Did you use yum for that? Did you see any errror or warning messages during upgrade? Could you please check your logs and try to find something suspicious?

Your filetystem is apparently mis-labelled. Please check:
# ls -Z /usr/sbin/sshd 
# matchpathcon /usr/sbin/sshd

The outputs most probably differ. You can fix it using:

# fixfiles onboot 

and reboot.

Comment 3 Miroslav Grepl 2014-10-20 10:00:07 UTC
Did you use fedup?

Comment 4 Tzach Shefi 2014-10-20 10:29:51 UTC
Didn't use fedup, found out about this afterwords.

Used yum to upgrade https://fedoraproject.org/wiki/Upgrading_Fedora_using_yum
# rpm --import https://fedoraproject.org/static/95A43F54.txt
# yum update yum
# yum clean all
# yum --releasever=21 distro-sync --nogpgcheck
# yum install system-release-server

Don't recall getting any errors during upgrade, which log files would indicate any such errors? 

[root@cougar12 ~]# ls -Z /usr/sbin/sshd
-rwxr-xr-x. root root unconfined_u:object_r:bin_t:s0   /usr/sbin/sshd

[root@cougar12 ~]# matchpathcon /usr/sbin/sshd
/usr/sbin/sshd  system_u:object_r:sshd_exec_t:s0

Compared above to my RHEL6.5 got same results for both.

Ran fixfiles onboot, still same error.  

I'll email you system details if you wish to check your self.

Comment 5 Tzach Shefi 2014-10-20 10:38:34 UTC
Something odd just happened, I played around with selinux conf file, set to disabled, rebooted, then set to enforcing again, rebooted. 

Now ssh works fine with enforcing.

Comment 6 Miroslav Grepl 2014-10-21 11:00:55 UTC
It looks I found a bug in the policy which breaks f20->f21 update.

Comment 7 Adam Williamson 2014-10-21 15:31:40 UTC
mgrepl: would this affect a fedup upgrade too?

Comment 8 Miroslav Grepl 2014-10-21 15:39:57 UTC
(In reply to Adam Williamson (Red Hat) from comment #7)
> mgrepl: would this affect a fedup upgrade too?

I think so. We have builds which need to be tested.

Comment 9 Adam Williamson 2014-10-21 15:53:22 UTC
OK. I don't think this needs to be a blocker or FE bug, as packages used during upgrade are pulled from the 'fedora' repo, i.e. this can be fixed after Beta is unfrozen and people doing upgrades will get the fix.

Comment 10 Miroslav Grepl 2014-10-21 16:59:33 UTC
OK.

Lukas,
could you get a new f21 update with this fix?

Comment 11 Fedora Update System 2014-10-22 07:50:13 UTC
selinux-policy-3.13.1-88.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/selinux-policy-3.13.1-88.fc21

Comment 12 Lukas Vrabec 2014-10-22 07:51:26 UTC
done.

Comment 13 Fedora Update System 2014-10-22 19:13:15 UTC
Package selinux-policy-3.13.1-88.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.13.1-88.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-13454/selinux-policy-3.13.1-88.fc21
then log in and leave karma (feedback).

Comment 14 Fedora Update System 2014-10-23 16:20:55 UTC
Package selinux-policy-3.13.1-90.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing selinux-policy-3.13.1-90.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-13454/selinux-policy-3.13.1-90.fc21
then log in and leave karma (feedback).

Comment 15 Fedora Update System 2014-10-28 21:49:51 UTC
selinux-policy-3.13.1-90.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.


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