Linux Shielded VM Tools -- Tools for managing shielded Linux VMs for use in Hyper-V
Перейти к файлу
microsoft-github-policy-service[bot] 2d7e586e40
Auto merge mandatory file pr
This pr is auto merged as it contains a mandatory file and is opened for more than 10 days.
2022-11-28 19:11:54 +00:00
3rdparty Initial commit of LSVMTools source code. 2017-05-09 18:56:10 -05:00
binaries Mikbras (#6) 2017-09-22 12:28:32 -07:00
deb Removed install script from .deb file. 2017-10-30 18:40:33 -05:00
doc Updated docs (#7) 2017-09-26 14:29:18 -07:00
lsvmload Changed logging code to use SPrint. 2021-08-06 22:22:35 -07:00
lsvmtool Mikbras (#6) 2017-09-22 12:28:32 -07:00
lsvmutils Should Ignore Buffer too small error since we already reallocate the correct size for BIO handles in that case. 2021-09-20 20:54:26 +00:00
policy Initial commit of LSVMTools source code. 2017-05-09 18:56:10 -05:00
posix Initial commit of LSVMTools source code. 2017-05-09 18:56:10 -05:00
rpm Updated RPM spec file to exclude install script. 2017-10-30 18:14:03 -05:00
scripts Added Rpm package (#8) 2017-10-18 15:01:35 -07:00
striplic Initial commit of LSVMTools source code. 2017-05-09 18:56:10 -05:00
.gitignore Updated .gitignore with temporary files. 2017-05-10 11:01:27 -05:00
LICENSE Initial commit of LSVMTools source code. 2017-05-09 18:56:10 -05:00
Makefile Added Rpm package (#8) 2017-10-18 15:01:35 -07:00
README.md Updated docs (#7) 2017-09-26 14:29:18 -07:00
SECURITY.md Microsoft mandatory file 2022-08-31 15:21:40 +00:00
VERSION Initial commit of LSVMTools source code. 2017-05-09 18:56:10 -05:00
configure Initial commit of LSVMTools source code. 2017-05-09 18:56:10 -05:00
dbxupdate.bin Initial commit of LSVMTools source code. 2017-05-09 18:56:10 -05:00
defs.mak Initial commit of LSVMTools source code. 2017-05-09 18:56:10 -05:00
lsvmprep Made test for askpass specific to Ubuntu 2017-11-01 13:40:02 -05:00
rules.mak Initial commit of LSVMTools source code. 2017-05-09 18:56:10 -05:00
sanity Initial commit of LSVMTools source code. 2017-05-09 18:56:10 -05:00

README.md

LSVMTools

Overview

The LSVMTools project provides tools for shielding Linux VMs operating in the Microsoft(R) Windows Hyper-V environment. LSVMTools aims to protect Linux VMs from attack while at rest and in flight. It builds on the following technologies.

  • Windows Server 2016 Guarded Fabric
  • Hyper-V Shielded VMs
  • UEFI
  • TPM 2.0
  • Linux Unified Key Setup (LUKS)
  • dm-crypt

LSVMTools provides two main tools.

  • LSVMPREP - Prepares the image for shielding
  • LSVMLOAD - The primary boot loader for the image

LSVMPREP

LVSMPREP prepares the Linux enviroment for shielding. After the image is prepared, it must be templatized and provisioned as described in the LSVM How-To document. LSVMPREP performs the following steps.

  • Encrypts the boot partition with a well-known passphrase
  • Patches the system to automatically mount the encyrpted boot parition
  • Installs LSVMLOAD on the EFI System Partition (ESP)
  • TPM-seals the passphrases and stores them on the ESP
  • Copies the SHIM and GRUB2 to the encrypted boot partition
  • Patches the initial ramdisk configuration to get passphrases non-interactively
  • Regenerates the initial ramdisks and GRUB2 configuration
  • Applies any UEFI dbx updates (for black-listed boot loaders)

After these steps are performed, the image is ready to be templatized. See the LSVM How-To document for details.

LSVMLOAD

LSVMLOAD becomes the primary EFI boot loader for the Linux VM. UEFI loads LSVMLOAD, assuming it passes certificate verification (LSVMLOAD must be signed by a certificate that Hyper-V trusts). LSVMLOAD performs the following steps.

  • Uses TPM to unseal a keyfile (containing the disk partition passphrases)
  • Maps the ESP onto an ESP ramdisk
  • Maps the encrypted boot partition onto an unencrypted boot ramdisk
  • Patches the initial ramdisk with the keyfile (on the boot ramdisk)
  • Loads the Linux SHIM from the boot ramdisk
  • Launches the SHIM, which is redirected to the ESP ramdisk

The SHIM finds GRUB2 on the ESP ramdisk (copied from the encrypted boot partition by LSVMLOAD). The SHIM executes GRUB2, which is redirected to the boot ramdisk, where it finds:

  • A patched GRUB2 configuration file
  • A patched initial ramdisk (patched by LSVMLOAD with the keyfile)
  • The Linux kernel

GRUB2 executes the kernel and the initial ramdisk. The initial ramdisk mounts the boot and root partitions using the keyfile injected by LSVMLOAD.

LSVMLOAD works using unmodified SHIM and GRUB2 executables, making it possible to configure a Linux environment for shielding without having to change any programs along the boot chain.

Documents

Supported Linux distributions

LSVMTool current supports the following Linux distributions.

  • Ubuntu 16.04 LTS with the 4.4 kernel
  • Red Hat Enterprise Linux 7.3
  • SUSE Linux Enterprise Server 12 Service Pack 2

Installing

This section explains how to install from a binary distribution. Binary distributions can be downloaded from the following link.

These distributions include LSVMPREP and a signed LSVMLOAD.

Use the following commands to install the distibution.

# tar zxvf lsvmtools-1.0.0-x86_64.tar.gz
# cd lsvmtools-1.0.0-x86_64
# ./install

Created /opt/lsvmtools-1.0.0

This installs LSVMTools in the following location.

/opt/lsvmtools-1.0.0

Running LSVMPREP

Caution: Running LSVMPREP encrypts the boot partition and makes irreversible configuration changes to a virtual machine. Only run LSVMPREP to prepare an image for templatization.

To run LSVMPREP, execute the following commands as root.

# cd /opt/lsvmtools-1.0.0
# ./lsvmprep

***************************************************
*     ____    _   _   _ _____ ___ ___  _   _      *
*    / ___|  / \ | | | |_   _|_ _/ _ \| \ | |     *
*   | |     / _ \| | | | | |  | | | | |  \| |     *
*   | |___ / ___ \ |_| | | |  | | |_| | |\  |     *
*    \____/_/   \_\___/  |_| |___\___/|_| \_|     *
*                                                 *
*                                                 *
* LSVMPREP is about to encrypt the boot partition *
* and make irreversible configuration changes to  *
* this machine. If you are certain you want to    *
* proceed, type YES in uppercase and then press   *
* enter; else press ENTER to terminate.           *
*                                                 *
***************************************************

> _

If LSVMPREP runs successfully, the image is ready to be templatized. See LSVM How-To for what to do next.

Building

This section explains how to build LSVMTools from source, but note that LSVMPREP requires a signed LSVMLOAD image, which must be downloaded separately (see the previous section for details).

To build LSVMTools, type these commands.

# ./configure
# make

These commands build LSVMPREP and an unsigned LSVMLOAD.

To run the tests, type:

# make tests

Recovering the LUKS keys

In case anything goes wrong, use the following command to recover LUKS keys.

# dmsetup table --showkeys

License

LSVMTools 

MIT License

Copyright (c) Microsoft Corporation. All rights reserved.

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in 
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.