Mantis - openssh
Viewing Issue Advanced Details
2725 upgrade block always 2008-01-02 12:53 2008-11-24 23:01
fathead  
yann  
normal  
closed  
fixed  
none    
none  
0002725: New version of openssh can not use PAM
I upgraded to the new version of openssh and was unable to log into the system. I am running Solaris 10 on two machines and I saw the problem on the first one I upgraded, tried to fix it and was unsuccessful. I then decided to make sure that the upgrade was the problem and upgraded my other box and the problem was repeated.
When trying to log in I get:

Password:
Connection to xxx closed by remote host.
Connection to xxx closed.

In the /var/log/authlog I get this error:

Dec 30 13:04:55 xxx sshd[5650]: [ID 800047 auth.crit] fatal: PAM: pam_setcred(): Failure setting user credentials

I can bypass the problem by changeing the sshd_config file to not use PAM.

Use PAM no

This will allow ssh to authenticate and accept the user.

Any help would be greatly appreciated!!

Trent

  
Issue History
2008-11-24 23:01 yann Status resolved => closed

Notes
(0005046)
yann   
2008-01-02 19:05   
Please:
 - send me your sshd_config and your /etc/pam.conf file
 - the output of \"uname -p\", \"uname -r\", \"pkginfo -l CSWossh CSWosslrt\"
 - set sshd to use PAM, \"truss -f -o /tmp/sshd.truss -p PID_OF_THE_SSHD_DAEMON\", try to login with ssh to reproduce your bug then send me the sshd.truss file.
(0005047)
yann   
2008-01-02 19:09   
Could you also try to install these packages on one of your machine.
I don\'t think it will solve your bug but in case:

http://www.blastwave.org/testing/openssl-0.9.8,REV=2007.12.26_rev=g-SunOS5.8-all-CSW.pkg.gz [^]
http://www.blastwave.org/testing/openssl_devel-0.9.8,REV=2007.12.26_rev=g-SunOS5.8-i386-CSW.pkg.gz [^]
http://www.blastwave.org/testing/openssl_devel-0.9.8,REV=2007.12.26_rev=g-SunOS5.8-sparc-CSW.pkg.gz [^]
http://www.blastwave.org/testing/openssl_rt-0.9.8,REV=2007.12.26_rev=g-SunOS5.8-i386-CSW.pkg.gz [^]
http://www.blastwave.org/testing/openssl_rt-0.9.8,REV=2007.12.26_rev=g-SunOS5.8-sparc-CSW.pkg.gz [^]
http://www.blastwave.org/testing/openssl_utils-0.9.8,REV=2007.12.26_rev=g-SunOS5.8-i386-CSW.pkg.gz [^]
http://www.blastwave.org/testing/openssl_utils-0.9.8,REV=2007.12.26_rev=g-SunOS5.8-sparc-CSW.pkg.gz [^]
(0005048)
fathead   
2008-01-02 19:27   
sshd_config
# $OpenBSD: sshd_config,v 1.68 2003/12/29 16:39:50 millert Exp $

# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.

# This sshd was compiled with PATH=/opt/csw/bin:/usr/bin:/usr/sbin:/usr/ccs/bin:/usr/local/bin

# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.

#Port 22
#Protocol 2,1
Protocol 2
#ListenAddress 0.0.0.0
#ListenAddress ::

# HostKey for protocol version 1
#HostKey /opt/csw/etc/ssh_host_key
# HostKeys for protocol version 2
#HostKey /opt/csw/etc/ssh_host_rsa_key
#HostKey /opt/csw/etc/ssh_host_dsa_key

# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768

# Logging
#obsoletes QuietMode and FascistLogging
SyslogFacility auth
LogLevel info

# Authentication:

#LoginGraceTime 2m
#PermitRootLogin yes
#StrictModes yes

#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile .ssh/authorized_keys

# For this to work you will also need host keys in /opt/csw/etc/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don\'t trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don\'t read the user\'s ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes

# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no

# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes

# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no

# GSSAPI options
#GSSAPIAuthentication no
#GSSAPICleanupCredentials yes

# Set this to \'yes\' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# \"PermitRootLogin without-password\". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
UsePAM yes

#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
PrintMotd no
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression yes
#ClientAliveInterval 0
#ClientAliveCountMax 3
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10

# no default banner path
#Banner /some/path

# override default of no subsystems
Subsystem sftp /opt/csw/libexec/sftp-server

**********************************************************************

/etc/pam.comf

#
#ident \"@(#)pam.conf 1.29 07/04/10 SMI\"
#
# Copyright 2007 Sun Microsystems, Inc. All rights reserved.
# Use is subject to license terms.
#
# PAM configuration
#
# Unless explicitly defined, all services use the modules
# defined in the \"other\" section.
#
# Modules are defined with relative pathnames, i.e., they are
# relative to /usr/lib/security/$ISA. Absolute path names, as
# present in this file in previous releases are still acceptable.
#
# Authentication management
#
# login service (explicit because of pam_dial_auth)
#
login auth requisite pam_authtok_get.so.1
login auth required pam_dhkeys.so.1
login auth required pam_unix_cred.so.1
login auth required pam_unix_auth.so.1
login auth required pam_dial_auth.so.1
#
# rlogin service (explicit because of pam_rhost_auth)
#
rlogin auth sufficient pam_rhosts_auth.so.1
rlogin auth requisite pam_authtok_get.so.1
rlogin auth required pam_dhkeys.so.1
rlogin auth required pam_unix_cred.so.1
rlogin auth required pam_unix_auth.so.1
#
# Kerberized rlogin service
#
#krlogin auth required pam_unix_cred.so.1
#krlogin auth required pam_krb5.so.1
#
# sshd service
#
sshd auth required pam_authtok_get.so.1 debug
sshd auth required pam_dhkeys.so.1
sshd auth sufficient pam_unix_auth.so.1
sshd auth required pam_ldap.so.1 use_first_pass debug
#
# rsh service (explicit because of pam_rhost_auth,
# and pam_unix_auth for meaningful pam_setcred)
#
rsh auth sufficient pam_rhosts_auth.so.1
rsh auth required pam_unix_cred.so.1
#
# Kerberized rsh service
#
#krsh auth required pam_unix_cred.so.1
#krsh auth required pam_krb5.so.1
#
# Kerberized telnet service
#
#ktelnet auth required pam_unix_cred.so.1
#ktelnet auth required pam_krb5.so.1
#
# PPP service (explicit because of pam_dial_auth)
#
ppp auth requisite pam_authtok_get.so.1
ppp auth required pam_dhkeys.so.1
ppp auth required pam_unix_cred.so.1
ppp auth required pam_unix_auth.so.1
ppp auth required pam_dial_auth.so.1
#
# Default definitions for Authentication management
# Used when service name is not explicitly mentioned for authentication
#
other auth requisite pam_authtok_get.so.1
other auth required pam_dhkeys.so.1
other auth required pam_unix_cred.so.1
other auth required pam_unix_auth.so.1
#
# passwd command (explicit because of a different authentication module)
#
passwd auth required pam_passwd_auth.so.1
#
# cron service (explicit because of non-usage of pam_roles.so.1)
#
cron account required pam_unix_account.so.1
#
# Default definition for Account management
# Used when service name is not explicitly mentioned for account management
#
other account requisite pam_roles.so.1
other account required pam_unix_account.so.1
other account required pam_ldap.so.1 use_first_pass
#
# Default definition for Session management
# Used when service name is not explicitly mentioned for session management
#
other session required pam_unix_session.so.1
#
# Default definition for Password management
# Used when service name is not explicitly mentioned for password management
#
other password required pam_dhkeys.so.1
other password requisite pam_authtok_get.so.1
other password requisite pam_authtok_check.so.1
other password required pam_authtok_store.so.1
#
# Support for Kerberos V5 authentication and example configurations can
# be found in the pam_krb5(5) man page under the \"EXAMPLES\" section.
#


