Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp6014196imm; Mon, 23 Jul 2018 09:53:53 -0700 (PDT) X-Google-Smtp-Source: AAOMgpeUHltb7Rb/cVPvGfR/9+CLydhGnH3AWBS+2lUeYyLk5OyqynYQf3jKcm7zRp198VWWyxeP X-Received: by 2002:a17:902:22e:: with SMTP id 43-v6mr13877764plc.82.1532364833806; Mon, 23 Jul 2018 09:53:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532364833; cv=none; d=google.com; s=arc-20160816; b=xnlBeVqhH2gPcbPtIFyja0Weq/zqY2pSZMbxYMIm8r5CYLOP77T8hQModQIJWruFUe q38WYPRCt5vLWJb/7J8ZiewCaNgWG9PDeF9LP/SjgM/1VOMghwg4mdyVQ4CvAhf1OROx KWRa52K8NCybbA+ZVppdnSAr5iw0WtP5AwTgrEUvTbX9EUfcQqX+OfsEACTtentBl75X fwcl8Bh36xyZNosspd9bwCYk+iPwn40b79eNWQ1+I68x8huHA2D9tJ65+huwGL0f5ZoP rstyqeu+R2kXRGlXCN7izcWV1HivxLvGB/EHVAeoy30hTMSMyCrvmonsrKatfs49oJDs 3YSg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:to:subject :message-id:date:from:references:in-reply-to:mime-version :dkim-signature:arc-authentication-results; bh=XcKZK1qEcUIFf7j9vJK6gTysy80sixeqrONCrrToW+c=; b=qWcNfP5QQQiXMd54XOiOKl8hQ9G7SZZeFT5ECyWySNhbgPA+VISN8n71bFfYz4NQni kRKdIZzG9aFkMiQ5/bVh/vx1OFMHANWFZPxHK9uXzcy4KJdMgdoszu2TWLcK7px9vyim X5QYXqEY00k5NKDZIIkieihQEGlUjOoNPx9b29SN55gHX5UL71kPhfiKCP0sww3mfKwe /lLuF5NBXr5Irhjdm8k4W8llUXDDe2v5ZH24sPOnn3QfQF/1PaZPmu9f0S6q4uSabt93 TGeoExnW5V0Y03HwDe7Dqn0cGIsxwq8iBT+AoOzWmQmJhH+H3qXY7qsHdx5cJkrIL62x I9uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=VWUKxaAa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j184-v6si9068758pge.607.2018.07.23.09.53.39; Mon, 23 Jul 2018 09:53:53 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=VWUKxaAa; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388902AbeGWRyg (ORCPT + 99 others); Mon, 23 Jul 2018 13:54:36 -0400 Received: from mail-vk0-f65.google.com ([209.85.213.65]:44437 "EHLO mail-vk0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388357AbeGWRyg (ORCPT ); Mon, 23 Jul 2018 13:54:36 -0400 Received: by mail-vk0-f65.google.com with SMTP id 125-v6so649303vke.11; Mon, 23 Jul 2018 09:52:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-transfer-encoding; bh=XcKZK1qEcUIFf7j9vJK6gTysy80sixeqrONCrrToW+c=; b=VWUKxaAafaSYwt3Tra5nIKcY9p1zi/MldkM6UY2x1QmI68fZjoqgkQr7/yC5qpLvrM Bp5dTlIafBwbbzS7WRBFFgJpAhma4URgbp4AsQUZg2Y8pEP7o6lyFUec2S723RmOXp3M LMXQUJKNNl0HgomSZWcwgBadt+rHTfEiGzjcW0l04k92Ta6CtncG4XyomEmKwwrdBPNb LFm2NPAhf7ROaMLbEu7X+4GbQsqdiqvj7AQXQzN6AH2Olj5/h51MSBAdKrNPOcbVzWyS rKvs73duHtP5uqIaiAZHV8EHRzVdevn6iQz+YjMFLYgOLdcvFSw6YBCwrvqgQCglLt+q SZAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:content-transfer-encoding; bh=XcKZK1qEcUIFf7j9vJK6gTysy80sixeqrONCrrToW+c=; b=NrREFJSQnIcl19OO0bkMQaOnwFWW/E2SesrVIwtrgYHbyjVMY8R0gUQdBijJw0EoXb zHoolgS7zelXeaFrI9XVh9a+gYhw6ynJI0SiYER8FBiq0d+5Txzp2R1Uq1p2VY0nKd8m tenaNilcv42c8EfywJGmVouWsmPRqBSKBm38KHPYN7ONbf/MbL55YbQSFixnZ+JyX/Me CvEmt6fo5YpgKuIchSmq3YSQZmdnTKbBgoprIP4BFKyKq/tkJ7Wn3hSg29i2aGNUS9ln TcyMwxww4E7TN0D/yczp1xwiRbhd/nBsYtLyiFTvwtV9WojHgtf8uud4j/1xfuA9F+iZ 0hwg== X-Gm-Message-State: AOUpUlFJqW8rRtKY7otx00dGwBt1BgEoPe7sIXEdl8DK3KB4Pjb1n0eO OIR4Xdk8+vhhJQJNhYd7l+8Ee+p9En7d9BbGDXc= X-Received: by 2002:a1f:7d09:: with SMTP id y9-v6mr7958221vkc.15.1532364749308; Mon, 23 Jul 2018 09:52:29 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a67:d012:0:0:0:0:0 with HTTP; Mon, 23 Jul 2018 09:52:28 -0700 (PDT) In-Reply-To: <20180723151608.GE3358@thunk.org> References: <20180723151608.GE3358@thunk.org> From: Ken Moffat Date: Mon, 23 Jul 2018 17:52:28 +0100 Message-ID: Subject: Re: Does /dev/urandom now block until initialised ? To: "Theodore Y. Ts'o" , Ken Moffat , linux-crypto@vger.kernel.org, lkml Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 23 July 2018 at 16:16, Theodore Y. Ts'o wrote: > On Mon, Jul 23, 2018 at 04:43:01AM +0100, Ken Moffat wrote: >> >> Did that, no change. Ran strace from the bootscript, confirmed that >> only /dev/urandom was being used, and that it seemed to be blocking. > > Nope, /dev/urandom still doesn't block. Are you sure it isn't caused > by something calling getrandom(2) --- which *will* block? I'm not at all sure, which was why I asked. > > We intentionally left /dev/urandom non-blocking, because of backwards > compatibility. > >> BUT: I'm not sure if I've correctly understood what is happening. >> It seems to me that the fix for CVE-2018-1108 (4.17-rc1, 4.16.4) >> means /dev/urandom will now block until fully initialised. >> >> Is that correct and intentional ? > > No, that's not right. What the fix does is more accurately account > for the entropy accounting before getrandom(2) would become > non-blocking. There were a bunch of things we were doing wrong, > including assuming that 100% of the bytes being sent via > add_device_entropy() were random --- when some of the things that were > feeding into it was the (fixed) information you would get from running > dmidecode (e.g., the fixed results from the BIOS configuration data). > > Some of those bytes might not be known to an external adversary (such > as your CPU mainboard's serial number), but it's not exactly *Secret*. > >> If so, to get the affected desktop machines to boot I seem to have >> some choices... > > Well, this probably isn't going to be popular, but the other thing > that might help is you could switch distro's. I'm guessing you run a > Red Hat distro, probably Fedora, right? > Wrong, linuxfromscratch (sysv version) and beyond linuxfromscratch plus extras such as chronyd. The only initrd is on the haswell, and just for intel microcode. > The problem which most people are seeing turns out to be a terrible > interaction between dracut-fips, systemd and a Red Hat specific patch > to libgcrypt for FIPS/FEDRAMP compliance: > > https://src.fedoraproject.org/rpms/libgcrypt/blob/master/f/libgcrypt-1.6.= 2-fips-ctor.patch#_23 > > Uninstalling dracut-fips and recreating the initramfs might also help. > > One of the reasons why I didn't see the problem when I was developing > the remediation patch for CVE-2018-1108 is because I run Debian > testing, which doesn't have this particular Red Hat patch. > >> The latter certainly lets it boot in a reasonable time, but people >> who understand this seem to regard it as untrustworthy. For users >> of /dev/urandom that is no big deal, but does it not mean that the >> values from /dev/random will be similarly untrustworthy and >> therefore I should not use this machine for generating long-lived >> secure keys ? > > This really depends on how paranoid / careful you are. Remember, your > keyboard controller was almost certainly built in Shenzhen, China, and > Matt Blaze published a paper on the Jitterbug in 2006: > > http://www.crypto.com/papers/jbug-Usenix06-final.pdf > > In practice, after 30 minutes of operation, especially if you are > using the keyboard, the entropy pool *will* be sufficiently > randomized, whether or not it was sufficientl randomized at boot. The > real danger of CVE-2018-1108 was always long-term keys generated at > first boot. That was the problem that was discussed in the "Mining > your p's and q's: Detection of Widespread Weak Keys in Network > Devices" (see https://factorable.net). > > So generating long-lived keys means (a) you need to be sure you trust > all of the software on the system --- some very paranoid people such > as Bruce Schneier used a freshly installed machine from CD-ROM that > was never attached to the network before examining materials from > Edward Snowden, and (b) making sure the entropy pool is initialized. > > Remember we are constantly feeding input from the hardware sources > into the entropy pool; it doesn't stop the moment we think the entropy > pool is initialized. And you can always mix extra "stuff" into the > entropy pool by echoing the results of say, taking series of dice > rolls, aond sending it via the "cat" or "echo" command into > /dev/urhandom. > > So it should be possible to use the machine for generated long lived > keys; you might just need to be a bit more careful before you do it. > It's really keys generated automatically at boot that are most at risk > --- and you can always regenerate the host SSH keys after a fresh > install. In fact, what I have done in the past when I first login to > a freshly created Cloud VM system is to run command like "dd > if=3D/dev/urandom count=3D1 bs=3D256 | od -x", then login to VM, and then > run "cat > /dev/urandom", and cut and paste the results of the od -x > output into the guest VM, to better initialize the entropy pool on the > VM before regenerating the host SSH keys. > > Cheers, > > - Ted Thanks. In that case I'll go with the simple fix (haveged). =C4=B8en