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 1jhfnl-0004nv-0u for pgsql-general@arkaria.postgresql.org; Sat, 06 Jun 2020 20:52:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jhfnj-0004QL-G5 for pgsql-general@arkaria.postgresql.org; Sat, 06 Jun 2020 20:52: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 1jhfnj-0004QE-7v for pgsql-general@lists.postgresql.org; Sat, 06 Jun 2020 20:52:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhfng-0003pV-De for pgsql-general@lists.postgresql.org; Sat, 06 Jun 2020 20:52:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 056KqIRp1694727; Sat, 6 Jun 2020 16:52:18 -0400 From: Tom Lane To: Michel Pelletier cc: pgsql-general Subject: Re: Should I enforce ssl/local socket use? In-reply-to: References: Comments: In-reply-to Michel Pelletier message dated "Sat, 06 Jun 2020 13:22:23 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1694725.1591476738.1@sss.pgh.pa.us> Date: Sat, 06 Jun 2020 16:52:18 -0400 Message-ID: <1694726.1591476738@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michel Pelletier writes: > I'm the author of the pgsodium cryptography library. I have a question > about a best practice I'm thinking of enforcing. Several functions in > pgsodium generate secrets, I want to check the Proc info to enforce that > those functions can only be called using a local domain socket or an ssl > connection. If the connection isn't secure by that definition, secret > generating functions will fail. > If someone really wants to point the gun at their foot, they can connect > with an unsecured proxy. My goal would be to make bypassing the check > annoying. > Any thoughts? Is this an insufferably rude attitude? I would say yes. How do your functions know that their outputs are going to be transmitted to the client at all? Even if the current session doesn't, what would stop a user from storing the results in a table and then reading them out over an insecure connection later? Besides which, you can't really tell this way how secure or insecure the connection is. (As a concrete example, the security of a non-SSL connection over localhost is probably not much worse than over Unix-domain socket.) > Are there scenarios > where one can foresee needing to generate secrets not over ssl or a domain > socket? Windows users, who lack the Unix-domain option, would probably find it quite annoying to be forced to use SSL for local connections. regards, tom lane