OUTDATED Provisioning SSH keys

In this tutorial, we'll generate SSH secrets that we'll use to connect to our Azure VM via SSH.

Create a template

The first step will be to create a template for VM. You can refer to the "Create a Buckypaper VMs template" tutorial for a better understanding of how to do this.

Create a namespace

The second step will be to create a namespace. This is a mandatory requirement for creating attestation. You can learn how to create and use namespaces in the documentation.

Create dkv-v2 engines

The third step is to create two engines. The first is called "vm-auth", where we'll store the SSH secrets. The second engine is called "buckypaper", where we will store the description key.

POST http://localhost:8200/v1/sys/mounts/vm-auth

Headers

Name
Value

X-Vault-Token

X-Vault-Namespace

education

Body

Name
Type
Value

type

string

dkv-v2

Response

204 No Content

Generate SSH secrets

At this stage, we need to generate SSH secrets. SSH KEY - generation of private and public key. SSH PW - password generation.

GET http://localhost:8200/v1/vm-auth/data/:user/ssh-key/:name

We have generated the secrets for the azure user, which will be stored under the name "azureuser".

Params

Name
Type
Value

user

string

azure

name

string

azureuser

Headers

Name
Value

X-Vault-Token

X-Vault-Namespace

education

Response

Register new workload

POST http://localhost:8200/v1/auth/ratls/attestation/create

For more detailed information on creating attestation, you can refer to the documentation.

Body

Name
Type
Description

template

string

f05d8808-547a-4e9a-9843-07c3f55b7e67

namespace

string

education

webhook

string

http://localhost:3000/webhook

Headers

Name
Value

X-Vault-Token

Response

Create a VM

At this stage, we will create an Azure VM from the DC2as_v5 family with the Ubuntu 20_04-lts-cvm operating system version, as it supports confidential VMs.

When creating the VM, you should also include cloud-init. The configuration for cloud-init is shown below.

ENV
Description
Value

ENCLAIVE_PROTOCOL

sev-snp

ENCLAIVE_SOURCE

The provider name that we specified during the measurement creation.

azure

ENCALIVE_INSTANCE

The "instance" field that we obtained during the attestation creation.

77255d88-754c-42a3-954f-58fb86bf48a5

ENCALIVE_RESOURCE

Virtual machine name

azure-vm

ENCALIVE_NITRIDE

Nitride URL

http://localhost:8200

ENCALIVE_KEYSTORE

Vault URL

http://localhost:8200

ENCLAIVE_FEATURES

The path from which secrets are added to the VM for a particular user.

method:user:secret:name

In the ENCLAVE_FEATURES variable, "method" can be either "ssh-key" or "ssh-pw", "user" is the scope in which the secrets are stored, "secret" is the name under which we store the secret, and "name" is the username to which the keys are added. We need to set which method for SSH connection will be added for the user.

Once all the steps have been completed, the result of the attestation will be sent to the webhook you specified when creating the attestation. Below is an example of what is sent to the webhook. Ensure that the webhook accepts the HTTP POST method.

After receiving the attestation result via webhook, we can connect to the VM using the secrets we created earlier.

Last updated

Was this helpful?