Bug 6466

Summary: Cannot ssh onto target if 'pam' is in distro features, openssh is installed and there's password for root
Product: [Runtime] General Runtime Reporter: Chen Qi <Qi.Chen>
Component: General RuntimeAssignee: Chen Qi <Qi.Chen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: liezhi.yang, sgw
Version: 1.7   
Target Milestone: 1.7 M2   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: Don't know

Description Chen Qi 2014-06-19 06:07:18 UTC
To reproduce, use the following steps.

1. Add in local.conf the lines below.
DISTRO_FEATURES_append = " pam"
IMAGE_INSTALL_append = " openssh"
INHERIT += "extrausers"
EXTRA_USERS_PARAMS = "usermod -P 'root' root;"

2. bitbake core-image-minimal

3. runqemu qemux86 nographic

4. ssh root@192.168.7.2

After supplying the passwords, the following error appears and login via ssh fails.
       Write failed: Broken Pipe

//Chen Qi
Comment 1 Chen Qi 2014-07-02 06:06:49 UTC
It's confirmed that daisy and dora both have the same problem.

A workaround is to set 'ChallengeResponseAuthentication' to 'no' so that password authentication is done by ssh itself instead of PAM modules.
This is what ubuntu does.

But the root cause is that even if PAM is enabled, the ssh daemon still tries to authenticate an empty password. This authentication failure would mess things up with PAM modules.

//Chen Qi
Comment 2 Chen Qi 2014-07-08 08:57:49 UTC
Module: openembedded-core.git
Branch: master
Commit: e017ae71dad4837b0d22f291b0b0e0949075f822
URL:    http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=e017ae71dad4837b0d22f291b0b0e0949075f822

Author: Chen Qi <Qi.Chen@windriver.com>
Date:   Wed Jul  2 14:24:39 2014 +0800

openssh: avoid checking empty passwords to mess up with PAM modules

Previously, even if PAM is enabled for ssh, the daemon still tries to
authenticate an empty password. This leads to authentication failure
which would mess up with PAM modules.

As a result, if 'UsePAM', 'PermitEmptyPasswords' and 'PasswordAuthentication'
are enabled, no user can login correctly. We would meet the following error
message at the client side.

	Write failed: Broken Pipe

This patch fixes the above problem by checking whether PAM is enabled before
authenticating an empty password. After all, if PAM is enabled, the task of
authenticating passwords should be handled to PAM modules.

[YOCTO #6466]

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>