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 1oJLxg-0008IW-DF for pgsql-general@arkaria.postgresql.org; Wed, 03 Aug 2022 21:31:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oJLxf-0005rf-6K for pgsql-general@arkaria.postgresql.org; Wed, 03 Aug 2022 21:31:27 +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 1oJLxe-0005nO-OV for pgsql-general@lists.postgresql.org; Wed, 03 Aug 2022 21:31:26 +0000 Received: from mail-qv1-xf32.google.com ([2607:f8b0:4864:20::f32]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1oJLxc-0004p6-J0 for pgsql-general@lists.postgresql.org; Wed, 03 Aug 2022 21:31:25 +0000 Received: by mail-qv1-xf32.google.com with SMTP id l18so10480828qvt.13 for ; Wed, 03 Aug 2022 14:31:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:references:to :content-language:user-agent:mime-version:date:message-id:from:to:cc; bh=Lyc0eLS82NH9UZFN1/Jax780f2G/svA7N+JxWHjshkg=; b=FhStLe5dtaQgpDzP8P4XVuxXEeC7TNnKP2efP4mUkd86F8AO8JC5pB9sj+DtM/s9mJ RAhO4eZOM/sm84mSMUvbwOGBTrqRHk13uFnLzBSvnsWhec8+suMCHIa6y/Y0nH0KXwpn VvilgQ9JkQ6BgEY8hxCfoB41zptF6BpWLHsR962sGhh2ZhIiMMwhl+0+pFqt3XJcWtun fmxm1K4O+EBgsValZtEUA/sw2VELCsD+TqNpRzBQdXeA4wQQAI0ld+KHjrf1ygOi5037 pB4KnrM98igheaf2MDdKxqubfWys0F7yXV3Mg7p/7TJiZRRV37Qj7CA3IGspdhK/qmYp jS/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:subject:from:references:to :content-language:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc; bh=Lyc0eLS82NH9UZFN1/Jax780f2G/svA7N+JxWHjshkg=; b=zZirZXBK8i0KEysXUg2yBFYQaw9ptZKHzLVtJkp2GL2mp6r5JXcu+54N8/KOxEdNgu mzZC5GxvW7IeAF+Hv4oVzOjq1joQwR28C5zEzLmV5IvtuHI58nxqxuFIWk9zFhBU4r4s mI2Pwmyw05tPYSvwUhhNFeHebmQlJW7jLYvnmGNHj9k7QQgM1pVAL7ehPmQhYI6j5Snd V5XDmXZGDwyEOkn/KfHJWedeHgh/IS+m5IqjKInQoqxQRiNrCbDsaQBpoHBoL/l+Lfcn euXi+Jx8tyGuyx8HAbZeD5BRCpZuokdM5Ffi1LFHVF9ILRszQ3msJnlP6PxZZFvofyvF jnCw== X-Gm-Message-State: ACgBeo3CrYdUYE4Btc8hSFn91WGTyencNWVtHOVe7bSmjTezXBD7oHYe 2FsW9i3NN1ySbvkHfeB9bEY= X-Google-Smtp-Source: AA6agR7ZtmcAofOCI2ZZ5ZnuzbU383pPqe6x91biYpN98K2YlXj3qfaLgfRW711OjsVBftvvOU0M0g== X-Received: by 2002:ad4:5bc7:0:b0:476:e427:ded7 with SMTP id t7-20020ad45bc7000000b00476e427ded7mr7603114qvt.76.1659562283474; Wed, 03 Aug 2022 14:31:23 -0700 (PDT) Received: from ?IPV6:2605:2a00:8000:dead::3ac? ([2605:2a00:8000:dead::3ac]) by smtp.gmail.com with ESMTPSA id x14-20020a05620a448e00b006b6757a11fcsm14217641qkp.36.2022.08.03.14.31.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 03 Aug 2022 14:31:23 -0700 (PDT) Message-ID: Date: Wed, 3 Aug 2022 17:31:22 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.11.0 Content-Language: en-US To: Rejo Oommen , pgsql-general@lists.postgresql.org References: From: Thomas Guyot Subject: Re: Is Client connections via ca.crt only possible? In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-08-01 04:12, Rejo Oommen wrote: > Requirement is to use only ca.crt and connect to postgres > > Server.crt, Server.key and ca.crt are configured at the postgres > server for tls connection. > > Connection successful while using > psql ‘host=172.29.21.222 dbname=test user=postgres sslmode=verify-ca > sslcert=/tmp/server.crt sslkey=/tmp/server.key sslrootcert=/tmp/ca.crt > port=5432’ > > For clients to connect, can they use only ca.crt and connect to the > DB. Tried and got the below error > > psql ‘host=172.29.21.222 dbname=test user=postgres sslmode=verify-ca > sslrootcert=/tmp/ca.crt port=5432’ > psql: error: connection to server at “172.29.21.222”, port 50001 > failed: FATAL:  connection requires a valid client certificate > Hi Rejo, I don't think you understand fully how mutual TLS auth works. For the client to authenticate using a certificate, it needs a valid certificate and key too, where the certificate is signed by a CA your server trusts (usually the same CA that signed your server cert) and with a proper subject (that bears the certificate owner's user name, the user you will use to grant privileges in the database). You shouldn't even need to pass a username, it will be in the certificate. I'm talking purely from a generic view, I'm not familiar with any of the specifics of PostgreSQL configuration but TLS authentication requires a secret and a CA certificate isn't secret. Your server certificate authenticates the server, but nothing authenticates the client. Regards, -- Thomas