Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 87930 - Code Listing 4.2: /etc/pam.d/system-auth contains incorrect order of entries
Summary: Code Listing 4.2: /etc/pam.d/system-auth contains incorrect order of entries
Status: RESOLVED FIXED
Alias: None
Product: [OLD] Docs-user
Classification: Unclassified
Component: Other (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Sven Vermeulen (RETIRED)
URL: http://www.gentoo.org/doc/en/ldap-how...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-04 10:22 UTC by Tom Murphy
Modified: 2005-04-16 12:37 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom Murphy 2005-04-04 10:22:00 UTC
The code listing 4.2 contains entries which will not work properly with OpenSSH for authentication. Namely, the pam_ldap.so and pam_unix.so entries need to be flip-flopped.

Reproducible: Always
Steps to Reproduce:
1. Follow instructions in HOWTO
2. Attempt to log on with SSH
3. SSH fails

Actual Results:  
Logins will fail with SSH, however su will know about the users as well as other
utilities.

Expected Results:  
Log in properly with ssh.

Code listing needs to be changed to:

auth    required    /lib/security/pam_env.so
auth    sufficient  /lib/security/pam_unix.so likeauth nullok
auth    sufficient  /lib/security/pam_ldap.so use_first_pass
auth    required    /lib/security/pam_deny.so

account sufficient  /lib/security/pam_unix.so
account sufficient  /lib/security/pam_ldap.so
account required    /lib/security/pam_deny.so

password    required /lib/security/pam_cracklib.so retry=3 type=
password    sufficient /lib/security/pam_ldap.so use_authtok
password    sufficient /lib/security/pam_unix.so nullok use_authtok md5 shadow
password    required /lib/security/pam_deny.so

session required    /lib/security/pam_limits.so
session required    /lib/security/pam_unix.so
session required     /lib/security/pam_mkhomedir.so skel=/etc/skel/ umask=0
session optional    /lib/security/pam_ldap.so

Another important thing to note is, if /etc/ldap.conf has "rootbinddn" defined,
it will also break SSH's authentication.
Comment 1 Sven Vermeulen (RETIRED) gentoo-dev 2005-04-05 08:59:20 UTC
Is there a way to have both (ssh logins and su/other apps knowing of the user)?
Comment 2 Sven Vermeulen (RETIRED) gentoo-dev 2005-04-07 09:40:24 UTC
I've added a note that, if ssh fails, you should interchange those two lines, but that you might find out that other tools like su will fail.

This way we have both. A default that works for some reasons, and information on what to do if you don't want to.
Comment 3 Tom Murphy 2005-04-07 17:20:18 UTC
su seems to work with the lines the way I indicated. I am guessing that order DOES matter in any pam.d file, however, I'm not sufficiently knowledgable about how it all works, I managed to fix it that way.
Comment 4 Tom Murphy 2005-04-11 03:35:52 UTC
I found strange problems with normal login (not even with ssh).
With the order 'as is' with the listing on the docs page, the normal login at console will fail the first password, but then when it goes back to the prompt and you type the same username in again, it logs in without a password.

Switching the two auth lines fixes that behavior, but then su fails.

I was able to fix by having the following in system-auth:

auth       required     /lib/security/pam_env.so
auth       sufficient   /lib/security/pam_unix.so likeauth nullok
auth       sufficient   /lib/security/pam_ldap.so use_first_pass
auth       required     /lib/security/pam_deny.so

account    required     /lib/security/pam_unix.so
account    sufficient   /lib/security/pam_ldap.so

password   required     /lib/security/pam_cracklib.so retry=3
password   sufficient   /lib/security/pam_unix.so nullok md5 shadow use_authtok
password   sufficient   /lib/security/pam_ldap.so use authtok
password   required     /lib/security/pam_deny.so

session    required     /lib/security/pam_mkhomedir.so skel/etc/skel/ umask=0
session    required     /lib/security/pam_limits.so
session    required     /lib/security/pam_unix.so
session    optional     /lib/security/pam_ldap.so

It seems to work fine for all cases.
Comment 5 Sven Vermeulen (RETIRED) gentoo-dev 2005-04-16 12:37:01 UTC
Thanks. I've updated the guide per your system-auth; the account facility should be okay with this.