Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bw9kT-0005Co-Jx for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Oct 2016 15:22:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1bw9kS-0003KM-Nm for pgsql-hackers@arkaria.postgresql.org; Mon, 17 Oct 2016 15:22:44 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bw9j4-0001mn-0L for pgsql-hackers@postgresql.org; Mon, 17 Oct 2016 15:21:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1bw9j1-00088L-8g for pgsql-hackers@postgresql.org; Mon, 17 Oct 2016 15:21:16 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u9HFL3PA028174; Mon, 17 Oct 2016 11:21:03 -0400 From: Tom Lane To: Heikki Linnakangas cc: pgsql-hackers@postgresql.org Subject: Re: [COMMITTERS] pgsql: Replace PostmasterRandom() with a stronger way of generating ran In-reply-to: <4f31c7c5-817c-aa3b-ae48-a613008dc558@iki.fi> References: <26591.1476715823@sss.pgh.pa.us> <4f31c7c5-817c-aa3b-ae48-a613008dc558@iki.fi> Comments: In-reply-to Heikki Linnakangas message dated "Mon, 17 Oct 2016 18:09:00 +0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <28172.1476717663.1@sss.pgh.pa.us> Date: Mon, 17 Oct 2016 11:21:03 -0400 Message-ID: <28173.1476717663@sss.pgh.pa.us> X-Pg-Spam-Score: -2.2 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Heikki Linnakangas writes: > On 10/17/2016 05:50 PM, Tom Lane wrote: >> The real issue here is whether we are willing to say that >> Postgres simply does not work anymore on machines without standard entropy >> sources. Doesn't matter whether the user cares about the strength of >> cancel keys, we're just blowing them off. That seems a bit extreme >> from here. I think we should be willing to fall back to the old code >> if we can't find a real entropy source. > I'm scared of having pg_strong_random() that is willing to fall back to > not-so-strong values. We can rename it, of course, but it seems > dangerous to use a weak random-number generator for authentication > purposes (query cancel, MD5 salts, SCRAM nonces). I think that it's probably moot on all modern platforms, and even on platforms as old as pademelon, the answer for people who care about strong security is "--with-openssl". What I'm on about here is whether we should make people who don't care about that jump through hoops. Not caring is a perfectly reasonable stance for non-exposed postmasters; otherwise we wouldn't have the "trust" auth method. I would be satisfied with making it a non-default build option, eg add this to pg_strong_random: if (random_from_file("/dev/random", buf, len)) return true; +#ifdef ALLOW_WEAK_SECURITY + ... old PostmasterRandom method here ... +#endif + /* None of the sources were available. */ return false; regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers