Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tOYRT-0078R3-A4 for pgsql-admin@arkaria.postgresql.org; Fri, 20 Dec 2024 08:33:03 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tOYRS-007OWK-Cg for pgsql-admin@arkaria.postgresql.org; Fri, 20 Dec 2024 08:33:02 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tOYRR-007OV1-TU for pgsql-admin@lists.postgresql.org; Fri, 20 Dec 2024 08:33:01 +0000 Received: from cloud.gatewaynet.com ([185.90.37.94]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tOYRO-000WOo-Ky for pgsql-admin@lists.postgresql.org; Fri, 20 Dec 2024 08:33:00 +0000 Content-Type: multipart/alternative; boundary="------------OvveDvcllP0bv7ouB3EDQMhd" Message-ID: <83c50b58-a8a7-4526-85db-fecc649aa561@cloud.gatewaynet.com> Date: Fri, 20 Dec 2024 10:32:54 +0200 MIME-Version: 1.0 Subject: Re: How To Configure PostgreSQL to Use LDAP for Authentication To: pgsql-admin@lists.postgresql.org References: Content-Language: en-US From: Achilleas Mantzios - cloud In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------OvveDvcllP0bv7ouB3EDQMhd Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 12/6/24 16:15, Henry Ashu wrote: > Hi, > > Please, I need help with how to configure postgresql to use LDAP for > Authentication. > * > * > *Here is what I have tried;* > > host all all 0.0.0.0/0 ldap > ldapserver=ldap://adserver.domain.com > ldapport=389 ldapprefix="DOMAIN\" ldapsuffix="" > ldapbinddn=postgres-user@domain.com ldapbindpasswd=mypassword > > > host    all             all 0.0.0.0/0         ldap >        ldapurl="ldaps://adserver.domain.com:636 > " ldapbasedn="OU=Users,OU=England > 053,OU=Commercial Services,DC=domain,DC=com" > ldapbinddn="postgres-user@domain.com" ldapbindpasswd="mypassword" > ldapsearchattribute="OU=Users,OU=England 053,OU=Commercial > Services,DC=domain,DC=com" > > > > host    all             all 0.0.0.0/0         ldap >         ldapserver="adserver.domain.com " >     ldapport=636     ldapscheme="ldaps" > ldapbasedn="OU=Users,OU=England 053,OU=Commercial > Services,DC=domain,DC=com"     ldapbinddn="OU=Users,OU=England > 053,OU=Commercial Services,DC=domain,DC=com" > ldapbindpasswd="mypassword" ldapsearchattribute="adservice-account" > > * > * > *And this is the error I'm getting;* > > [postgres@myserver ~]$ psql -U myuser mydatabase > psql: error: connection to server on socket > "/run/postgresql/.s.PGSQL.5432" failed: FATAL:  no pg_hba.conf entry > for host "[local]", user "myuser", database "mydatabase", no encryption > [postgres@myserver ~]$ psql -U "MYDOMAIN\myuser" mydatabase > psql: error: connection to server on socket > "/run/postgresql/.s.PGSQL.5432" failed: FATAL:  no pg_hba.conf entry > for host "[local]", user "MYDOMAIN\myuser", database "mydatabase", no > encryption Fix your pg_hba.conf, LDAP is the least of your problems. > > Thank you > > *Henry Ashu* > > Database Administrator > *o:* 503.672.5114 | *f:* 800.551.8821 | DAT.com > > DAT Solutions Like us on Facebook > Follow us on Twitter > Connect with us on LinkedIn > Visit our YouTube > Channel Visit us on Instagram > --------------OvveDvcllP0bv7ouB3EDQMhd Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit


On 12/6/24 16:15, Henry Ashu wrote:
Hi,

Please, I need help with how to configure postgresql to use LDAP for Authentication. 

Here is what I have tried;

host all all 0.0.0.0/0 ldap ldapserver=ldap://adserver.domain.com ldapport=389 ldapprefix="DOMAIN\" ldapsuffix="" ldapbinddn=postgres-user@domain.com ldapbindpasswd=mypassword


host    all             all             0.0.0.0/0         ldap        ldapurl="ldaps://adserver.domain.com:636" ldapbasedn="OU=Users,OU=England 053,OU=Commercial Services,DC=domain,DC=com" ldapbinddn="postgres-user@domain.com" ldapbindpasswd="mypassword" ldapsearchattribute="OU=Users,OU=England 053,OU=Commercial Services,DC=domain,DC=com"



host    all             all             0.0.0.0/0         ldap         ldapserver="adserver.domain.com"     ldapport=636     ldapscheme="ldaps"     ldapbasedn="OU=Users,OU=England 053,OU=Commercial Services,DC=domain,DC=com"     ldapbinddn="OU=Users,OU=England 053,OU=Commercial Services,DC=domain,DC=com"     ldapbindpasswd="mypassword"     ldapsearchattribute="adservice-account"


And this is the error I'm getting;

[postgres@myserver ~]$ psql -U myuser mydatabase
psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: FATAL:  no pg_hba.conf entry for host "[local]", user "myuser", database "mydatabase", no encryption
[postgres@myserver ~]$ psql -U "MYDOMAIN\myuser" mydatabase
psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: FATAL:  no pg_hba.conf entry for host "[local]", user "MYDOMAIN\myuser", database "mydatabase", no encryption
Fix your pg_hba.conf, LDAP is the least of your problems.

Thank you

Henry Ashu

Database Administrator
o: 503.672.5114 | f: 800.551.8821 | DAT.com

DAT Solutions    Like us on Facebook  Follow us on Twitter  Connect with us on LinkedIn  Visit our YouTube Channel  Visit us on Instagram
--------------OvveDvcllP0bv7ouB3EDQMhd--