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 1iDw5v-0007ep-KK for pgsql-general@arkaria.postgresql.org; Fri, 27 Sep 2019 19:40:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iDw5u-0004iX-47 for pgsql-general@arkaria.postgresql.org; Fri, 27 Sep 2019 19:39:58 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iDw5s-0004iP-S6 for pgsql-general@lists.postgresql.org; Fri, 27 Sep 2019 19:39:57 +0000 Received: from out3-smtp.messagingengine.com ([66.111.4.27]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1iDw5q-0001FH-2c for pgsql-general@lists.postgresql.org; Fri, 27 Sep 2019 19:39:55 +0000 Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 0266822237; Fri, 27 Sep 2019 15:39:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute6.internal (MEProxy); Fri, 27 Sep 2019 15:39:53 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm1; bh=t kZriRHjzXUmDMdOFSEhFEGp5E+320+oVc3H+v2SURc=; b=jagQoGnz9bnLJxXDP AE/BBsjpc5hz3YFysGtIkFRD5rglY346M8i/ASr91w8wI57ViTlFmZHzkn3DnzVm pT1f6sOgaKB6FfOEmwV8To4j++f/13Wp+kDRdnicBCi2UEZt/WVVz7FlbmN6EMSW kUmMU+J00QYH7urnqkvXkzfLI0/2jripix9I8Jk2v9as5eicjKTnppU0OIn1XMmd 8FC3XxEFhfaJp//Ymt0144thiLNIHc2YYoC/WZVilhsQhp3yLCQ/+S/szKpA9KkL Q/42WJU2QF9xBfufHEM64WtdoOtxB35/cvpwdObQXp5uwKmYgrpONJBXz/yNzisP VyQiQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=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=fm3; bh=tkZriRHjzXUmDMdOFSEhFEGp5E+320+oVc3H+v2SU Rc=; b=BnBUT72XyeyHUI5RnmkQwM7WXlIKG7Eir/FjFj8ccR2ydJOAFEUFhKNd1 fYNSXG2qXDPpe/9wACzE9aZ75c70zmWzguR500kFznLksMD4h8EN7rE3Xm9h2DwC paowR0N5o6ShcUfIa6pIQmVygchBvyFXVNusp+S81ZQUqrMyaCm95mpMh2eBb3vv 4JtpdHl05tWv8F7rpovjY9FsNamEK07M+CoC3lAtKtIpSfMpxmybIj+ynwiMBNpY U2ziRo5AS+jBUVD5vKOQGkt8ztnOD/JSzn2ty3MxK7crrRWa71Dou1kUaAAZOoIl JVakzb0eklWm9s8LSEk/Aktttg4qg== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedufedrfeeigddufeejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucffohhmrghinheprhgvrgguthhhvgguohgtshdrihhonecukfhppedujeegrddv uddrkeehrddugedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrg hvvghrsegrkhhlrghvvghrrdgtohhmnecuvehluhhsthgvrhfuihiivgeptd X-ME-Proxy: Received: from [192.168.1.3] (174-21-85-140.tukw.qwest.net [174.21.85.140]) by mail.messagingengine.com (Postfix) with ESMTPA id 4BFBAD6005E; Fri, 27 Sep 2019 15:39:52 -0400 (EDT) Subject: Re: "Failed to connect to Postgres database" To: Marco Ippolito , pgsql-general@lists.postgresql.org References: <5860c69b-8b16-43b0-ba90-0a0cc7598520@manitou-mail.org> <4841ddf2-4c93-5465-5cd3-82cd4389e2e8@aklaver.com> From: Adrian Klaver Message-ID: <0afa1ddc-6c3e-a3cf-ebbf-a00f185b38d2@aklaver.com> Date: Fri, 27 Sep 2019 12:39:51 -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: 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 9/27/19 11:02 AM, Marco Ippolito wrote: > Thank you very much Adrian. > Two things: > > 1) >  Why if I just specify through port the cluster and the host connection > I connect correctly with SSL, >  but if I specify also the database and the user it connects it doesn't > usel SSL connection, or at least it doesn't say it uses SSL? : Can you show the contents of pg_hba.conf file for the 11/fabmnet cluster. The file will be in: /etc/postgresql/11/fabmnet/ More below. > > 2) > In fabric-ca-server-config.yaml > >   a) if I set: > >     db: >       type: postgres >       datasource: host=localhost port=5433 user=postgres password=1234 > dbname=fabmnet_ca sslmode=allow According to the fabric-ca docs, allow is not one of the valid values: https://hyperledger-fabric-ca.readthedocs.io/en/release-1.4/users-guide.html#postgresql "Specifying sslmode configures the type of SSL authentication. Valid values for sslmode are: Mode Description disable No SSL require Always SSL (skip verification) verify-ca Always SSL (verify that the certificate presented by the server was signed by a trusted CA) verify-full Same as verify-ca AND verify that the certificate presented by the server was signed by a trusted CA and the server hostname matches the one in the certificate " >       tls: >           enabled: false >           certfiles: >           client: >             certfile: >             keyfile: > >     where sslmode=allow means "first try a non-SSL connection; if that > fails, try an SSL connection" > >     /var/log/postgresql/postgresql-11-fabmnet.log  : >         2019-09-27 19:43:14.194 CEST [3213] postgres@fabmnet_ca FATAL: >  client certificates can only be checked if a root certificate store is > available The above tells me that the start is ignoring sslmode=allow and rolling over into a verification mode and there are no certs specified. Please do as requested as try sslmode=require. More below. > >   b) if I set: >     db: >       type: postgres >       datasource: host=localhost port=5433 user=postgres password=1234 > dbname=fabmnet_ca sslmode=disable >       tls: >         enabled: false >         certfiles: >         client: >           certfile: >           keyfile: > > > >     /var/log/postgresql/postgresql-11-fabmnet.log : >         2019-09-27 19:55:03.691 CEST [3313] postgres@fabmnet_ca ERROR: >  database "fabmnet_ca" already exists >         2019-09-27 19:55:03.691 CEST [3313] postgres@fabmnet_ca > STATEMENT:  CREATE DATABASE fabmnet_ca The fabmnet_ca database has already been created. > > Does it mean that in order to use postgresql-11 with fabric-ca I have to > use only socket connection? > And if this is the case, why? No you connected to localhost, though without SSL. Try again with sslmode=require and I am pretty sure you will connect with SSL, but no cert verification. > > Marco > -- Adrian Klaver adrian.klaver@aklaver.com