RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1274244 - pam_unix does not return PAM_USER_UNKNOWN if user does not exist
Summary: pam_unix does not return PAM_USER_UNKNOWN if user does not exist
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: pam
Version: 7.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Tomas Mraz
QA Contact: BaseOS QE Security Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-22 10:58 UTC by Michael Fischer
Modified: 2015-10-22 12:13 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-10-22 12:04:15 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Michael Fischer 2015-10-22 10:58:14 UTC
pam_unix(8) does not return PAM_USER_UNKNOWN if the user does not exist in the local passwd(5)/shadow(5) files.  Therefore it's impossible to compose predicates in the pam.conf(5) file that involve them.

For example, suppose I want to compose a set of auth rules that look like the following, to enable 2-factor authentication (using pam_duo), whether the user is in the local authentication database or in LDAP:

auth        required      pam_env.so
auth        [user_unknown=ignore default=die] pam_unix.so nullok try_first_pass
auth        requisite     pam_ldap.so use_first_pass ignore_unknown_user
auth        requisite     pam_succeed_if.so uid >= 1000 quiet_success
auth        sufficient    pam_duo.so
auth        required      pam_deny.so

The Debian team enables this behavior already; see https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=204506

Comment 2 Tomas Mraz 2015-10-22 12:04:15 UTC
I do not think changing this behaviour of pam_unix in a released RHEL version is appropriate. Users might have already configurations that depend on this current behaviour.
Also there is pam_localuser which purpose is exactly that.

Comment 3 Michael Fischer 2015-10-22 12:13:45 UTC
Thanks for pointing me to pam_localuser.  Here's a solution that appears to work:

auth        required      pam_env.so
# Don't consult local password db (skip next statement) if user is unknown
auth        [user_unknown=1] pam_localuser.so
# If user is known in local password db, and validation fails, fail completely.
# If validation succeeds, skip LDAP validation.
auth        [success=1 new_authtok_reqd=ok ignore=ignore default=die]    pam_unix.so nullok try_first_pass
auth        requisite     pam_ldap.so use_first_pass
auth        requisite     pam_succeed_if.so uid >= 1000 quiet_success
auth        sufficient    pam_duo.so
auth        required      pam_deny.so


Note You need to log in before you can comment on or make changes to this bug.