Bug 1390267

Summary: ssh keeps asking for password even if there is permanent login failure
Product: Red Hat Enterprise Linux 7 Reporter: Dalibor Pospíšil <dapospis>
Component: opensshAssignee: Jakub Jelen <jjelen>
Status: CLOSED NOTABUG QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: low Docs Contact:
Priority: low    
Version: 7.3CC: szidek
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-14 07:44:08 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Dalibor Pospíšil 2016-10-31 15:17:04 UTC
Description of problem:
If user's shell does not exist, sshd makes a not of that in log but still lets client to attempt login with another password. Sshd could act similarly as when /bin/false or /sbin/nologin is used as a shell.
There's no point of letting client to try another password if it is obvious that the login will fail again.

Version-Release number of selected component (if applicable):
openssh-6.6.1p1-31.el7

How reproducible:
100%

Steps to Reproduce:
1. useradd test -s /xyz
2. echo test | passwd --stdin test
3. ssh test.0.1

Actual results:
# ssh test.0.1
test.0.1's password: 
Permission denied, please try again.
test.0.1's password: 
Permission denied, please try again.
test.0.1's password: 

# cat /var/log/secure
Oct 31 16:11:58 sopos-rhel7-brq sshd[19365]: User test not allowed because shell /xyz does not exist
Oct 31 16:11:58 sopos-rhel7-brq sshd[19365]: input_userauth_request: invalid user test [preauth]
Oct 31 16:11:59 sopos-rhel7-brq unix_chkpwd[19367]: password check failed for user (test)


Expected results:
# ssh test.0.1
test.0.1's password: 
Permission denied, permanent error, giving up.

Comment 1 Jakub Jelen 2016-10-31 15:24:28 UTC
Hello Dalibor. It is not a bug. It is a (security) feature.

You don't want to tell all the people on the internet that this account does not exists, does not have shell or does not have password. You want to behave the same way for all the accounts and not give any side channel information, which could be used against you.

I don't want to close the bug with the first comment so I will give you some time to think about it, if it is clear from my explanation (if not, feel free to ask). But certainly, we are not going to change this behavior.