Bug 848 - OpenSSH_3.8.1p1 - passwd -f does not work
Summary: OpenSSH_3.8.1p1 - passwd -f does not work
Status: ASSIGNED
Alias: None
Product: Portable OpenSSH
Classification: Unclassified
Component: ssh (show other bugs)
Version: 3.8.1p1
Hardware: HPPA HP-UX
: P2 major
Assignee: OpenSSH Bugzilla mailing list
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-04-21 14:28 AEST by Michael
Modified: 2019-06-09 09:19 AEST (History)
1 user (show)

See Also:


Attachments
server-log (8.23 KB, text/plain)
2004-04-21 14:31 AEST, Michael
no flags Details
Client_log (9.90 KB, text/plain)
2004-04-21 14:33 AEST, Michael
no flags Details
serverlog_shadow_installed (15.97 KB, text/plain)
2004-04-21 19:53 AEST, Michael
no flags Details
serverlog_noshadow_usepamno (14.12 KB, text/plain)
2004-04-21 19:55 AEST, Michael
no flags Details
serverlog_noshadow_usepamyes (20.84 KB, text/plain)
2004-04-21 19:56 AEST, Michael
no flags Details
Add debug for pw_age (1.18 KB, patch)
2004-04-21 22:09 AEST, Darren Tucker
no flags Details | Diff
Patch for honouring expired passwords in HP-UX (1.76 KB, patch)
2005-09-27 02:42 AEST, senthilkumar
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Michael 2004-04-21 14:28:08 AEST
sshd skips passwd -f <username>  password expiry when runs with "UsePAM no"
option.
Comment 1 Michael 2004-04-21 14:31:32 AEST
Created attachment 609 [details]
server-log
Comment 2 Michael 2004-04-21 14:33:42 AEST
Created attachment 610 [details]
Client_log

sshd skips passwd change while Telnet prompts for a password change
Comment 3 Darren Tucker 2004-04-21 14:59:19 AEST
Comment on attachment 609 [details]
server-log 

[snip]
>debug3: mm_request_receive entering
>debug2: userauth_pubkey: authenticated 0 pkalg ssh-dss
>Failed publickey for mid from 127.0.0.1 port 49365 ssh2

The server log appears incomplete, there should be a section that looks like:
debug3: monitor_read: checking request 10
debug3: auth_shadow_pwexpired: today 12529 sp_lstchg 12407 sp_max 99999

Could you please attach that.

Also, what are the shadow settings in config.h?  Do "grep SHADOW config.h"
after running configure.
Comment 4 Michael 2004-04-21 19:53:35 AEST
Created attachment 611 [details]
serverlog_shadow_installed

server-log with following options
1.shadow password installed
2.usepam no
Comment 5 Michael 2004-04-21 19:55:25 AEST
Created attachment 612 [details]
serverlog_noshadow_usepamno

server log with following options
1. No shadow passwords in system
2. usepam no
Comment 6 Michael 2004-04-21 19:56:51 AEST
Created attachment 613 [details]
serverlog_noshadow_usepamyes

server-log with following options
1.No shadow passwords
2.UsePAM yes
Comment 7 Thomas Binder 2004-04-21 21:21:02 AEST
Michael, do you use password login? It seems with UsePAM=no, the
password expiry code is only used for password logins, but not when
using for example public key logins.

At least, I only find one call to auth_shadow_pwexpired, which is
in auth-passwd.c
Comment 8 Kumar 2004-04-21 21:56:40 AEST
Yes. It has been mentioned that the authentication used was password 
authentication. 

In sshd_config, the configurations are:
UsePAM no
ChallengeResponseAuthentication no
PasswordAuthentication yes

A member in the passwd structure in HP-UX decides the password aging and it 
is "char pw_age". [try "man 4 passwd" on HP-UX systems for details]. This is 
applicable for /etc/passwd file only. 

ssh code properly checks for the expired passwords with shadow passwords, with 
the field "spw->sp_expire" [function "auth_shadow_acctexpired()" in auth-
shadow.c]. Thats why it works with Shadow passwords.

So, IMHO, there has to be a check for the "pw_age" member when sshd is 
configured with "UsePAM no" and if the system do not have shadow support, as 
this case use /etc/passwd file. 
Comment 9 Darren Tucker 2004-04-21 22:09:28 AEST
Created attachment 615 [details]
Add debug for pw_age

That seems pretty much right, the only wrinkle is that "passwd -f" does not
seem to set pw_age:
debug1: passwd gNrjkysyT2/LM pw_age

while /etc/passwd looks like this:
testuser:gNrjkysyT2/LM,..:203[...]
Comment 10 Darren Tucker 2005-01-24 22:11:33 AEDT
Since the non-shadow age does not appear in the password field or pw_age field
as returned by the OS, I don't see how sshd can handle this.

Does anyone know how to check the password age in this case?
Comment 11 senthilkumar 2005-09-12 20:59:08 AEST
I have some idea. But before trying them, I need one clarification, the 
attachment id=615 deals with aging in auth-shadow.c. Is this checking of 
password aging in /etc/passwd should be done there or moved to auth-passwd.c. 
which would be the right place?
Comment 12 Darren Tucker 2005-09-19 12:25:26 AEST
(In reply to comment #11)
> Is this checking of 
> password aging in /etc/passwd should be done there or moved to auth-passwd.c. 
> which would be the right place?

I don't think it matters much right now.  I'd be more interested to see the code
that can reliably detect this condition, then we can work out where is best fits.

Since auth-passwd.c is present in both OpenBSD's sshd and Portable's, additions
to it represent an ongoing maintenance hassle.  In general, we prefer to avoid
unnecessary differences in files that must be kept synced.
Comment 13 senthilkumar 2005-09-27 02:42:19 AEST
Created attachment 968 [details]
Patch for honouring expired passwords in HP-UX

The attached patch detect expired passwords when run with "Usepam no". If
needed Im interested in implementing this fix on auth-passwd.c
Comment 14 beer 2019-06-09 09:19:45 AEST
auth-passwd.c