From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=rjones@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 1F40321F0DA4E for ; Mon, 5 Feb 2018 10:07:59 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9433BC0587F0; Mon, 5 Feb 2018 18:13:40 +0000 (UTC) Received: from localhost (ovpn-116-184.ams2.redhat.com [10.36.116.184]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3AE4360E39; Mon, 5 Feb 2018 18:13:40 +0000 (UTC) Date: Mon, 5 Feb 2018 18:13:39 +0000 From: "Richard W.M. Jones" To: Laszlo Ersek Cc: Dmitry Mityugov , edk2-devel@lists.01.org Message-ID: <20180205181339.GN2787@redhat.com> References: <6da66215-3b2b-5b94-1978-823f569c3ce0@redhat.com> MIME-Version: 1.0 In-Reply-To: <6da66215-3b2b-5b94-1978-823f569c3ce0@redhat.com> User-Agent: Mutt/1.5.20 (2009-12-10) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Mon, 05 Feb 2018 18:13:40 +0000 (UTC) X-Mailman-Approved-At: Mon, 05 Feb 2018 11:18:33 -0800 Subject: Re: change keys in a ..._VARS.fd file programmatically (SecureBoot enabled) X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Feb 2018 18:07:59 -0000 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Feb 05, 2018 at 07:06:11PM +0100, Laszlo Ersek wrote: > Hi, > > On 02/05/18 15:14, Dmitry Mityugov wrote: > > Hi, > > > > Could you please let me know if it possible to automate changing keys in a > > ..._VARS.fd when SecureBoot is enabled? I understand that I can go into the > > UEFI shell and change them there manually, but I'm looking for a way to > > add/replace/delete them from my program before a KVM VM is started. > > > > I've found an email in this list with a similar question, > > https://lists.01.org/pipermail/edk2-devel/2017-August/012995.html , but I'm > > not sure if the answer is still valid, or if any new possibilities have > > arosen since then. > > My (still valid) answer is here: > > http://mid.mail-archive.com/550860A1.9030904@redhat.com > > and here: > > http://mid.mail-archive.com/56461E2D.1090601@redhat.com > > and here: > > http://mid.mail-archive.com/a1eedec9-f1c2-049d-8bb4-b094c9626f8e@redhat.com > > > There are also some home-made editors for the vars, like > > http://git.annexia.org/?p=virt-efivars.git;a=summary . Should I go this way > > in my adventure? > > I'm unsure how frequently Rich maintains this project (I'm CC'ing him), > but the approach in this project is generally workable, because it > modifies the variable store *from within* the guest (the "appliance" in > libguestfs lingo), using the UEFI runtime variable services. I don't really maintain it, but subject to the license the original questioner is free to try and make something of it. Rich. > Summary: > - if you try to modify the variable store file from the host side, with > a custom utility that is independent of edk2, that's a bad idea. > - Whereas, if you modify the variable store from within the guest, via > the UEFI variable services (calling them from the UEFI shell, or from > the guest operating system / a privileged guest OS process), that's a > good idea. (This is what "virt-efivars" does.) > > Thanks, > Laszlo -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://people.redhat.com/~rjones/virt-df/