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 1lUvLw-00068W-Bd for pgsql-admin@arkaria.postgresql.org; Fri, 09 Apr 2021 17:55:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lUvLv-0002mi-52 for pgsql-admin@arkaria.postgresql.org; Fri, 09 Apr 2021 17:55:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lUvLu-0002ma-Tr for pgsql-admin@lists.postgresql.org; Fri, 09 Apr 2021 17:55:30 +0000 Received: from mail-ej1-x634.google.com ([2a00:1450:4864:20::634]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lUvLs-00035s-Br for pgsql-admin@postgresql.org; Fri, 09 Apr 2021 17:55:30 +0000 Received: by mail-ej1-x634.google.com with SMTP id g5so3290230ejx.0 for ; Fri, 09 Apr 2021 10:55:28 -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=Mf45SINtPQ12QflSjXBwTL1iiyMZgtUX540CLX2Wg1g=; b=O69Mqp72C9qZ6Bcgro+1bs2y4OEsjbBg5/MYS1S4Yup3vcfOE3Clk0BZSjbpkyZBPR wo0+W7ziX0AvXlJN1BRGI7JhUpJ+V+2q3hTRh/RO+a+AbxMgI7cBjRyRqIpUcPSh4YIR YYt3oStVwdLp8dhE/zksaS/7oy/VNfnfbJ4W3c0qw1AyDnOJhsO7G5GOvA86OzaOfDFS l0I7ubmLOXCbpfDmPre+rRH02KQ/rNpLdZuf6spdFcoYrqg42BpXUUf81aFm6cbJ56nS gPbU8G2rjOIhNDyvTKA8E4F/kRmB1/2T42yULWjwe33QfO3tjuOBO8sX+lWWG72xpJ6J HThQ== 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=Mf45SINtPQ12QflSjXBwTL1iiyMZgtUX540CLX2Wg1g=; b=MO6cC+uA9A0v84SNXYEyN37fq38uIxvXaUERGYdi5Ieg5yrEygxTYfI8SDwQR7Isq5 UcoC25LaKk3fM2myHhhqaWGYeVaZqXGyYl1t+1TbDk/xsPekkq1ulGC+zc6x+hv0AFlF EHaoRWUuXKDsPuN/bSkxGPNeiRRGneKshZn1TUAWOVePaKFT0dQIwxQfgV+nl8seqM7h WPTBUO5nidieLtHGH54cy9NuwHmO0XzLwxlqm1L0wwQZvK5Fwoavihbjwz1eAAtEoPdY Gl91te19zLJtyHjKk2HdjeIMnCoVFjWqh/SbvPUYfqXiFC0TJc8wnynD1B4lcxwQzxXY jKvw== X-Gm-Message-State: AOAM532oNLhYPnReZCYNlqFTW/ItzznM1206vqtt31SPMzBSrJb7Xzoo 5ZIn07JMdIBpHnzF0DtLHhczoMUWrQGE9Q== X-Google-Smtp-Source: ABdhPJy6gWTXfy1x3/0sLGX6IPhUBVE0g01fgWMJjooVahj15SSnpeIIS9c/DYDxBtt81295yR7s8w== X-Received: by 2002:a17:906:aad4:: with SMTP id kt20mr17344523ejb.367.1617990927143; Fri, 09 Apr 2021 10:55:27 -0700 (PDT) Received: from localhost.localdomain (217-149-171-143.nat.highway.telekom.at. [217.149.171.143]) by smtp.gmail.com with ESMTPSA id gn3sm1516845ejc.2.2021.04.09.10.55.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Apr 2021 10:55:26 -0700 (PDT) Message-ID: <933348165a7555c5a0a7c78a0234e3395e8efea8.camel@cybertec.at> Subject: Re: Replication & TLS encryption - how? From: Laurenz Albe To: lejeczek Cc: pgsql-admin@postgresql.org Date: Fri, 09 Apr 2021 19:55:26 +0200 In-Reply-To: <0918fe8c-05a7-f381-2346-4857cc3479e9@yahoo.co.uk> 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> <84304703ff2131cb3302eaf12b31a235b25a76a6.camel@cybertec.at> <9d29a3c7-80de-4408-9197-e5ce1dd54a8e@yahoo.co.uk> <749e43831c8fd197fa06560746c9ff4d474ac2dd.camel@cybertec.at> <0918fe8c-05a7-f381-2346-4857cc3479e9@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 Fri, 2021-04-09 at 16:43 +0100, lejeczek wrote: > > > I get what you were saying but I also wondered - when I > > > showed my "primary_conninfo" & pg_hba: why does replication > > > appear to work without the bits you mention and what is the > > > significance of 'clientcert=1' in all this. > > > > Replication works just fine when unencrypted. > > > > "clientcert=1" (in versions before v12) means that the server will > > reject a client connection unless it sends a client certificate that is > > signed by an authority that the server recognizes. > > And by 'recognizes' we would mean the one from 'ssl_ca_file' > which, if true then I still have to wonder why my pgSQLs > were not happy. > My first guess and first question at the same time would be > - could be because how my certs were crafted? > Beyond "regular" certs params, or something "extra" in other > words, I requested my certs to have 'Extended Key Usage' > Thus my certs have both: TLS Web Server Authentication, TLS > Web Client Authentication which I thought is a 'must' since > pgSQL in replication/clusters is both server and the > client.(no? ) This seems to be an SSL question unrelated to PostgreSQL. Perhaps you can use SSL tools like "openssl s_client" and "openssl s_server" to debug this. > > > Does that confirm healthy & encrypted replication? > > > > Compare with the lines in "pg_stat_replication". If the entry with "ssl" = true > > (pid 78705) has the same PID as the entry in "pg_stat_replication", then that > > connection is encrypted, yes. > > I think those match, but what is that 'Record 3' (which has > no match in 'pg_stat_replication', I can guess but I rather > ask) , master-supplier with two standbays is my setup. > -[ RECORD 1 ]-+----------------------- > pid | 108394 > ssl | t > version | TLSv1.3 > cipher | TLS_AES_256_GCM_SHA384 > bits | 256 > compression | f > client_dn |How should I know? > client_serial | > issuer_dn | > -[ RECORD 2 ]-+----------------------- > pid | 108395 > ssl | t > version | TLSv1.3 > cipher | TLS_AES_256_GCM_SHA384 > bits | 256 > compression | f > client_dn | > client_serial | > issuer_dn | > -[ RECORD 3 ]-+----------------------- > pid | 111811 > ssl | f > version | > cipher | > bits | > compression | > client_dn | > client_serial | > issuer_dn | It might well be your own local connection on which you are running the query... Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com