MariaDB root admin password provisioning on Azure DCXas_v5 VM
In this self-contained tutorial we show how to provision a MariaDB container running in a confidential "buckypaper" VM on Azure. The tutorial easily transfers to any other CSP with buckypaper VMs.
In this tutorial, you will learn how to:
Configure the vHSM to attest a cVM.
Set up the vHSM to generate a high-entropy admin password.
Configure the enclaivelet to attest the cVM and securely retrieve the password.
Use cloud-config to automate these processes during VM startup.
Introduction
Setting up a cloud environment and configuring the network can be fraught with challenges. Given the complexity of cloud systems and the pressure to deliver products quickly, issues are almost inevitable.
Challenge
When cloud workloads fail to authenticate properly, they create critical vulnerabilities that can lead to significant security breaches. Without proper authentication, unauthorized users, malicious actors, or compromised applications may gain unrestricted access to sensitive data, services, and resources. This can result in data theft, manipulation, or deletion, leading to operational disruptions and financial losses. Furthermore, the absence of authentication increases the risk of privilege escalation, enabling attackers to move laterally within a network, compromise additional systems, and launch further attacks. This also complicates incident detection and response, making it difficult to trace malicious activities. In summary, missing authentication in cloud workloads compromises trust, compliance, and overall cloud security.
Solution
Traditionally, only users had identities, which led to the development of identity management services in the cloud. These services ensure that users authenticate with an identity provider that centrally manages access permissions and grants access to specific resources. For example, a user might authenticate with an identity management service (such as Entra on Azure, formerly known as Active Directory), which verifies permissions and grants access to a service like Key Vault with the appropriate capabilities (e.g., administrator role). Best practices emphasize the principle of least privilege, ensuring that users only have the access necessary to perform their tasks. Centralized management of user access also minimizes credential sprawl and reduces the risk of credential leakage by avoiding unnecessary storage and sharing.
Confidential computing introduces a new approach where workloads running in enclaves are assigned their own identity. With Nitride, the principles of identity management are extended to workloads. Unlike user authentication, a Buckypaper VM attests (where "attestation" for workloads is akin to "authentication" for users) to the workload identity provider, Nitride, to verify its authorization to access the Vault key management service. In Nitride, a policy defines how workload identities are verified and what access privileges they receive.
Prerequisites
For this tutorial, it is assumed that you have permission to create a confidential "buckypaper" VM on Azure. We have selected a cVM from the DCXas_v5 family, which supports AMD SEV-SNP. Alternative configuration options are available in the accompanying table. Additionally, it is assumed that the vHSM is correctly running on this cVM and is accessible via the /auth/ratls
path.
Getting-Started Blueprint
Any use case involving the secret provisioning of attested workloads generally includes one or more of the following steps:
Create the enclave identity
Creation of the enclave identities has to be done once for the cloud configuration
An enclaive identity captures the properties of the compute environment. It is divided into artefacts platform
, firmware
, workload
and metadata
.
Create the Namespace (Currently not optional)
In certain scenarios, it can be helpful to store secrets within namespaces. To achieve this, you can create a namespace called some-ns
by running the following command:
Configure a Platform Artifact
In the example below, the enclave identity is defined by a platform artifact, as described in the platform.json
file. This artifact details an AMD SEV-SNP enabled platform with VCEK attestation support.
In more complex cases, the enclave identity may consist of a combination of platform
, firmware
, workload
, and meta
artifacts.
Run this command to see available chains:
Run the command to create the platform identity
Example output:
Define an attestation verification policy
We need to tell Nitride next how to verify an attestation. To this end we define policy.json
. The canonical example below enforces the policy that platforms we previously defined under the name pass verification. The provider
ensures the correct attestation type is used by the client.
There are more options to this. Each field can individually be disabled and identities can be filtered based on values, but for this simple example, we will only verify the platform.
Run the command to create the policy
Example output:
Create a workload
Policies are resuable, so we use workloads to identify each instance. We can use our policy to create an attestation object that manages the verification procedure.
Aside from cosmetics, we set the target namespace some-ns
for the auth token that is given to the client after verification. We can also set an events handler to receive the attestation results.
We will also reference our created policy here.
Run the command to create the workload
Example output:
Note down the uuid. It is required by the attestation client.
Activate the buckypaper engine
To register the buckypaper extension vault-plugin-secrets-dkv
, use the following command with the correct SHA-256 digest
:
To verify successful registration, run the command below and look for vault-plugin-secrets-dkv
in the list:
We'll activate two endpoint instances of the vault-plugin-secrets-dkv
extension
Run the command below to confirm that the endpoint has been enabled correctly:
Example output:
Set up the cVM with the attestation client
Set the address
Download the client
The attestation client is contained in the vhsm
binary. It will only verify generated reports and output the token. The provisioning of secrets must be done by something else.
Download vhsm
and make it executable:
Create the attestation
Run the client
After successful attestation, the plugin generates an access token for the namespace that grants access to the buckypaper secrets engine in charge of generating the admin password.
Example Output:
.auth.client_token
is the access token for the namespace some-ns.
The attached policy is for additional external configuration. The actual policy is inlined into the token and currently can't be changed or viewed.
Example Webhook:
Provision the password from vHSM
It remains to contact the buckypaper secrets engine with the request to generate a high-entropy password, retrieve it over a secure channel, and source it into the enclave.
First, login with the attestation token:
Second, request the secret that will be dynamically generated:
Example Output:
After installing docker
, you can start a mariadb
-Container with this password:
Verify that the password is set:
Example Output:
Congratulations! You have successfully attested your first cVM.
After walking through the process by yourself, you now might want to automate.
The documentation for that is not updated yet.
Cloud-Init: Putting it all together
Cloud-init is a popular method for customizing a Linux VM during its initial boot. It allows you to automate tasks like installing packages, configuring users, setting up security, and writing files. Since cloud-init runs as part of the first boot process, no additional agents or steps are needed to apply configurations.
One of cloud-init's strengths is its compatibility across different distributions. Instead of specifying commands like apt-get install
or yum install
for package installation, you simply define a list of packages, and cloud-init automatically uses the appropriate package manager for the selected distribution.
Create cloud-init config file
At your bash prompt or in the Cloud Shell, create a file named cloud-init.txt
and paste the following configuration. For example, you can type sensible-editor cloud-init.txt
to create the file and choose from the available editors. Ensure that the entire cloud-init file is copied correctly, paying special attention to the first line:
Create a confidential "buckypaper" VM
Before creating a cVM, start by creating a resource group using az group create
. The following example sets up a resource group named myResourceGroupAutomate
in the eastus
location:
Next, create a VM using az vm create
, and pass in your cloud-init configuration file with the --custom-data
parameter. If the cloud-init.txt
file is saved outside of your current directory, be sure to provide the full path. The following example creates a VM named myAutomatedVM
:
It may take a few minutes for the VM to be created, packages to install, and the app to start. Background tasks continue running after the Azure CLI returns to the prompt, so accessing the app might take a couple of additional minutes. Once the VM is created, note the publicIpAddress
displayed by the Azure CLI. This IP address allows you to access the Node.js app via a web browser.
To allow web traffic to reach your VM, open port using az vm open-port
:
Last updated