sslmode - detecting local docker

From: AJ Weber <aweber(at)comcast(dot)net>
To: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: sslmode - detecting local docker
Date: 2026-04-13 13:09:05
Message-ID: 31b00cee-fc14-4872-aef1-f6151c7cd1ee@comcast.net
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I'm trying to configure my custom JDBC connection to be as safe as
practical.

Years gone by, I would simply check if the URL (configured-property) had
"localhost" in it, and do nothing. Recently I decided I'd check for
localhost AND see if any "ssl" was explicitly already set in the URL. 
If not, I tried adding ssl=true as a connection param.  This fails when
using a postgresql docker container, because they typically are not
configured for SSL, but the hostname is also not "localhost".

Besides changing my logic to add "sslmode=prefer" (instead of "true",
which may be the default anyway), does anyone have a good way to
determine if the JDBC URL is actually a docker container running on the
same host?

Currently running v16.x, but these modes haven't changed in a long time,
so I suppose this question applies across currently supported versions.

Thanks in advance,

AJ

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Raj 2026-04-13 16:35:53 Re: Slowness
Previous Message Laurenz Albe 2026-04-13 13:02:26 Re: Slowness