vHSM Proxy quickstart

Learn to start vHSM Proxy and read secrets from a specified path in the vHSM server through vHSM Proxy.

vHSM Proxy is designed to simplify and accelerate the adoption of vHSM by providing a scalable, lightweight way for applications to interact with vHSM server seamlessly. Acting as an API proxy, vHSM Proxy streamlines authentication and token management, enabling applications to integrate with vHSM without handling complex auth workflows directly.

vHSM Proxy runs as a client-side daemon and offers the following key capabilities:

  • Auto-Auth: Automatically authenticates to vHSM and handles the lifecycle of dynamic secrets, including token acquisition and renewal.

  • API Proxy: Transparently proxies requests to vHSM’s API, with the option to use—or enforce the use of—an automatically authenticated token for all client interactions.

  • Caching: Supports local caching of responses for newly created tokens and leased secrets, reducing latency and minimizing redundant requests. It also manages the renewal of cached tokens and leases automatically.

Prerequisites

1. Create a directory for storing test files and configuration.

mkdir -p $HOME/vhsm-test && cd $HOME/vhsm-test

2. Create a mock dataset data.json representing a customer record, using an editor of your choice:

{
   "organization": "Enclaive",
   "customer_id": "ABXX2398YZPIE7391",
   "region": "US-West",
   "zip_code": "94105",
   "type": "premium",
   "contact_email": "[email protected]",
   "status": "active"
}
  1. Upload the test data to the vHSM KV v2 secrets engine:

4. Create the proxy configuration file vhsm-proxy-config.json that defines API endpoint for the client application to send requests to rather than VAULT_ADDR.

Note: The vault and auto_auth stanzas in the vHSM Proxy and vHSM Agent configurations are identical; however, you must define listener and api_proxy stanzas for vHSM Proxy.

  1. Start the vHSM Proxy.

The output is similar to:

  1. Open another command terminal and send an API request to the vHSM Proxy.

    Read the secrets at secret/customers/enclaive via the proxy address.

    Output:

    A token was automatically attached to the request by the vHSM Proxy because you set the use_auto_auth_token parameter to true in the configuration.

  2. Read the secrets again. This time, vHSM's Proxy returns the cached secrets.

    Use the --verbose or -v option with the cURL command so that you can see more detail.

  3. Update the secrets to see what happens.

  4. Read the secrets again through vHSM Proxy.

    The output is similar to:

  5. Press Ctrl + C to stop the running vHSM Proxy.

Last updated

Was this helpful?