pg.ddx.io pgsql-general@postgresql.org mailing list archive
help / color / mirror / Atom feedNew behavior with JDBC 42.2.5
5+ messages / 2 participants
[nested] [flat]
* New behavior with JDBC 42.2.5
@ 2018-09-21 17:12 Ravi Krishna <srkrishna@usa.com>
0 siblings, 2 replies; 5+ messages in thread
From: Ravi Krishna @ 2018-09-21 17:12 UTC (permalink / raw)
To: ; +Cc: pgsql-general@lists.postgresql.org
We recently upgraded our JDBC driver to 42.2.5 after seeing this
https://www.postgresql.org/about/news/1883/
All of our PG databases mandates SSL connections. So the first line in pg_hba.conf is
hostnossl all all all reject
We use dbeaver and while setting up connection we check box SSL (require).
Attempt to connect without that checked would result in the following error
"pg_hba.conf rejected the connection: SSL off"
With the JDBC version listed in the subject, we are finding that we can connect
to the database even without checking SSL. Is that expected with this version of
JDBC. Does it automatically make the connection an SSL one? Otherwise it is hard
to see PG allowing that connection to pass.
thanks
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: New behavior with JDBC 42.2.5
@ 2018-09-21 17:29 Ravi Krishna <srkrishna@usa.com>
parent: Ravi Krishna <srkrishna@usa.com>
1 sibling, 0 replies; 5+ messages in thread
From: Ravi Krishna @ 2018-09-21 17:29 UTC (permalink / raw)
To: ; +Cc: pgsql-general@lists.postgresql.org
Just to clarify:
With JDBC 42.1.4 attempt to connect from dbeaver without SSL results in the following error:
"pg_hba.conf rejected the connection: SSL off"
This is what we expect.
With 42.2.5, the connection succeeds without SSL.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: New behavior with JDBC 42.2.5
@ 2018-09-21 22:27 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Ravi Krishna <srkrishna@usa.com>
1 sibling, 1 reply; 5+ messages in thread
From: Adrian Klaver @ 2018-09-21 22:27 UTC (permalink / raw)
To: Ravi Krishna <srkrishna@usa.com>; +Cc: pgsql-general@lists.postgresql.org
On 9/21/18 10:12 AM, Ravi Krishna wrote:
> We recently upgraded our JDBC driver to 42.2.5 after seeing this
> https://www.postgresql.org/about/news/1883/
>
> All of our PG databases mandates SSL connections. So the first line in pg_hba.conf is
>
> hostnossl all all all reject
>
> We use dbeaver and while setting up connection we check box SSL (require).
> Attempt to connect without that checked would result in the following error
> "pg_hba.conf rejected the connection: SSL off"
>
> With the JDBC version listed in the subject, we are finding that we can connect
> to the database even without checking SSL. Is that expected with this version of
> JDBC. Does it automatically make the connection an SSL one? Otherwise it is hard
> to see PG allowing that connection to pass.
First are doing a socket connection or a host connection? Socket
connections ignore sslmode.
Second what happens if you do some version of this?:
psql postgresql://localhost:5432/test?sslmode=require
psql postgresql://localhost:5432/test?sslmode=disable
>
> thanks
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: New behavior with JDBC 42.2.5
@ 2018-09-22 00:46 Ravi Krishna <srkrishna@usa.com>
parent: Adrian Klaver <adrian.klaver@aklaver.com>
0 siblings, 1 reply; 5+ messages in thread
From: Ravi Krishna @ 2018-09-22 00:46 UTC (permalink / raw)
To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general@lists.postgresql.org
> First are doing a socket connection or a host connection? Socket
> connections ignore sslmode.
The URL template of JDBC used by dbeaver is jdbc:postgresql://{host}[:{port}]/[{database}]
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: New behavior with JDBC 42.2.5
@ 2018-09-22 02:13 Adrian Klaver <adrian.klaver@aklaver.com>
parent: Ravi Krishna <srkrishna@usa.com>
0 siblings, 0 replies; 5+ messages in thread
From: Adrian Klaver @ 2018-09-22 02:13 UTC (permalink / raw)
To: Ravi Krishna <srkrishna@usa.com>; +Cc: pgsql-general@lists.postgresql.org
On 9/21/18 5:46 PM, Ravi Krishna wrote:
>> First are doing a socket connection or a host connection? Socket
>> connections ignore sslmode.
>
> The URL template of JDBC used by dbeaver is jdbc:postgresql://{host}[:{port}]/[{database}]
>
>>From the manual
>
> "The host component is interpreted as described for the parameter host. In particular, a Unix-domain socket connection is chosen if the host part is either empty or starts with a slash, otherwise a TCP/IP connection is initiated."
>
> In our case the host name does not start with a slash. So I conclude it is using TCP/IP.
>
>
>> psql postgresql://localhost:5432/test?sslmode=require
>>
>>
>> psql postgresql://localhost:5432/test?sslmode=disable
>
> We are using dbeaver, not psql. dbeaver also provides disable option for sslmode. I set sslmode=disable and it immediately rejected connection with error "SSL Mode off".
>
> So the puzzle is -> in version 42.1.4 when we do not check "Use SSL " button, connection
> fails with "SSL Mode off". In that version we check the box "Use SSL" and then in the dropdown
> for sslmode, we select sslmode=require. Only then the connection passes.
>
> In version 42.2.5 even if we do not check "Use SSL" it still behaves the same as
> "Use SSL" checked and sslmode=require.
>
> I was not able to import the security bulletin fully, but am I right in concluding
> that JDBC 42.2.5 always turns on sslmode=require unless we explicitly set sslmode=disable.
Looks that way:
https://github.com/pgjdbc/pgjdbc/commit/cdeeaca47dc3bc6f727c79a582c9e4123099526e
Line 181-184
* Parameter governing the use of SSL. The allowed values are {@code
disable}, {@code allow},
* {@code prefer}, {@code require}, {@code verify-ca}, {@code
verify-full}.
* If {@code ssl} property is empty or set to {@code true} it implies
{@code verify-full}.
* Default mode is "require"
>
> Thanks for your help.
>
--
Adrian Klaver
adrian.klaver@aklaver.com
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2018-09-22 02:13 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-09-21 17:12 New behavior with JDBC 42.2.5 Ravi Krishna <srkrishna@usa.com>
2018-09-21 17:29 ` Ravi Krishna <srkrishna@usa.com>
2018-09-21 22:27 ` Adrian Klaver <adrian.klaver@aklaver.com>
2018-09-22 00:46 ` Ravi Krishna <srkrishna@usa.com>
2018-09-22 02:13 ` Adrian Klaver <adrian.klaver@aklaver.com>
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