************************************************************************
bash-3.2# pkginfo -l CSWossh CSWosslrt
   PKGINST: CSWossh
      NAME: openssh - OpenSSH Secure Shell
  CATEGORY: application
      ARCH: sparc
   VERSION: 4.7,REV=2007.12.18_rev=p1
   BASEDIR: /
    VENDOR: ftp://ftp.openbsd.org/pub/OpenBSD/OpenSSH/portable/ [^] packaged for CSW by Yann Rouillard
    PSTAMP: yann@osiris-20071218155922
  INSTDATE: Jan 02 2008 16:09
   HOTLINE: http://www.blastwave.org/bugtrack/ [^]
     EMAIL: yann@blastwave.org
    STATUS: completely installed
     FILES: 43 installed pathnames
                   6 shared pathnames
                  10 directories
                  14 executables
                   1 setuid/setgid executables
                6016 blocks used (approx)

   PKGINST: CSWosslrt
      NAME: openssl_rt - Openssl runtime libraries
  CATEGORY: application
      ARCH: sparc
   VERSION: 0.9.8,REV=2007.11.02_rev=g
   BASEDIR: /
    VENDOR: http://www.openssl.org/source/ [^] packaged for CSW by Yann Rouillard
    PSTAMP: yann@ra-20071102150816
  INSTDATE: Dec 30 2007 13:00
   HOTLINE: http://www.blastwave.org/bugtrack/ [^]
     EMAIL: yann@blastwave.org
    STATUS: completely installed
     FILES: 82 installed pathnames
                   6 directories
                  21 executables
               29782 blocks used (approx)

bash-3.2#
**********************************************************************

bash-3.2# uname -p
sparc
bash-3.2# uname -r
5.10

**********************************************************************

truss file emailed.
(0005058)
yann   
2008-01-03 19:31   
Could you add:
 sshd auth required pam_unix_cred.so.1
in your pam.conf file.

It should look like this:

 sshd auth requisite pam_authtok_get.so.1
 sshd auth required pam_dhkeys.so.1
 sshd auth required pam_unix_cred.so.1
 sshd auth sufficient pam_unix_auth.so.1
 sshd auth required pam_ldap.so.1 use_first_pass debug


Tell me if pam works with this setting.
(0005063)
yann   
2008-01-04 19:35   
I was able to reproduce your bug with the following sshd pam settings:

 sshd auth requisite pam_authtok_get.so.1
 sshd auth required pam_dhkeys.so.1
 sshd auth required pam_unix_auth.so.1

These settings work with openssh-4.6,REV=2007.08.24_rev=p1 but not with openssh-4.7,REV=2007.12.18_rev=p1

I tracked this bug to the following change between 4.6 and 4.7:

  20070813
   - (dtucker) [session.c] Bug 0001339: ensure that pam_setcred() is always
   called with PAM_ESTABLISH_CRED at least once, which resolves a problem
   with pam_dhkeys. Patch from David Leonard, ok djm@

which is linked to the following bug: https://bugzilla.mindrot.org/show_bug.cgi?id=1339 [^]

From what I read, I think your sshd pam settings were wrong and worked before because openssh didn\'t use the pam cred functions appropriately.

You should have stacked the pam_unix_cred module in your sshd pam configuration.

Can you confirm your problem is solved by adding this module (as explained in my previous bugnote) ?
Is there any reason you didn\'t use this module ?
(0005077)
fathead   
2008-01-07 13:25   
The addition to the pam.conf made the difference. I was not aware of the missing line and I am grateful for the update.

Thank you for your time!!
(0005078)
yann   
2008-01-07 14:30   
I am glad your problem is fixed.

I will then close this bug.