pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
self-made certs not quite right
2+ messages / 2 participants
[nested] [flat]

* self-made certs not quite right
@ 2021-03-02 23:12  Rob Sargent <robjsargent@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Rob Sargent @ 2021-03-02 23:12 UTC (permalink / raw)
  To: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

I'm trying to follow instrux in V12:18.9.5 Creating Certificates. [1]

I'm stuck in my basement so all references to "/CN=FQN" have been set to 
$(hostname), just the hostname, because $(domainname) returns "(none)" 
which I presume is akin to null.

With my newly minted certs and keys using psql (to either $(hostname) or 
localhost) I get the "SSL connection (protocol: TLSv1.3...) message, so 
long as I have an empty ~/.postgresql directory.  If I copy the 
generated root.crt to ~/.postgresql (chown me.me; chmod 400) I get a 
plain connection (no ssl).

With root.crt in ~/.postgresql, testing the jdbc connection from a 
tomcat server generates this failure (again either localhost or $(hostname))
Blow out on db connection to jdbc:postgresql://localhost:5432/postgres; 
SSL error: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to 
find valid certification path to requested target
org.postgresql.util.PSQLException: SSL error: PKIX path building failed: 
sun.security.provider.certpath.SunCertPathBuilderException: unable to 
find valid certification path to requested target

Is this a pkcs v. pem cat fight?  Or is there enough here to tell which 
step went south, or just start over?

[1] https://www.postgresql.org/docs/12/ssl-tcp.html





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: self-made certs not quite right
@ 2021-03-03 10:32  Tiemen Ruiten <t.ruiten@tech-lab.io>
  parent: Rob Sargent <robjsargent@gmail.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Tiemen Ruiten @ 2021-03-03 10:32 UTC (permalink / raw)
  To: Rob Sargent <robjsargent@gmail.com>; +Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>

Hello Rob,

With root.crt in ~/.postgresql, testing the jdbc connection from a
> tomcat server generates this failure (again either localhost or
> $(hostname))
> Blow out on db connection to jdbc:postgresql://localhost:5432/postgres;
> SSL error: PKIX path building failed:
> sun.security.provider.certpath.SunCertPathBuilderException: unable to
> find valid certification path to requested target
> org.postgresql.util.PSQLException: SSL error: PKIX path building failed:
> sun.security.provider.certpath.SunCertPathBuilderException: unable to
> find valid certification path to requested target
>

Java has its own certificate keystore, you would need to add your
certificate to it: https://tomcat.apache.org/tomcat-8.5-doc/ssl-howto.html

Hope this helps.

-- 
Tiemen Ruiten
Infrastructure Engineer

^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2021-03-03 10:32 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2021-03-02 23:12 self-made certs not quite right Rob Sargent <robjsargent@gmail.com>
2021-03-03 10:32 ` Tiemen Ruiten <t.ruiten@tech-lab.io>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox