From owner-freebsd-hackers@freebsd.org Sat Apr 8 12:20:09 2017 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22389D33469; Sat, 8 Apr 2017 12:20:09 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: from mail-wr0-x235.google.com (mail-wr0-x235.google.com [IPv6:2a00:1450:400c:c0c::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE290FB9; Sat, 8 Apr 2017 12:20:08 +0000 (UTC) (envelope-from etnapierala@gmail.com) Received: by mail-wr0-x235.google.com with SMTP id o21so94984618wrb.2; Sat, 08 Apr 2017 05:20:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:mail-followup-to :references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=XobHHXa5gBlO4FgGmMJm1dVEnAWAGgT6oEn2g9zMgHQ=; b=q+dxSTBUltZc6KrMFf7VG4rlbkMT4j+M/0rjN9jRMxpQTy9WGxOJFTWYfklePdWYgH E2fy4LXY7cf8v+tm80msWyKhTODP4J+5UD+J+wLgm6ednjMrF0su+rhR8ApQFohHfwan FgIOG2bvcay416ZvCT73+BtUQgKqxo0ctOsnWtuTQeVKmrVzFzyq+vNlGpnrqe3lyvUy ORUqWYE6/zIK14Kjce2ZT1rt4netXylNAX03+f4I1r5b1aKsQ0gfyxLua1tHQ+gVpix9 BWrUy30rZG8IZV3iTFe3JNe+37/yd4yzs3hKoxOuaJDILNHTc7pfjcY0aD/FWSMJMiU1 yiOw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=XobHHXa5gBlO4FgGmMJm1dVEnAWAGgT6oEn2g9zMgHQ=; b=Rxz/LCb1rFDNsM4JAKWKbHhrmFFNClqMgdlf8USq2nobBakBQmGNQ/fsQOZlkzh4wy SKj/nvMlGATeH8dVZaGtJVxomdBHvbverRlcW8ua6hmyEf+OV/Oizp/Z+RCn43WA17no xWZEqyLW3XTpGQbCRxxkJEOsdVl1qU//1BVgM/ja9d1bgAJLKMzzCel2q0dCWH6CVL2X wmaLnExo8QqvTZGCbuv15qYB5TgRFBr3Qcjegi5px7A+gpxsUV6nEgC9OEf54c+5D58R ckLdzrL5e2eqmUqdlJleh3l9iK0DiGzZ2UrXApalYnS6mE0aU7/lzhoS8s4GhLJjOOvn 73Fw== X-Gm-Message-State: AFeK/H3/QINj4ZaLKZqjpRJgFhtwyHnz5R1wUi3TIDTDYgxTN1OmnrdBp7nBwinzmrk/ZA== X-Received: by 10.223.175.207 with SMTP id y15mr37082764wrd.63.1491654005920; Sat, 08 Apr 2017 05:20:05 -0700 (PDT) Received: from brick (cpc92310-cmbg19-2-0-cust934.5-4.cable.virginm.net. [82.9.227.167]) by smtp.gmail.com with ESMTPSA id 51sm9707510wrx.38.2017.04.08.05.20.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Apr 2017 05:20:05 -0700 (PDT) Sender: =?UTF-8?Q?Edward_Tomasz_Napiera=C5=82a?= Date: Sat, 8 Apr 2017 12:52:22 +0100 From: Edward Tomasz =?utf-8?Q?Napiera=C5=82a?= To: Eric McCorkle Cc: "freebsd-hackers@freebsd.org" , freebsd-security@freebsd.org Subject: Re: Proposal for a design for signed kernel/modules/etc Message-ID: <20170408115222.GA64207@brick> Mail-Followup-To: Eric McCorkle , "freebsd-hackers@freebsd.org" , freebsd-security@freebsd.org References: <6f6b47ed-84e0-e4c0-9df5-350620cff45b@metricspace.net> <20170408111144.GC14604@brick> <181f7b78-64c3-53a6-a143-721ef0cb5186@metricspace.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <181f7b78-64c3-53a6-a143-721ef0cb5186@metricspace.net> User-Agent: Mutt/1.8.0 (2017-02-23) X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 Apr 2017 12:20:09 -0000 On 0408T0803, Eric McCorkle wrote: > On 04/08/2017 07:11, Edward Tomasz NapieraƂa wrote: > > On 0327T1354, Eric McCorkle wrote: > >> Hello everyone, > >> > >> The following is a design proposal for signed kernel and kernel module > >> loading, both at boot- and runtime (with the possibility open for signed > >> executables and libraries if someone wanted to go that route). I'm > >> interested in feedback on the idea before I start actually writing code > >> for it. > > > > I see two potential problems with this. > > > > First, our current loader(8) depends heavily on Forth code. By making > > it load modified 4th files, you can do absolutely anything you want; > > AFAIK they have unrestricted access to hardware. So you should preferably > > be able to sign them as well. You _might_ (not sure on this one) also > > want to be able to restrict access to some of the loader configuration > > variables. > > Loader is handled by the UEFI secure boot framework, though the concerns > about the 4th code are still valid. In a secure system, you'd want to > do something about that, but the concerns are different enough (and it's > isolated enough) that it could be done separately. Unless the way to address those ends up being a signature mechanism that doesn't depend on the format of the files being signed. > > Second - given OpenSSL track record, moving signature verification > > and the x.509 stuff into the kernel (to verify userland) and loader > > (to verify the kernel and modules)... well, it just doesn't seem > > to be a good idea. > > Integrating all of OpenSSL would be massively overkill. All you need is > RSA/Ed25519 signature verification and parsing a subset of PKCS#7. > > My thoughts here are to grab the RSA/Ed25519 implementations from > libsodium and just write a minimal PKCS#7 parser. Ok, that seems to be a reasonable idea. > > Also: do you know about veriexec? > > > > https://reviews.freebsd.org/D8575 > > Is there some documentation of this other than a code review? Not sure; it might be best to just ask the author. Note that there are some manual pages in there, and also that it's not a single review - follow the chain of "Depends on", there's a lot of stuff there.