Make sure you run this on the TDX VM (the attestation won't work otherwise).
Start vault in development mode:
make vault
WARNING! dev mode is enabled! In this mode, Vault runs entirely in-memory
and starts unsealed with a single unseal key. The root token is already
authenticated to the CLI, so you can immediately begin using Vault.
You may need to set the following environment variables:
$ export VAULT_ADDR='https://127.0.0.1:8200'
$ export VAULT_CACERT='/tmp/vault-tls2386973238/vault-ca.pem'
The unseal key and root token are displayed below in case you want to
seal/unseal the Vault or re-authenticate.
Unseal Key: xxx
Root Token: yyy
The following dev plugins are registered in the catalog:
- vault-auth-plugin-attest
Development mode should NOT be used in production installations!
The measurements on your VM will probably differ (which is the whole point).
Login with the attestation quote:
make vault-login-tdx
Success! You are now authenticated. The token information displayed
below is already stored in the token helper. You do NOT need to login
again. Future Vault requests will automatically use this token.
Key Value
--- -----
token hvs.XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
token_accessor XXXXXXXXXXXXXXXXXXXXXXXX
token_duration 768h
token_renewable true
token_policies ["default"]
identity_policies []
policies ["default"]
token_meta_tdx test
[!IMPORTANT]
The CLI helper is using /dev/tdx_guest device that should be available
in the TD VM. Make sure necessary packages/drivers are installed. Also,
the permissions will most likely require root access.
Stir some things:
apt-get upgrade --yes
reboot now
Try to re-login:
make vault-login-tdx
Failed with error:
failed to fetch tdx-attested token: Error making API request.
URL: PUT https://127.0.0.1:8200/v1/auth/attest/tdx/test/login
Code: 400. Errors:
* failed to validate tdx quote
Trusted domain is pre-configured with TOTP secret that's shared between the TD
and Vault.
Firstly, the TD will request a nonce from Vault by providing it with TOTP code
that is generated with the use of that shared secret.
If the TOTP code is valid and wasn't used before, Vault will issue a nonce
with limited validity period.
Upon receipt of the nonce, the TD will wait until the next TOTP code can be
generated, produce the attestation quote that incorporates the nonce issued by
Vault, and request the authentication token from Vault by providing it with
the 2nd TOTP code and the attestation quote.
Vault then will verify the validity of the TOTP code, validate the
attestation quote, and verify that it's measurements do match the values
pre-configured in Vault.