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 1g3XQI-0007ok-Gx for pgsql-general@arkaria.postgresql.org; Sat, 22 Sep 2018 02:13:31 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1g3XQG-0005Vs-J1 for pgsql-general@arkaria.postgresql.org; Sat, 22 Sep 2018 02:13:28 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g3XQF-0005Vl-DV for pgsql-general@lists.postgresql.org; Sat, 22 Sep 2018 02:13:28 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1g3XQ7-0003FX-Qb for pgsql-general@lists.postgresql.org; Sat, 22 Sep 2018 02:13:26 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 1DA3C1B1; Fri, 21 Sep 2018 22:13:18 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Fri, 21 Sep 2018 22:13:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm1; bh=5erSuX3vvTMd56KA4/d1XVd840g0p 3nm+mpR2dQN7xA=; b=NkasvSJVDudQowB3kBKAhXNbUWzpI2EiObRZJljUbiFdt mp+vZm7TUPPK0c1+wknELLr84og8jrJo8eJAd9m+te11tbsgHId9Q7XvROoUvZd1 dOvGoCRuIdyWKtUYOwqDFHH6dR9vBotBH0fR9IDxFOPJudzKmWDUpGXLVV3zP17Q xXTTSPUYrxzfv6QH4LoAv22cgUgJta4aj76QgFtlrHOoAm2Voc1Fxn2H/eTkpv01 p4u6tPpwCbk75cXZbOuYqcqgyP+W7J94RgzDy8hMWqw9xbqw0ZtS7qj5Qlxu4LoC eO7bdNcMLN50a/7vUta+glsHxDkVHFUnHpxU/Gh5Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=5erSuX 3vvTMd56KA4/d1XVd840g0p3nm+mpR2dQN7xA=; b=gAVHBoxeaJWS2ehPA1/KLE oc/l/TH9vc7kT+MrU0D6Rz9ewWiCALYmU73469BnNWGjt9aDMyduHQLiUUzEZdn9 N5sPVysPf3K8PzJMHOGOjx/cRqrvlmAlWKqHFPhEmLD+5yJVUlfuzqm4p8oBXf2v 2mbjnHjUbsCIgEboaEC2tvtrXmPcbTzDsh6opdX4q9QP1wrLV8CJfoi+Wnhhx8FX a3HlkGib3pgkg/7uES04SxwsHsUrdWOK0nj2nOqN3Z0hsAPhg/LxEOU+Jktxat61 Uo+tCB4sqlpXXlcBlKgfTP6uPr4+2XX5kV0/nSHsg3KHZ9hA2R8DXmqxzcN0+uZA == X-ME-Proxy: X-ME-Sender: Received: from [192.168.1.3] (unknown [71.212.134.3]) by mail.messagingengine.com (Postfix) with ESMTPA id ED6E0E4118; Fri, 21 Sep 2018 22:13:16 -0400 (EDT) Subject: Re: New behavior with JDBC 42.2.5 To: Ravi Krishna Cc: pgsql-general@lists.postgresql.org References: <36f554cb-d8c2-5ebc-7f6d-0080effbae4e@aklaver.com> From: Adrian Klaver Message-ID: Date: Fri, 21 Sep 2018 19:13:15 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk 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