# Secret managers

> A service variable can be a reference such as `ref+vault://secret/myapp#password` instead of a value. Your server fetches the value from your secret manager each time a container starts, and optionally on an interval. The value never passes through Unrent.

URL: https://unrent.dev/docs/secret-managers/

## Supported managers

Secret managers and how the server signs in

| Manager | Sign-in | Reference |
| --- | --- | --- |
| HashiCorp Vault or OpenBao (KV v2) | AppRole, a token, or server keys (no stored credential) | `ref+vault://<mount>/<path>#<key>` |
| Infisical | Machine identity (Universal Auth) | `ref+infisical://<environment>/<folder>/<NAME>` |
| Doppler | Service token | `ref+doppler://<project>/<config>/<NAME>` |
| AWS Secrets Manager | Access key | `ref+awssm://<secret id>#<json key>` |
| AWS Parameter Store | Access key | `ref+awsps://<parameter name without its leading />` |
| Google Secret Manager | Service account key | `ref+gcpsm://<secret>` |
| Azure Key Vault | App registration (client secret) | `ref+azurekv://<secret>` |
| 1Password Connect | Connect token | `ref+onepassword://<vault>/<item>#<field>` |
| Bitwarden Secrets Manager | Machine account access token | `ref+bitwarden://<secret id>` |

For JSON values, `#<key>` picks one field. The latest version is always read. `{env}` in a path becomes the service’s environment, so `ref+vault://apps/{env}/db#password` serves every environment.

## Server keys for Vault

Choose **Server key** as Vault’s sign-in and no credential is entered or stored anywhere. Each server signs a five-minute token with a key it made and never sends; once approvers confirm the manager, the card shows the servers’ public keys and the two JSON files and three `vault` commands that make Vault’s JWT auth trust them. Add `bound_claims` for the `env` claim to give each environment its own policies.

## Add a manager

1. In **Settings → Secret managers**, choose the manager, its address, region or project, the environments it serves (or every one), and enter its credential. Your browser seals the credential to each server of those environments; Unrent stores only the ciphertext.
2. An approver confirms it in **Approvals** with a passkey. Each server checks the approval, then allows its outbound connections to that manager’s hosts only.
3. Use **Test** with a reference: the server fetches it and reports only whether it worked.

> A manager on your own network (a private address, or plain http) needs **On my own network**. Cloud metadata addresses are always refused.

## Use references in a service

In the service’s **Config** tab, add a variable of kind **Reference** and pick the manager, path and key, or **Browse** the names your server lists from the manager (never values). **Import references** adds every name under a path at once, or the names of a pasted `.env` (its values are dropped in your browser). References also work in an environment’s or project’s variables and in Compose stack services. The value reaches the container the same way a sealed secret does: through a file in memory, never the container configuration, and redacted from logs.

**Resolve references** sets a refresh interval (from every minute to every day) and whether to restart the container when a value changes. Without a restart, the new value applies the next time the container starts.

If the manager does not answer when a container starts, the start fails and the current release keeps serving. If it does not answer during a refresh, the service keeps its last values and an alert fires until it answers again. The service page shows the alert, when each reference last resolved, and when a container still runs an older value (with **Restart**).
