diff --git a/trustedimage/README.md b/trustedimage/README.md new file mode 100644 index 0000000..7448c7b --- /dev/null +++ b/trustedimage/README.md @@ -0,0 +1,22 @@ +Generate and build AMD-SEV-SNP attestable VM disk images for GCP or Azure + +## Dependencies + +To run build and upload disk images, you'll need +- [packer](https://developer.hashicorp.com/packer/tutorials/docker-get-started/get-started-install-cli) +- [gcloud](https://cloud.google.com/sdk/docs/install-sdk) (to make GCP disk images) +- [az](https://learn.microsoft.com/en-us/cli/azure/install-azure-cli) (to make Azure disk images) + +Then you'll also need to install the `qemu` plugin for packer, run +``` +packer init template.pkr.hcl +``` + +Finally, you'll have to configure credentials and projects for the cloud provider you want to build +disk images on. See azure_config.example or gcp_config.example. + +## Building + +`make build/gcp_version` will create a GCP disk image +`make build/azure_version` will create an Azure disk image +`make` will default to the GCP version diff --git a/trustedimage/gcp.sh b/trustedimage/gcp.sh index 6a865b5..7aa25ff 100755 --- a/trustedimage/gcp.sh +++ b/trustedimage/gcp.sh @@ -25,7 +25,7 @@ function rm_blob() { } trap rm_blob EXIT $GCLOUD storage cp ../host/main gs://$GCP_BUCKET/svr3-$VERSION -tar --transform="s/$(basename $FROM)/disk.raw/" --format=oldgnu -cvf - -C $(dirname $FROM) $(basename $FROM) | pv -f | pigz >gcp.tar.gz +tar --transform="s/$(basename $FROM)/disk.raw/" --format=oldgnu -cvf - -C $(dirname $FROM) $(basename $FROM) | pigz >gcp.tar.gz if [ -z "$GCP_JUMPHOST" ]; then $GCLOUD storage cp ./gcp.tar.gz $BLOB else diff --git a/trustedimage/template.pkr.hcl b/trustedimage/template.pkr.hcl new file mode 100644 index 0000000..cf0b844 --- /dev/null +++ b/trustedimage/template.pkr.hcl @@ -0,0 +1,8 @@ +packer { + required_plugins { + qemu = { + version = "~> 1" + source = "github.com/hashicorp/qemu" + } + } +}