pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: xenophon@irtnog.org
To: pgsql-bugs@postgresql.org
Subject: BUG #14040: Cannot authenticate against Active Directory in search+bind mode using domain root naming context
Date: Tue, 22 Mar 2016 18:28:31 +0000
Message-ID: <20160322182831.2911.62573@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

The following bug has been logged on the website:

Bug reference:      14040
Logged by:          Matthew X. Economou
Email address:      xenophon@irtnog.org
PostgreSQL version: 9.2.15
Operating system:   CentOS 7
Description:        

When authenticating PostgreSQL login roles against an Active Directory
domain in search+bind mode using the domain root naming context (NC) as the
search base, e.g., with an entry similar to the following in pg_hba.conf -
`host all all 0.0.0.0/0 ldap ldapserver=example.com
ldapbasedn="dc=example,dc=com" ldapbinddn=pgsql@EXAMPLE.COM
ldapbindpasswd=12345skrooB ldapsearchattribute=sAMAccountName ldaptls=1`,
PostgreSQL will fail to authenticate the user even though the user provided
the correct credentials.

1 - PostgreSQL's LDAP client will connect to a domain controller, bind using
the provided ldapbinddn/ldapbindpasswd, and perform a subtree search from
the domain root NC.  The domain controller will return the correct user
object plus referrals to the other Active Directory NCs, e.g.,
`cn=Configuration,dc=example,dc=com`, `cn=DomainDnsZones,dc=example,dc=com`,
and `cn=ForestDnsZones,dc=example,dc=com`.

2 - The LDAP client will chase the referrals automatically, but it binds to
each NC anonymously, after which it performs the same subtree search.  These
searches fail because Active Directory does not permit anonymous directory
searches by default.

3 - The LDAP client does not attempt to re-bind using the original search
results plus the user's password.  It seems that the search failures in step
2 trump the successful search results in step 1.

As a workaround one may specify a non-root search base, e.g.,
`ldapbasedn="ou=MyBusiness,dc=example,dc=com"`, which being more specific
causes the domain controller to not include referrals to other NCs.

Another workaround would be to disable referral chasing.  However, it does
not appear possible to disable LDAP referrals via postgresql.conf.  This
should be possible in the LDAP client library via ldap_set_option, i.e., by
setting `LDAP_OPT_REFERRALS` to `LDAP_OPT_OFF`.

The expected behavior is that PostgreSQL would perform all searches using
the provided credentials and that it would not ignore successful search
results.


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



Message-ID: <20160322182831.2911.62573@wrigleys.postgresql.org>
Permalink:  ../20160322182831.2911.62573@wrigleys.postgresql.org/
Also on:    postgresql.org/message-id/20160322182831.2911.62573@wrigleys.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: xenophon@irtnog.org
  Subject: Re: BUG #14040: Cannot authenticate against Active Directory in search+bind mode using domain root naming context
  In-Reply-To: <20160322182831.2911.62573@wrigleys.postgresql.org>
  References: <20160322182831.2911.62573@wrigleys.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox