From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.90_1) id 1kddiB-0001vd-9J for mharc-grub-devel@gnu.org; Fri, 13 Nov 2020 13:22:15 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:44464) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kddiA-0001tg-4M for grub-devel@gnu.org; Fri, 13 Nov 2020 13:22:14 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:23235) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kddi5-0000Rz-SI for grub-devel@gnu.org; Fri, 13 Nov 2020 13:22:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1605291728; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=VdB/Gj1wXrv5yyoJk6pZji+EwPph/iTt36C7iNJI61o=; b=Js9Ixt+sUxWhKZiOfSWs++Tfsu758vOkJHL3yNGtutXv18/7FLpysc8OdzUwNEb418SLVC zQ+7cwingTl49kCUor1aaV/BmDNwYoY4wfFED8f5tUWa/Xm7LZWKhA9BwfIHi+4YEcVm09 Sn8kMk2wfiOJ5ZlzvOVTR4XJ4jYd+E8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-519-m3mGcxMIN32LBoHVxBu53Q-1; Fri, 13 Nov 2020 13:22:03 -0500 X-MC-Unique: m3mGcxMIN32LBoHVxBu53Q-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id D3A151868409; Fri, 13 Nov 2020 18:22:00 +0000 (UTC) Received: from work-vm (ovpn-114-160.ams2.redhat.com [10.36.114.160]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 76BF810021AA; Fri, 13 Nov 2020 18:21:58 +0000 (UTC) Date: Fri, 13 Nov 2020 18:21:55 +0000 From: "Dr. David Alan Gilbert" To: James Bottomley Cc: grub-devel@gnu.org, dovmurik@linux.vnet.ibm.com, Dov.Murik1@il.ibm.com, ashish.kalra@amd.com, brijesh.singh@amd.com, tobin@ibm.com, david.kaplan@amd.com, jon.grimm@amd.com, thomas.lendacky@amd.com, frankeh@us.ibm.com Subject: Re: [PATCH 0/3] Add ability to use SEV provisioned secrets for disk decryption Message-ID: <20201113182155.GT3251@work-vm> References: <20201113012206.24246-1-jejb@linux.ibm.com> <20201113175015.GS3251@work-vm> <16aa7a05356dc710ca18b5e954617cc9d4acd286.camel@linux.ibm.com> MIME-Version: 1.0 In-Reply-To: <16aa7a05356dc710ca18b5e954617cc9d4acd286.camel@linux.ibm.com> User-Agent: Mutt/1.14.6 (2020-07-11) X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dgilbert@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Received-SPF: pass client-ip=216.205.24.124; envelope-from=dgilbert@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/11/12 08:00:44 X-ACL-Warn: Detected OS = Linux 2.2.x-3.x [generic] [fuzzy] X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Nov 2020 18:22:14 -0000 * James Bottomley (jejb@linux.ibm.com) wrote: > On Fri, 2020-11-13 at 17:50 +0000, Dr. David Alan Gilbert wrote: > > * James Bottomley (jejb@linux.ibm.com) wrote: > > > To achieve encrypted disk images in the AMD SEV encrypted virtual > > > machine, we need to add the ability for grub to retrieve the disk > > > passphrase from the SEV launch secret. To do this, we've modified > > > OVMF to set aside an area for the injected secret and pass up a > > > configuration table for it: > > > > > > https://edk2.groups.io/g/devel/topic/78198617#67339 > > > > > > The patches in this series modify grub to look for the disk > > > passphrase in the secret configuration table and use it to decrypt > > > any disks in the system if they are found. This is so an encrypted > > > image with a properly injected password will boot without any user > > > intervention. > > > > > > The three patches firstly modify the cryptodisk consumers to allow > > > arbitrary password getters instead of the current console based > > > one. The next patch adds a '-s' option to cryptodisk to allow it to > > > use a saved password and the final one adds a sevsecret command to > > > check for the secrets configuration table and provision the disk > > > passphrase from it if an entry is found. With all this in place, > > > the sequence to boot an encrypted volume without user intervention > > > is: > > > > > > sevsecret > > > cryptomount -s > > > source (crypto0)/boot/grub.cfg > > > > I was thinking what happens if the evil admin adds an extra disc; I > > guess the argument here is that: > > a) Since you specify (crypto0) it can only be a decrypted disc > > b) And since only the guest owner can supply the keys, it can only > > be there disc image that can be decrypted. > > > > Right? > > Right, cryptomount will mount as (cryptoN) only those devices which can > actually be decrypted by the key. Since the initial grub.cfg is built > into the grub that executes from the firmware volume only someone who > knows the decryption key can substitute the booted volume. If you > substitute an unencrypted volume, the grub.cfg script I constructed > simply errors out (because it can't find any encrypted volumes) and > reboots. The script is more complicated than the simple illustration > above, but it's in this patch: > > https://edk2.groups.io/g/devel/message/67341?p=,,,20,0,0,0::Created,,PATCH+2%2F4,20,2,0,78198619 Hmm: +echo "Entering grub config" +sevsecret +if [ $? -ne 0 ]; then + echo "Failed to locate anything in the SEV secret area, prompting for = password" + cryptomount -a +else + cryptomount -s + if [ $? -ne 0 ]; then + echo "Failed to mount root securely, retrying with password prompt" + cryptomount -a + fi +fi if Eviladmin can make it fall down the cryptomount -a paths with one of their own discs attached they can decrypt that and boot, and then if they can later inject the original secret, then mount the original disc. I think Brijesh said that the secret could be changed later; so perhaps if the admin just stopped the secret being injected initially, or caused the VM to start without waiting for the injection, that would happen? Dave > James > > -- Dr. David Alan Gilbert / dgilbert@redhat.com / Manchester, UK