Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I've specified an AD security group in PAM to restrict which domain users can login. I've also restricted sessions for AD users to this group. This prevents a logged in user from doing an "su -" to an AD user outside of the group.

The Winbind uid mapping is configured so that AD users have UID >= 10000000.

These work as expected with the PAM configuration below.

/etc/pam.d/system-auth

auth        required      pam_env.so
auth        sufficient    pam_unix.so nullok try_first_pass
auth        requisite     pam_succeed_if.so user ingroup AD_group debug
auth        requisite     pam_succeed_if.so uid >= 500 quiet
auth        sufficient    pam_krb5.so use_first_pass
auth        sufficient    pam_winbind.so use_first_pass
auth        required      pam_deny.so

account     required      pam_access.so
account     required      pam_unix.so broken_shadow
account     sufficient    pam_localuser.so
account     sufficient    pam_succeed_if.so uid < 500 quiet
account     [default=bad success=ok user_unknown=ignore] pam_krb5.so
account     [default=bad success=ok user_unknown=ignore] pam_winbind.so
account     required      pam_permit.so

password    requisite     pam_cracklib.so try_first_pass retry=3
password    sufficient    pam_unix.so md5 shadow nullok try_first_pass use_authtok
password    sufficient    pam_krb5.so use_authtok
password    sufficient    pam_winbind.so use_authtok
password    required      pam_deny.so

session     [default=1 success=ignore] pam_succeed_if.so quiet uid >= 10000000
session     requisite     pam_succeed_if.so user ingroup AD_group debug
session     optional      pam_mkhomedir.so umask=0077 skel=/etc/skel
session     optional      pam_keyinit.so revoke
session     required      pam_limits.so
session     optional      pam_mkhomedir.so
session     [success=1 default=ignore] pam_succeed_if.so service in crond quiet use_uid
session     required      pam_unix.so
session     optional      pam_krb5.so

Now, I'd like to add a rule so that a specific AD user outside of AD_group can login. I tried adding the following line after line 3 in the file:

auth        requisite     pam_succeed_if.so user=AD_user_1 debug

But this resulted in all AD users being allowed to login.

Any insight would be appreciated.

share|improve this question
    
If that test succeeds, you'd want to skip the group membership test, so another [success=1 default=ignore] would probably be more appropriate than requisite. I'm still interested in seeing this question answered though. –  Andrew B Mar 1 '13 at 4:56

1 Answer 1

up vote 1 down vote accepted

All users succeeding in authentication is interesting, since that implies that the group membership test is now being ignored as well. (per my comment above, it doesn't look like you're skipping it) That sounds more like sufficient than requisite to me.

Have you double checked to make sure that you aren't testing against users who would pass the sufficient pam_unix.so condition? Check your shadow table and make sure that someone didn't add local passwords for users in your test pool when you weren't looking.

It's also possible that the auth module is being skipped (SSH key authentication comes to mind), in which case your access checks being in auth instead of account will pose a problem. Whether or not this is the cause, I recommend moving them to account so that you won't have holes in your access policy.

auth = anything related to authentication

account = anything related to authorization (access checks)

share|improve this answer
    
Thanks for pointing me in the right direction. I moved the auth lines to account and also noticed that pam_succeed_if.so requires a space between user = AD_user_1 –  kernelpanic Mar 15 '13 at 5:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.