Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOOyr-0003ZG-Ii for pgsql-general@arkaria.postgresql.org; Thu, 31 May 2018 14:55:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fOOyp-0007iy-Gp for pgsql-general@arkaria.postgresql.org; Thu, 31 May 2018 14:55:07 +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_SHA384:256) (Exim 4.89) (envelope-from ) id 1fOOyp-0007ii-8O for pgsql-general@lists.postgresql.org; Thu, 31 May 2018 14:55:07 +0000 Received: from hermes.gatewaynet.com ([193.92.121.98]) by magus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fOOyg-00015D-U3 for pgsql-general@lists.postgresql.org; Thu, 31 May 2018 14:55:06 +0000 Received: from smadev.internal.net (pc131.internal.net [10.9.200.131]) by hermes.gatewaynet.com (8.14.3/8.14.3/Debian-9.4) with ESMTP id w4VEsoXr002849 for ; Thu, 31 May 2018 17:54:55 +0300 Received: from smadev.internal.net (smadev [10.9.200.131]) by smadev.internal.net (8.15.2/8.15.2) with ESMTP id w4VEsoKn048858 for ; Thu, 31 May 2018 17:54:50 +0300 (EEST) (envelope-from achill@matrix.gatewaynet.com) From: Achilleas Mantzios Subject: Re: Login with LDAP authentication takes 5 seconds To: pgsql-general@lists.postgresql.org References: Message-ID: Date: Thu, 31 May 2018 17:54:50 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/alternative; boundary="------------6C2EB3CB7996DB2D876A7645" Content-Language: en-US X-Virus-Scanned: clamav-milter 0.98.7 at hermes X-Virus-Status: Clean X-Spam-Status: No, score=-27.0 required=5.0 tests=ALL_TRUSTED,DYN_HAM_COORD, DYN_HAM_IT,DYN_HAM_NAUTICAL,DYN_SPAM_MED6,HTML_MESSAGE autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on hermes.gatewaynet.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------6C2EB3CB7996DB2D876A7645 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit On 28/05/2018 17:26, Andreas Schmid wrote: > Hi, > > I configured my PostgreSQL 10 DB on Debian 9.2 with LDAP authentication (simple bind mode). While this basically works, it has the strange effect that the first login with psql takes around 5 > seconds. When I reconnect within 60 seconds, the login completes immediately. > > The LDAP server is behind a firewall. So for a test, in pg_hba.conf I put the LDAP servers IP address instead of its DNS name (for parameter ldapserver). Like that, all logins complete immediately. > But in general I prefer specifying the DNS name rather than the IP. > > When I checked on the DB machine with the following commands > host my.ldap.server.org > dig my.ldap.server.org > both always returned the host name and IP address of the LDAP server immediately. > > Does anyone of you have an explanation for this, or a hint, where I could do some further investigation? IPv4 vs IPv6 ? any strange timeouts? look in the postgresql logs for any messages. Also definitely ran wireshark, it'll tell you a lot on what's happening between postgresql and your LDAP . > > Thanks, > Andy > -- Achilleas Mantzios IT DEV Lead IT DEPT Dynacom Tankers Mgmt --------------6C2EB3CB7996DB2D876A7645 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit
On 28/05/2018 17:26, Andreas Schmid wrote:
Hi,

I configured my PostgreSQL 10 DB on Debian 9.2 with LDAP authentication (simple bind mode). While this basically works, it has the strange effect that the first login with psql takes around 5 seconds. When I reconnect within 60 seconds, the login completes immediately.

The LDAP server is behind a firewall. So for a test, in pg_hba.conf I put the LDAP servers IP address instead of its DNS name (for parameter ldapserver). Like that, all logins complete immediately. But in general I prefer specifying the DNS name rather than the IP.

When I checked on the DB machine with the following commands
host my.ldap.server.org
both always returned the host name and IP address of the LDAP server immediately.

Does anyone of you have an explanation for this, or a hint, where I could do some further investigation?
IPv4 vs IPv6 ? any strange timeouts? look in the postgresql logs for any messages.
Also definitely ran wireshark, it'll tell you a lot on what's happening between postgresql and your LDAP .

Thanks,
Andy


-- 
Achilleas Mantzios
IT DEV Lead
IT DEPT
Dynacom Tankers Mgmt
--------------6C2EB3CB7996DB2D876A7645--