Bug 868167 - Top-level config entry of PAM PTA plugin is ignored when multiple instances are configured
Top-level config entry of PAM PTA plugin is ignored when multiple instances a...
Status: CLOSED NOTABUG
Product: Red Hat Enterprise Linux 6
Classification: Red Hat
Component: 389-ds-base (Show other bugs)
6.4
All Linux
high Severity high
: rc
: 6.4
Assigned To: Rich Megginson
Sankar Ramalingam
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2012-10-19 04:10 EDT by Ján Rusnačko
Modified: 2012-11-06 13:27 EST (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2012-11-06 13:27:17 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Ján Rusnačko 2012-10-19 04:10:35 EDT
Description of problem:

One of new added functionalities of PAM PTA is support for multiple configuration entries. To be backward compatible, top-level configuration entry cn=PAM Pass Through Auth,cn=plugins,cn=config is still valid configuration entry. In addition to that, each child is also expected to be PAM PTA config entry. However, top-level config entry is being ignored when a child entry is present, and only child entries configure plugins behavior.

Version-Release number of selected component (if applicable):
tested on 389-ds-base-1.2.11.15-2.el6.x86_64

How reproducible:
always

Steps to Reproduce:
One way to reproduce is to setup top-level config entry to include ldap user and set child config entry to exclude user. Both instances have fallback set to false. When user tries to bind, top-level entry is ignored, and user binds. If however child config entry is set to include user entry, then user bind fails on 32 - user does no exist in PAM.

USERD="uid=tuserD, ..."

1) Add user $USERD
ldapmodify -h $IP -p $PORT -D "cn=directory manager" -w Secret123 <<EOF
dn: $USERD
changetype: add
...
userPassword: password
EOF

2) configure top-level entry to include $USERD and deny fallback
ldapmodify -h $IP -p $PORT -D "cn=directory manager" -w Secret123 <<EOF
dn: cn=PAM Pass Through Auth,cn=plugins,cn=config
changetype: modify
replace: nsslapd-pluginEnabled
nsslapd-pluginEnabled: on
-
replace: pamFallback
pamFallback: FALSE
-
replace: pamIncludeSuffix
pamIncludeSuffix: $USERD
EOF

3) configure child entry to exclude $USERD and deny fallback
ldapmodify -h $IP -p $PORT -D "cn=directory manager" -w Secret123 <<EOF
dn: cn=inst2,cn=PAM Pass Through Auth,cn=plugins,cn=config
changetype: add
cn: test1
objectClass: pamConfig
objectClass: top
pamIDMapMethod: RDN DN ENTRY
pamFallback: FALSE
pamSecure: FALSE
pamService: ldapserver
pamExcludeSuffix: $USERD
pamMissingSuffix: ALLOW
pamIDAttr: uid
EOF

4) restart server
service dirsrv restart

5) try to bind as $USERD
ldapsearch -h $IP -p $PORT -D "$USERD" -w password -b "$USERD"

Actual results:
echo $?
0

Expected results:
ldap_bind: No such object (32)

    additional info: User id [tuserD] for bind DN [uid=tuserD,dc=suf1,dc=example,dc=com] does not exist in PAM

Additional info:
​https://fedorahosted.org/389/attachment/ticket/181/0001-ticket-181-Allow-PAM-passthru-plug-in-to-have-multip.patch: "When the normal area in cn=config is used, both the top-level PAM passthru plug-in config entry and it's children are considered to be config entries."
Comment 1 Ján Rusnačko 2012-10-19 04:11:39 EDT
Upstream ticket https://fedorahosted.org/389/ticket/492
Comment 2 Nathan Kinder 2012-10-29 15:44:23 EDT
Upstream ticket:
https://fedorahosted.org/389/ticket/492
Comment 3 Nathan Kinder 2012-11-06 13:27:17 EST
Comments from the upstream ticket:



The problem here is that you have 2 overlapping config entries. The logic isn't designed to have the PAM passthru plug-in fall through when a configuration entry fails to work for authenticating a user. When a bind attempt comes in, the logic is as follows:

    Loop through the PAM passthru config entries to see if the include/exclude suffix and filter settings apply to the bind target.
    Use the first matching config entry with PAM to authenticate user.
    Return BIND result to client. 

There is no fallback logic. In your test scenario, the child config entry (cn=inst2,...) is checked first when we are looping through the config entries. When you exclude $USERD in the child entry, that config doesn't apply, so the top-level config entry is used. When you change the child to include $USERD, the child entry does apply, and that config entry is used instead of the top-level config.

The behavior described  by design. The intention of allowing multiple PAM passthru configuration settings is to have separate configuration for separate entries (via suffix, filter, or a combination of the two). Having multiple configuration entries that apply to the same set of bind target entries is beyond the scope of the current design. This also matches up with the way most of the other DS plug-ins work that support multiple config entries.

I'm closing this as NOTABUG.

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