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 1fNgYt-0007oB-F1 for pgsql-general@arkaria.postgresql.org; Tue, 29 May 2018 15:29:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fNgYr-0008TO-QT for pgsql-general@arkaria.postgresql.org; Tue, 29 May 2018 15:29:21 +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 1fNgYr-0008TE-I2 for pgsql-general@lists.postgresql.org; Tue, 29 May 2018 15:29:21 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by magus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fNgYo-0003SY-2H for pgsql-general@postgresql.org; Tue, 29 May 2018 15:29:21 +0000 Received: from smtp2.mailbox.org (smtp2.mailbox.org [80.241.60.241]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 6ABC144AC0; Tue, 29 May 2018 17:29:16 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp2.mailbox.org ([80.241.60.241]) by spamfilter01.heinlein-hosting.de (spamfilter01.heinlein-hosting.de [80.241.56.115]) (amavisd-new, port 10030) with ESMTP id xW7gkI6_5GNW; Tue, 29 May 2018 17:29:15 +0200 (CEST) Message-ID: <1527607753.2393.18.camel@cybertec.at> Subject: Re: Login with LDAP authentication takes 5 seconds From: Laurenz Albe To: Andreas Schmid , pgsql-general@postgresql.org Date: Tue, 29 May 2018 17:29:13 +0200 In-Reply-To: References: Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Andreas Schmid wrote: > 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? I would run a network trace with timestamps to see where the time is spent. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com