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 1fsss4-0005PK-5H for pgsql-admin@arkaria.postgresql.org; Thu, 23 Aug 2018 16:54:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fsss0-00017n-2y for pgsql-admin@arkaria.postgresql.org; Thu, 23 Aug 2018 16:54:04 +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 1fssrz-00017g-OJ for pgsql-admin@lists.postgresql.org; Thu, 23 Aug 2018 16:54:03 +0000 Received: from mail-wr1-x442.google.com ([2a00:1450:4864:20::442]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fssru-0004AM-VL for pgsql-admin@lists.postgresql.org; Thu, 23 Aug 2018 16:54:03 +0000 Received: by mail-wr1-x442.google.com with SMTP id g33-v6so5208410wrd.1 for ; Thu, 23 Aug 2018 09:53:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:references:in-reply-to:subject:date:message-id:mime-version :thread-index:content-language; bh=wzX5NTqiiArnHYGEJH2UMzfe14tGrUOwgYAT0O6ku4s=; b=G7ih1WZyvLKp1gcoX6imDdgl9L2gcHIYtbAbtDAXDjUz7xJQYdzCsSvgrh17Z90WQE hCnNw2/tvtA/kSOjp1e/xweMCzZow1pklauDniILrekBwi109FFBfxhKigaeY6FqKxkd qsQIxDJVvW8PadCljm/xtuoasp0ZQ2sPj2TBHs0UqSAwTyv2U3atNzvdSSpdY5OJYR4y yni36Sv3hn20S5/Nw4Q+l4heoJcw97kD6YPuGrbx/bqpp1RcFzZijkdkztyD5ARB35gq xm6ghM+qEOj5eRb+F0bX2NRgD1YT8S1J2lnFK6Tz2gyZV6KPpwapCzxpz8Gz8pzDvdPc jOeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:references:in-reply-to:subject:date :message-id:mime-version:thread-index:content-language; bh=wzX5NTqiiArnHYGEJH2UMzfe14tGrUOwgYAT0O6ku4s=; b=LXYWilkFjjd6qfiA0HnF0d7qUElBdVLb+NOBnQ88vPCJWOmzd66WIBZxAL20od0LR6 7K1y4NTn79E/mIkldi+jHIGmiGkpmjL/eIGCAuMPaCXHGv2UBxO8kYtOnDo7WV6o5wz8 7XaqJztTSSf2lZiLS0crtgWhawJR04jU2Wx1af5TDO3UVj5/eamVyKEb0vzZ/86XVHUp gaRIS9PhxNbI4SHsYlyiRbDkiZYZSUqzyoRHs912MReGNAnZ8BqFiFvl0UPNftt7u1SI UKMW7Y6QXZ422Zzpvvb+6uAlfMZwtjHwLx2WCZgJ5raVoXlmekDNuVXLYSiV7P+AHw5w If5g== X-Gm-Message-State: APzg51BFrUnncK4AMQDVSdIdZt9Ll+ztCE/2CjfD5xNmfYVCkFbkfQR/ dYCzXwZlrR28ME69/tBqFTkjZW4e X-Google-Smtp-Source: ANB0VdYuky1sOb0PBSHUbEgHXVf1yT9scrra0yFiGqd4vc11U316gO9t7l7SZxjC8HngoYXXTOlSWQ== X-Received: by 2002:adf:fb81:: with SMTP id a1-v6mr18355838wrr.219.1535043235489; Thu, 23 Aug 2018 09:53:55 -0700 (PDT) Received: from LAPTOPE7EH7MDP (167.221-30-62.static.virginmediabusiness.co.uk. [62.30.221.167]) by smtp.gmail.com with ESMTPSA id q21-v6sm2426795wmq.3.2018.08.23.09.53.54 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 23 Aug 2018 09:53:54 -0700 (PDT) From: "Mark Williams" To: "'Wim Bertels'" , , References: <032401d43326$6c275d80$44761880$@gmail.com> <034901d4333f$d2aa7650$77ff62f0$@gmail.com> <076401d43883$89ec6830$9dc53890$@gmail.com>,<4ea1e251-0aa2-be17-4405-d1ccec951ecc@sirap.fr> <1534771775784.73685@ucll.be>,<077b01d43895$51aad620$f5008260$@gmail.com> <1534925952974.49431@ucll.be> In-Reply-To: <1534925952974.49431@ucll.be> Subject: RE: Setting up SSL for postgre Date: Thu, 23 Aug 2018 17:53:55 +0100 Message-ID: <09bf01d43b01$e12213e0$a3663ba0$@gmail.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_NextPart_000_09C0_01D43B0A.42E7B460" X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQJ64nPKQfAewiPZ9t7gQ7SiT+1fnwIMhi/1AcD6KUcCiXXq5QDWmBXZAZlEObIB3ICezALgGU7vAsAuaGSi/iCcAA== Content-Language: en-gb List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multipart message in MIME format. ------=_NextPart_000_09C0_01D43B0A.42E7B460 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Hi Wim, =20 I did intend Cert aut (at least I think I did!). =20 Still cannot connect to postgre database from my client app using = FireDAC. I can connect fine from PGAdmin3 on the same machine using the same certificates. =20 The call made by FireDAC to libPQ.Dll is the following: =20 PQconnectdb [ConnInfo=3Dhostaddr=3D192.168.0.12 port=3D5432 = dbname=3Drees user=3Dpostgres password=3D*** connect_timeout=3D10 sslmode=3Drequire sslrootcert=3DC:\ProgramData\MWC\Viewer\Certs\root.crt sslcert=3DC:\ProgramData\MWC\Viewer\Certs\postgresql.crt sslkey=3DC:\ProgramData\MWC\Viewer\Certs\postgresql.key password=3D1234, Result=3D$0000000003B262B0] 13222564840001 17:41:04.681 . ERROR: connection requires a valid = client certificate [Status=3D1] =20 The SSLmode is set to require when I connect with PGAdmin. So = presumably, there is no problem with the certificates. Is there anything that jumps = out from the FireDAC output as to why the SSL connection doesn=92t work? =20 Many thanks, =20 Mark __ =20 From: Wim Bertels =20 Sent: 22 August 2018 09:19 To: Mark Williams ; pgsql-admin@lists.postgresql.org; s.dunand@sirap.fr Subject: Re: Setting up SSL for postgre =20 Hallo Mark, =20 as i quickly read the error message in your question, these we're my first suggestions. =20 either * did you intent cert aut for the postgres user? * u use a selfsigned certificate, hence software that checks for the validity will fail or ask for this ** using for example the free, but official letsencrypt certificates = this should be solved =20 hth, Wim =20 _____ =20 Van: Mark Williams > Verzonden: maandag 20 augustus 2018 16:51 Aan: Wim Bertels; pgsql-admin@lists.postgresql.org ; s.dunand@sirap.fr =20 Onderwerp: RE: Setting up SSL for postgre=20 =20 Hi, =20 Sorry I don=92t understand what you are suggesting re the pg_hba file. =20 __ =20 From: Wim Bertels < wim.bertels@ucll.be>=20 Sent: 20 August 2018 14:30 To: pgsql-admin@lists.postgresql.org; s.dunand@sirap.fr Subject: Re: Setting up SSL for postgre =20 =20 =20 pg_hba.conf # TYPE DATABASE USER CIDR-ADDRESS METHOD =20 # IPv4 local & remote connections: host all all 127.0.0.1/32 trust hostssl all postgres 0.0.0.0/0 cert=20 =20 cert method for auth, hence this behaviour (client cert..) =20 extra tip:=20 https://duckduckgo.com/?q=3Dletsencrypt+postgresql for official server side certificates =20 mvg, Bertels Wim =20 Mark __ =20 This page helped me : =20 https://www.depesz.com/2015/05/11/how-to-setup-ssl-connections-and-authen= tic ation/ Best regards, St=E9phane ------=_NextPart_000_09C0_01D43B0A.42E7B460 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable

Hi = Wim,

 

I did = intend Cert aut (at least I think I did!).

 

Still = cannot connect to postgre database from my client app using FireDAC. I = can connect fine from PGAdmin3 on the same machine using the same = certificates.

 

The call = made by FireDAC to libPQ.Dll is the following:

 

PQconnectdb = [ConnInfo=3Dhostaddr=3D192.168.0.12 port=3D5432 dbname=3Drees = user=3Dpostgres password=3D*** connect_timeout=3D10 sslmode=3Drequire = sslrootcert=3DC:\ProgramData\MWC\Viewer\Certs\root.crt = sslcert=3DC:\ProgramData\MWC\Viewer\Certs\postgresql.crt = sslkey=3DC:\ProgramData\MWC\Viewer\Certs\postgresql.key password=3D1234, = Result=3D$0000000003B262B0]

13222564840001 = 17:41:04.681=A0=A0=A0=A0=A0 . ERROR: connection requires a valid client = certificate [Status=3D1]

 

The SSLmode = is set to require when I connect with PGAdmin. So presumably, there is = no problem with the certificates. Is there anything that jumps out from = the FireDAC output as to why the SSL connection doesn’t = work?

 

Many = thanks,

 

Mark

__

 

From: Wim Bertels = <wim.bertels@ucll.be>
Sent: 22 August 2018 = 09:19
To: Mark Williams <markwillimas@gmail.com>; = pgsql-admin@lists.postgresql.org; s.dunand@sirap.fr
Subject: = Re: Setting up SSL for postgre

 

Hallo = Mark,

 

as i quickly read the error = message in your question,

these we're my first = suggestions.

 

either

* did you intent cert aut for = the postgres user?

* u use a selfsigned certificate, = hence software that checks for the validity will fail or ask for = this

** using for example the free, = but official letsencrypt certificates this should be = solved

 

hth,

Wim

 

<= div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'>

Van: Mark Williams <markwillimas@gmail.com>
Verzonden: maandag 20 augustus 2018 = 16:51
Aan: Wim Bertels;
pgsql-admin@lists.postgr= esql.org; s.dunand@sirap.fr
Onderwerp: RE: Setting up SSL for = postgre
=

 

Hi,

 

Sorry I don’t = understand what you are suggesting re the pg_hba = file.

 

__

 

From: Wim Bertels <wim.bertels@ucll.be>
Sent: 20 August 2018 = 14:30
To:
pgsql-admin@lists.postgresql.org; s.dunand@sirap.fr
Subject: Re: Setting up SSL for = postgre

 

 

 

pg_hba.conf

# TYPE  = DATABASE        = USER            = CIDR-ADDRESS       =      METHOD

 

# IPv4 local & remote = connections:

host    = all           &nbs= p; = all           &nbs= p; = 127.0.0.1/32          &= nbsp; trust

hostssl = all         = postgres    = 0.0.0.0/0          &nbs= p;  cert

 

cert = method for auth, hence this behaviour (client cert..)

 

extra tip:

https://duckduckgo.com/?q=3Dletsencrypt+postgr= esql

for = official server side certificates

 

mvg,

 Bertels Wim

 

Mark

__

 


This page helped me = :
https://www.depesz.com/2015/05/11/how-to-setup= -ssl-connections-and-authentication/

Best = regards,
St=E9phane

------=_NextPart_000_09C0_01D43B0A.42E7B460--