public inbox for pgsql-admin@postgresql.org  
help / color / mirror / Atom feed
From: AJ Weber <aweber@comcast.net>
To: pgsql-admin@lists.postgresql.org
Subject: sslmode - detecting local docker
Date: Mon, 13 Apr 2026 09:09:05 -0400
Message-ID: <31b00cee-fc14-4872-aef1-f6151c7cd1ee@comcast.net> (raw)

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






reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: aweber@comcast.net, pgsql-admin@lists.postgresql.org
  Subject: Re: sslmode - detecting local docker
  In-Reply-To: <31b00cee-fc14-4872-aef1-f6151c7cd1ee@comcast.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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