Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1izJSe-0006PN-LB for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Feb 2020 12:07:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1izJSc-0008Mq-If for pgsql-bugs@arkaria.postgresql.org; Wed, 05 Feb 2020 12:07:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1izJSc-0008K1-Ae for pgsql-bugs@lists.postgresql.org; Wed, 05 Feb 2020 12:07:14 +0000 Received: from tamriel.snowman.net ([96.255.250.162]) by magus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1izJSa-0006nD-4O for pgsql-bugs@lists.postgresql.org; Wed, 05 Feb 2020 12:07:13 +0000 Received: by tamriel.snowman.net (Postfix, from userid 1000) id C90815F7A7; Wed, 5 Feb 2020 07:07:12 -0500 (EST) Date: Wed, 5 Feb 2020 07:07:12 -0500 From: Stephen Frost To: sujiplr@gmail.com, pgsql-bugs@lists.postgresql.org, Thomas Munro Subject: Re: BUG #16234: LDAP Query Message-ID: <20200205120712.GV3195@tamriel.snowman.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="N1kVai8uwBRJqYgQ" Content-Disposition: inline In-Reply-To: <16234-7846cd633d16a812@postgresql.org> User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --N1kVai8uwBRJqYgQ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline * PG Bug reporting form (noreply@postgresql.org) wrote: > I have a requirement to do authentication through LDAP, the LDAP query > should go to two different LDAP servers with dedicated binding users ( > different for two LDAP servers) , if the user is not available in first LDAP > then it should check in second LDAP. But here as per hba file , it won't > work in this model ( If there is no successful search in first hope, it will > throw error). > > So we have to do multiple query in the LDAP query string, how we can do > this? What kind of setup is this, that you have two LDAP servers involved..? That's certainly not a common setup that I've seen.. If what you actually have are two different Active Directory domains and you want users to be able to authenticate from either one, then you would typically place the PG server in one of them and then create a cross-realm trust between the two AD realms, so that users can gain access to resources in the other realm. In other words, if you have: - ABC.COM realm - XYZ.COM realm and your users exist in ABC.COM, and your PG server is in XYZ.COM, then you'd need a cross-realm trust, whereby XYZ.COM will trust the users being presented from ABC.COM. You can also enable the cross-realm trust in the other direction, if you want. Of course, users in XYZ.COM will already be able to authenticate to the PG server in the same realm. Note that the approach outlined above, and in general the better approach to use here, does *not* use LDAP; if you're in an environment like Active Directory which supports kerberos/GSS natively, and configure PG to use GSS. * Thomas Munro (thomas.munro@gmail.com) wrote: > Standard free warning: whenever using LDAP, be aware of cleartext > passwords visible to everyone on your network if you don't use > SSL/TLS, even if you are using SSL for the connection between client > and PostgreSQL. Further- no matter what you do, if you're using LDAP for auth with PG, the PG server will see the user's password, in cleartext, meaning that if the PG server is ever compromised, every user who logs into it after that will have their full network credentials stolen. The same is true with the PAM solution presented earlier. Basically, don't do it, it's not secure. Thanks, Stephen --N1kVai8uwBRJqYgQ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBCgAGBQJeOq/wAAoJEO1sijiDR2RVjccQAI+x12tc2VPgxe/fMOQ42tMx L3sNsyJQbIaUX0nvip95OYMdS2/Jc2gF1ehoHih1fXvCf69DRvi19NwYgcAaFHd/ PMdHaXMJPVjgIhTrWZvAg134HyHBxJnMYXVCUiFJ1q42sJQoZnW97xFsBhoE9v8e na/kb1hc1UK1BTlAZ/VbEzuxYTSWfBpLDXfNtfSqAflkSgqb8gxdG2XIOj3Cpqdp MRRtAzuzrb/kAJMFTGV+dulLY3N35kXXLN4cK+Vpa1xenOwhQxTfMvJv/1R8Ddaf eEybVD03SB3fKmzxwTrxGPV9MBLxFBpIhrb4BGDWNSxK1JyfPUJ6huEZI1cwVW3H WTGYKFT518nX3ic4YmcjZIjKY/2ApyQl4f7/rxzWfX1LzdwT4rd3ZPqbInE1oFl5 VYL+cc8DhcadteFbF/a1usMY+ALqP1XjpysV7TUqMfRIIHO2DgzFRn9PXC3kOATj ne+3kex5+BGvGhQhVF2SwR/F0/FEWMF0LpPYPeyIj5gAmbEUrYf1ZlwOcNkSB119 62B3/vBABvnIk6DLI5ToynNk6vTBU5XwVr4LYS/SNUrkscT5CG9vKR1Jfxna/1EQ ylS3qVBRCuq/QOg+eKsFhuQPc/YrwMKnpWX9oyqWkbS2BlB5cmdwZ1oeJG3e54+J SWcvSX1tLkuWsrjenAMY =PS4c -----END PGP SIGNATURE----- --N1kVai8uwBRJqYgQ--