Skip to content
Integrations
Secrets Managers
HashiCorp Vault

Set up HashiCorp Vault

A HashiCorp Vault (opens in a new tab) integration lets Astralis read integration credentials from a KV secrets engine in your Vault by logging in with an AppRole you create.

Secrets manager integrations are part of Astralis Enterprise. See the secrets managers overview for how managers and references fit together.

Prerequisites

  • Permission: secrets_manager:create_or_update, held by the Owner role.
  • Vault access: permission to write policies and create AppRoles, on self-hosted Vault or HCP Vault Dedicated.
  • Secrets: each secret is a KV v1 or KV v2 object. Read an integration's credentials from a manager shows the keys each integration type needs.

Confirm Astralis can reach Vault

Astralis connects to Vault directly over the internet and enforces these rules on the address:

RuleDetail
HTTPS onlyhttp:// addresses are refused. TLS certificate verification cannot be turned off.
Public addresses onlyEvery address the hostname resolves to must be publicly routable. Loopback, link-local, private (RFC 1918), and reserved ranges are refused, checked when you save and on every connection.
Hostname or IPv4IPv6 literals are refused. The default port is 443; include another port in the address, such as https://vault.example.com:8200.
No proxy, no redirectsAstralis ignores proxy settings and does not follow redirects, so point it at the active node or a load balancer.

For HCP Vault Dedicated, enable public cluster access and add the Astralis egress addresses to the cluster's IP allow list: your own network's on a deployment you run, or the addresses Ethyca support gives you for an Ethyca-hosted one.

If Vault uses a certificate from a private certificate authority, have the CA certificate ready in PEM format.

Standby nodes and load balancers

Set the address to Vault's active node, or to a load balancer that forwards to it. Standby nodes normally forward requests to the active node, but answer with a redirect when request forwarding is off or fails, and a captive portal or load balancer can answer with its own page. Astralis follows neither, and reports them as NonJsonResponse.

Astralis treats NonJsonResponse as an outage: integrations keep using cached values for up to 30 minutes, and the manager's Test fails until Vault itself answers.

Create a read policy and an AppRole

Use a dedicated KV mount for the secrets Astralis reads, so its policy covers nothing else. Anyone who can write to that mount controls the credentials your integrations connect with, so limit write access to the people who manage those credentials.

  1. Write a policy granting read on the mount. For KV v2, the data path includes data/:

    # KV v2 mount named "astralis"
    path "astralis/data/*" {
      capabilities = ["read"]
    }

    For a KV v1 mount, grant read on astralis/* instead.

  2. Enable AppRole if it is not already enabled, and create a role with the policy:

    vault auth enable approle
    vault write auth/approle/role/astralis \
      token_policies="astralis-read" \
      token_ttl=1h \
      token_max_ttl=4h \
      secret_id_ttl=2160h \
      secret_id_num_uses=0 \
      token_num_uses=0
  3. Read the role ID and generate a secret ID:

    vault read auth/approle/role/astralis/role-id
    vault write -f auth/approle/role/astralis/secret-id

Settings that matter for Astralis:

SettingRecommendationWhy
secret_id_num_uses0 (unlimited)Every Astralis process logs in with the secret ID, and logs in again when its token expires. A small limit is used up quickly.
token_num_uses0 (unlimited)Every secret read and every check uses the token.
secret_id_ttlFinite, such as 90 daysGives the secret ID an expiry you rotate on. Revoking it is your kill switch.
Token policiesKeep the default policyAstralis checks its token with lookup-self, which the default policy allows. With token_no_default_policy=true, every test and every refused read causes a new login.

If you restrict the role with secret_id_bound_cidrs or token_bound_cidrs, use your deployment's egress addresses, as for HCP Vault Dedicated above.

Astralis takes the secret ID as-is. Response-wrapped secret IDs are not supported.

Add the manager in Astralis

  1. Navigate to Settings → Secrets managers.

  2. Click Add secrets manager.

  3. Enter a Name and choose HashiCorp Vault as the Provider. The provider cannot be changed later.

  4. Fill in the connection fields:

    FieldValue
    AddressThe Vault URL, such as https://vault.example.com
    MountThe KV mount, such as astralis
    KV version2 or 1. Astralis does not detect it, and the two versions store secrets at different paths.
    NamespaceVault Enterprise and HCP Vault Dedicated only. HCP uses admin by default.
    CA certificateThe PEM certificate, when Vault uses a private CA
    AppRole role IDThe role ID from the previous step
    AppRole secret IDThe secret ID from the previous step. Stored encrypted and never shown again.
  5. Click Add secrets manager.

The secrets manager form for HashiCorp Vault with address, mount, KV version, namespace, CA certificate, and AppRole fields

Astralis logs in at the approle auth mount. If your AppRole is enabled at another path, set details.auth_mount through the API with PATCH /api/v1/plus/secrets-manager/{key}.

Verify the connection

Click Verify connection in the manager's form, or Test on the manager's row. A Healthy result means the AppRole login succeeded.

The test authenticates only; it does not read a secret. Your read policy is proven when you check an integration's reference.

Reference a secret

An integration's reference is the secret's path under the mount, without the mount and without data/. For a KV v2 secret written with vault kv put astralis/billing-postgres ..., the reference is billing-postgres.

Paths use letters, digits, and /_.+=@-, start with a letter or digit, and contain no empty, ., or .. segments.

Rotate the secret ID

  1. Generate a new secret ID: vault write -f auth/approle/role/astralis/secret-id.
  2. In Astralis, edit the manager, enter the new AppRole secret ID, and click Save changes.
  3. Click Verify connection.
  4. Revoke the old secret ID in Vault.

Changing the Address, Namespace, or CA certificate also requires entering the secret ID again in the same save, so a secret ID cannot be sent to a server you did not intend.

To cut Astralis off, remove the read grant first: Vault checks policies on every request, so this also stops tokens Astralis already holds. See revoke access for the full procedure.

Related