Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lURsi-0005Km-Qn for pgsql-admin@arkaria.postgresql.org; Thu, 08 Apr 2021 10:27:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lURsh-0007d6-OV for pgsql-admin@arkaria.postgresql.org; Thu, 08 Apr 2021 10:27:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lURsh-0007cY-D8 for pgsql-admin@lists.postgresql.org; Thu, 08 Apr 2021 10:27:23 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lURse-0003hf-Sm for pgsql-admin@postgresql.org; Thu, 08 Apr 2021 10:27:22 +0000 Received: by mail-ed1-x530.google.com with SMTP id bx20so580028edb.12 for ; Thu, 08 Apr 2021 03:27:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=WoOFDAxRvwuHbj0jL47swpygyYBXX/6Wi7/oTfsoyz4=; b=Ncs+iGyQ7nn6bzz4XGsmOdMRhJFHTCFzEb/oA+FUD8lJ7B1oDS7S1tw8BzMAYKYyUr qBRxaCU05ENK+6YhrgjIC/2Tk9sZc3aBw3SArxR0wbuyJTlSl6CtuNu09x6BGKdQQA+C kh3vqqdxIymN6Llw4aDdxbBAR291bCBtBcPz9uDEEUsGmIGkB94Nn0ANQDfBlRg9ZiDd /LpDN+c/G62MoUB1WPuQ/mtK7rO51JCnjyavdFwEQSriIJ4GogbHINIfhKxv2fuK2URb WckQrgbZxm0d5yr0FtTewJ9vr4fzWrE0B8//lgmhRlGgTOUPl6H+fFavjcXfCTQHYmUF Dxrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=WoOFDAxRvwuHbj0jL47swpygyYBXX/6Wi7/oTfsoyz4=; b=oMleuzUIHytcnZ4VE1oS8T+snMIHk1MZfC+PVfHwbKz/GOwuaCSm1Y/xrzkptqgwGO 7l9t320WvCGqnu6hnKd6h8RRpXP2b9UmZI1XZYgLv6dR8zlomppjWV8OoScDzhtyYiYV 7M17AH3GDvzjgyCJ0W3hRyh8//7HGcevg9n4vd6uvWkdyabCeZx1RJ0uxXYN7WcTjoxA pXbSVmISxlRoLxhVlk3Tapu9dlQUYo0IuhbhY5YEPWnq/mB+h0CerhF6sIYY1UjwL66r UiECaOGuhkSLw7ikzECa5PIPvLuC1Nqxv5BQ6ISrZYnR4MxZJZxsaDiiNrRIindeXz3Z aMEQ== X-Gm-Message-State: AOAM530YZavm722Esaafz0PC35+no0liSjICvhAs6iWK9K7M9W8y9bA1 1GqNR5yrrQ5rSi486dn66Xv4Mw== X-Google-Smtp-Source: ABdhPJw0og0UZxPKl/BaUKtomKi2ezKVzQ+dC504Mq5l+oJHSLQg4A7AGwEHX3gz+Raoh9Qq8RvGng== X-Received: by 2002:a05:6402:1a:: with SMTP id d26mr10399934edu.99.1617877638795; Thu, 08 Apr 2021 03:27:18 -0700 (PDT) Received: from localhost.localdomain (91-115-148-0.adsl.highway.telekom.at. [91.115.148.0]) by smtp.gmail.com with ESMTPSA id a9sm17263466eds.33.2021.04.08.03.27.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Apr 2021 03:27:18 -0700 (PDT) Message-ID: <84304703ff2131cb3302eaf12b31a235b25a76a6.camel@cybertec.at> Subject: Re: Replication & TLS encryption - how? From: Laurenz Albe To: lejeczek Cc: pgsql-admin@postgresql.org Date: Thu, 08 Apr 2021 12:27:17 +0200 In-Reply-To: References: <54a5bf2b-0504-02c0-e5a2-ab24173abcdb.ref@yahoo.co.uk> <54a5bf2b-0504-02c0-e5a2-ab24173abcdb@yahoo.co.uk> <1596782.1617813374@sss.pgh.pa.us> <7e89a9be-e788-23fc-6b1b-2ee67586d452@yahoo.co.uk> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, 2021-04-08 at 09:21 +0100, lejeczek wrote: > On 08/04/2021 03:59, Laurenz Albe wrote: > > On Wed, 2021-04-07 at 21:12 +0100, lejeczek wrote: > > > On 07/04/2021 17:36, Tom Lane wrote: > > > > lejeczek writes: > > > > > A novice here thus please go easy on me as I ask this - I > > > > > see docs/howtos all over the place be those either talk of > > > > > encryption or replication. I failed to find one which blend > > > > > these two concepts together - sure it's possible to pgSQL > > > > > replication encrypted, right? > > > > > > Thanks. Would you know how '|clientcert=1' fits into the > > > equation? > > > With it present in pg_hba.conf pgSQL was not happy saying: > > > > > > FATAL: connection requires a valid client certificate. > > > > Then include "sslcert" in "primary_conninfo". > > > > You can use all the libpq connection parameters: > > https://www.postgresql.org/docs/current/libpq-connect.html#LIBPQ-PARAMKEYWORDS > > This below is what 'pg_basebackup' generated on the master > itself, master which already was configured for TLS/certs. > > primary_conninfo = 'user=replicator password=''9897'' > channel_binding=prefer host=10.1.1.224 port=5432 > sslmode=prefer sslcompression=0 > ssl_min_protocol_version=TLSv1.2 gssencmode=prefer > krbsrvname=postgres target_session_attrs=any' > > And with master's: > > hostssl replication replicator 10.1.1.223/32 md5 > clientcert=1 I repeat: add "sslcert" to "primary_conninfo". Of course you will need a private key that matches the certificate. > I guess my question - as any novice's - would be: is > replication really 100% encrypted? How to confirm-test it? Look at the appropriate line in "pg_stat_ssl". > Lastly: is there anything more at 'pg_basebackup' stage user > can do to have 'configs' more ready, more complete for 'full > encryption' when starting with master already configured > with TLS? > I'm on 13.2 version. No, this always requires manual configuration. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com