Bug 740806

Summary: sshd should warn that connection will be dropped after expired password change
Product: Red Hat Enterprise Linux 6 Reporter: David Juran <djuran>
Component: opensshAssignee: Petr Lautrbach <plautrba>
Status: CLOSED WONTFIX QA Contact: BaseOS QE Security Team <qe-baseos-security>
Severity: low Docs Contact:
Priority: low    
Version: 6.1CC: dapospis, mvadkert, myllynen, pvrabec, sgallagh, ssorce, tmraz
Target Milestone: rcKeywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-02-29 11:51:43 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description David Juran 2011-09-23 12:18:25 UTC
Description of problem:
When trying to log in to an account where the password has expired, the user is prompted to change the password. So far so good, but right after the password is changed, the connection is dropped leaving the user with an impression that something went wrong. It would be better if ssh could just permit the user in after the password was changed rather then forcing him to log in again.

Version-Release number of selected component (if applicable):
openssh-5.3p1-52.el6_1.2

How reproducible:
Every time

Steps to Reproduce:
1. expire the password of an account
chage -d 0 -M 0 local

2. try to log in:
[djuran@localhost Desktop]$ ssh local.redhat.com
local.redhat.com's password: 
You are required to change your password immediately (root enforced)
Last login: Fri Sep 23 15:01:15 2011 from localhost
WARNING: Your password has expired.
You must change your password now and login again!
Changing password for user local.
Changing password for local.
(current) UNIX password: 
New password: 
Retype new password: 
passwd: all authentication tokens updated successfully.
Connection to rhel6.djuran.redhat.com closed.

3. Do note how the connection was dropped

Additional info:
For instance su let's the user in right away without having to re-authenticate:

[djuran@rhel6 ~]$ su - local
Password: 
You are required to change your password immediately (root enforced)
Changing password for local.
(current) UNIX password: 
New password: 
Retype new password: 
[local@rhel6 ~]$

Comment 2 RHEL Program Management 2011-10-07 16:02:44 UTC
Since RHEL 6.2 External Beta has begun, and this bug remains
unresolved, it has been rejected as it is not proposed as
exception or blocker.

Red Hat invites you to ask your support representative to
propose this request, if appropriate and relevant, in the
next release of Red Hat Enterprise Linux.

Comment 3 Tomas Mraz 2011-10-14 16:14:36 UTC
This is impossible. The ssh in the password-authentication method has to use passwd which is explicitly executed after the session is started. Unfortunately there is no exact way to be sure that the user really changed the password in the passwd command so the openssh must force the user to reconnect.

I suggest the customer to use keyboard-interactive authentication as a workaround.

Comment 4 Simo Sorce 2011-10-17 15:36:07 UTC
Sorry Tomas,
but I don't get it, why is it that ssh can't use the pam stack (which I believe will give you a better error reporting) and has to run passwd instead ?

If it *has* to drop the connection can you make ssh at least warn the user it will be disconnected after the password change ?

Comment 5 Tomas Mraz 2011-10-17 17:42:35 UTC
Yeah the warning could be added before the passwd is executed.

It could probably use the pam stack however it would require substantial changes to how the pam stack is called in sshd. Basically it could probably call the PAM calls that are called by passwd directly instead of passwd but I am not sure whether it would not interfere with other things in the SSH protocol anyway so it would have to drop the connection regardless of that.

But the warning seems like something that could be easily done.

Comment 6 Simo Sorce 2011-10-17 17:56:59 UTC
Ok in this case I am reopening this bug.
Feel free to defer it for the pam stack portion, but I think we should get at least the warning part.

Comment 7 Tomas Mraz 2011-10-17 18:20:38 UTC
Changing the summary accordingly.

Comment 11 Dalibor Pospíšil 2012-11-06 10:57:22 UTC
Setting qe_test_coverage‑. There is nothing to test.