Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIIHP-0004nb-JK for pgsql-general@arkaria.postgresql.org; Wed, 09 Oct 2019 20:09:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iIIHN-0000ik-6I for pgsql-general@arkaria.postgresql.org; Wed, 09 Oct 2019 20:09:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIIHL-0000iX-RU for pgsql-general@lists.postgresql.org; Wed, 09 Oct 2019 20:09:48 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIIHH-000640-E8 for pgsql-general@lists.postgresql.org; Wed, 09 Oct 2019 20:09:47 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 69B2021FB6; Wed, 9 Oct 2019 16:09:41 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Wed, 09 Oct 2019 16:09:41 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:cc:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=f Kvgn7RCyllt1KDK5bOMJODxAI9JoAJ+nFtvPeTTHoQ=; b=MW67/OSjY2qSzHTSB hgPyesaH6PGU8OVJlNVrPhE1dlaOkvxaru+OJYwzNPD9RLe+BtViqR8XcvQcQ9zx DG/sLI6uzYOwSveVf/lIyZedwAv5hRAihO/OFx3fbr9nToI83pICLeDYmIA5ctRs SE84pMSPMy9Nx1Ohhi8QHAcIXEeGP9JKhgRDpGG7kQMzkOJeYAdzfYoEtmXO7zdj VbhF0Gzq5KxruCR0x3GIlyFneaadSJlesarmNdo6S8/5vrSSd7KRrQBYR8PHpKi+ Qnz5cudX3KSKmVSM6cRm2fus75ErlDMoK7aUMypKR52Q4FLKs8xWirC2hlgkQygD N09+Q== 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-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=fKvgn7RCyllt1KDK5bOMJODxAI9JoAJ+nFtvPeTTH oQ=; b=NIddrWysMN2mOGSgM1oxZbCA3lV4rKuXdKadAyoJ6Dmb33eSrxD0r/i0m 0ViPac8QvzMlnGNXaEC1nQiBz8HlIVgeEyVvbEtu5sufQcW2gthLQcyG7kfJ289f XiimG7wLPpfOPoXvyDcCJyih9E5pXD+LjyfPLcXj8BjGtTS9UfH4atPd/4SPBQ2q jlV0bNujY95hX0KI44bRmCGUohlI2OfGso7/yCPepZxgAjQKGoNnhw+mS0rh3OVf PNz0Wqw+JOYdA2TN6nFe01vtGlbjbYpHDSUBISilRk/VplAcnJMlflCCucHlwDN4 Tt14eZ7GGep0/TGZ1pHUaXXrbfljw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedriedugdduvdegucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucffohhmrghinheptghonhhfrdhsohdpphhoshhtghhrvghsqhhlrdhorhhgnecu kfhppedujeegrddvuddrleefrdeivdenucfrrghrrghmpehmrghilhhfrhhomheprggurh hirghnrdhklhgrvhgvrhesrghklhgrvhgvrhdrtghomhenucevlhhushhtvghrufhiiigv pedt X-ME-Proxy: Received: from [192.168.1.3] (174-21-93-62.tukw.qwest.net [174.21.93.62]) by mail.messagingengine.com (Postfix) with ESMTPA id 63B1BD6005B; Wed, 9 Oct 2019 16:09:40 -0400 (EDT) Subject: Re: Allowing client access To: Timmy Siu , Bob Jolliffe Cc: pgsql-general@lists.postgresql.org References: <09a5e67e-646d-4efb-2879-d66da69e54f5@aol.com> From: Adrian Klaver Message-ID: <4b5fcff4-67c1-bcd1-2476-df1a44cf8c6f@aklaver.com> Date: Wed, 9 Oct 2019 13:09:39 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.2 MIME-Version: 1.0 In-Reply-To: <09a5e67e-646d-4efb-2879-d66da69e54f5@aol.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 10/9/19 11:39 AM, Timmy Siu wrote: > Dear Bob, > Thank you.?? hostssl works out of the box!?? It does not require extra That depends on how you installed Postgres. My guess is whatever package manager/installer you used did the setup/configuration for you. That would be: 1) In postgresql.conf set ssl = on (default is off) https://www.postgresql.org/docs/11/runtime-config-connection.html#RUNTIME-CONFIG-CONNECTION-SSL 2) Created the SSL certificate and key and put them in the appropriate location: https://www.postgresql.org/docs/11/ssl-tcp.html There is also the chance that you may not be actually be connecting using SSL. If you connect via psql do see something like?: psql (11.5) SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off) NOTE: In pg_hba.conf the first line that matches wins, so if you have a line before the hostssl one that matches it will be used. Also: https://www.postgresql.org/docs/11/auth-pg-hba-conf.html "hostssl This record matches connection attempts made using TCP/IP, but only when the connection is made with SSL encryption. To make use of this option the server must be built with SSL support. Furthermore, SSL must be enabled by setting the ssl configuration parameter (see Section 18.9 for more information). Otherwise, the hostssl record is ignored except for logging a warning that it cannot match any connections. " > configuration.?? I can connect to my own pgsql server via pgadmin 4.?? I > personally feel that Postgresql v11 is much clever than Mysql v5.7 (I > haven't tried its v8). > > I also have tested postgres against TCP Wrappers but it is not compiled > against TCP wrappers library.?? May I suggest the community to have > postgres to work with TCP wrappers.?? Its security will be better. > > Regards, > Timmy > > >> Hi Timmy >> >> You need to use CIDR form in your pg_hba.conf.  So: >> >> host all testuser  111.222.333.444/32  md5 >> >> Most likely you would probably want to ensure ssl connection if coming >> over untrusted network.  So, at minimum, this is better: >> >> hostssl all testuser  111.222.333.444/32  md5 >> >> This is better still: >> >> hostssl testdb testuser  111.222.333.444/32  md5 >> >> Better still (IMHO) is to keep it local and use ssh tunnel, but I >> understand that might be difficult and not necessarily desirable, >> depending on the context. >> >> Regards >> Bob > > > -- Adrian Klaver adrian.klaver@aklaver.com