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=lersek@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 06ED821F0DA4C for ; Mon, 5 Feb 2018 10:00:33 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5173978543; Mon, 5 Feb 2018 18:06:14 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-166.rdu2.redhat.com [10.10.120.166]) by smtp.corp.redhat.com (Postfix) with ESMTP id 539435F90D; Mon, 5 Feb 2018 18:06:12 +0000 (UTC) To: Dmitry Mityugov References: From: Laszlo Ersek Cc: edk2-devel@lists.01.org, "Richard W.M. Jones" Message-ID: <6da66215-3b2b-5b94-1978-823f569c3ce0@redhat.com> Date: Mon, 5 Feb 2018 19:06:11 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.2 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Mon, 05 Feb 2018 18:06:14 +0000 (UTC) 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:00:34 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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. 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