Secrets
Store and manage credentials securely with AES-256-GCM encryption and flexible storage backends.
How Secrets Work
Secrets are encrypted credentials that OnePAM injects into sessions at connection time. Users never see or handle raw passwords — they simply click Connect and the agent resolves the credential locally. All secrets are encrypted with AES-256-GCM and can be stored in OnePAM, on a dedicated gateway, or directly on the agent host.
Secret Types
| Type | Fields | Use Case |
|---|---|---|
| Credential | Username, password | SSH password, database login, RDP credential |
| SSH Key | Username (optional), private key, passphrase (optional) | SSH key-based authentication |
| API Key | Value, header name (optional) | API token for HTTP resources |
| Certificate | PEM certificate (required), private key, CA chain, passphrase (all optional) | mTLS authentication, TLS client certificates |
| Generic | Dynamic key/value pairs | Custom credential types |
Storage Modes
OnePAM-managed
The encrypted payload is stored in the OnePAM cloud. This is the simplest option and requires no additional setup.
Customer-managed (Gateway)
The encrypted payload is stored on your dedicated gateway. Requires at least one registered dedicated gateway. Secrets are stored and resolved within your own network.
Agent-managed
The encrypted payload is stored exclusively on the agent host. Secrets are created and managed directly on the server via the agent CLI — no one else can modify them. Only the secret title (name and type) is synced to OnePAM so administrators can assign agent-managed secrets to resources. OnePAM never sees credential values.
Managing Secrets
- Create — click New Secret, choose a type and storage mode, enter values, and save.
- View — click a secret to see its metadata and access log. Click Reveal to decrypt and display values (this action is audited).
- Assign — secrets are assigned to resources from the resource create/edit form or via bulk operations.
- Delete — removes the secret metadata and stored payload. Assigned resources will lose their credential binding.
The Access Log tab on each secret shows a chronological history of who accessed or revealed the secret.
Agent-Managed Secrets
Agent-managed secrets are credentials created and stored exclusively on the agent host. Unlike OnePAM-managed or gateway-managed secrets, agent-managed secrets can only be created, modified, or deleted by an operator with access to the agent's host machine. The onepam.com API and web UI cannot modify them.
How It Works
- An operator runs
onepam-agent --secrets addon the agent host to create a secret. - The secret is encrypted with AES-256-GCM and stored in
secrets.encin the agent's data directory. - The agent automatically syncs secret titles (ID, name, type) to onepam.com — credential values are never transmitted.
- Administrators can then assign agent-managed secrets to resources via the UI or CLI.
- At session time, the agent resolves the credential locally from its encrypted store.
Ownership Model
| Operation | Who Can Do It |
|---|---|
| Create / modify / delete secret values | Agent host operator only (via agent CLI) |
| View secret titles | Any authorized user (via UI, CLI, or API) |
| Reveal secret values | Authorized users (fetched from agent via WebSocket, audited) |
| Assign to resources | Administrators (via UI or CLI) |
Quick Start: Agent Local Secrets
Run these commands on the agent host to manage local secrets.
All commands use the agent's data directory (/opt/onepam/data by default).
List local secrets
onepam-agent --secrets list
Add a password credential
onepam-agent --secrets add \
--secret-name "prod-db-admin" \
--secret-username "admin" \
--secret-password "s3cur3-p@ss"
Add an SSH key
onepam-agent --secrets add \
--secret-name "deploy-key" \
--secret-key-file ~/.ssh/id_rsa \
--secret-passphrase "optional-passphrase"
Test secret resolution
onepam-agent --secrets test --secret-id <uuid>
Remove a secret
onepam-agent --secrets remove --secret-id <uuid>
add or remove, the agent automatically syncs titles to onepam.com
using a signed HMAC-SHA256 request
(requires AGENT_API_URL, AGENT_TENANT_ID, and AGENT_ID to be configured).
The sync is also performed automatically on agent startup.
Quick Start: CLI Client
Use the onepam CLI client to manage secrets from any workstation.
These commands work with all storage modes (OnePAM, gateway, and agent-managed).
List all secrets
onepam secrets list
Create a new secret (OnePAM-managed)
onepam secrets create --name "staging-db" --type password
Show secret metadata
onepam secrets show <secret-id>
Reveal secret values (audited)
onepam secrets reveal <secret-id>
View access audit log
onepam secrets audit <secret-id>
List secrets on a specific agent
onepam secrets remote --agent-id <agent-uuid>
Delete a secret
onepam secrets delete <secret-id>
Assign a secret to a resource
onepam resources assign-secret <resource-name> <secret-id>
Remove a secret assignment
onepam resources unassign-secret <resource-name>
onepam-agent --secrets on the agent host instead.
Assigning Secrets to Resources
Any secret — regardless of storage mode — can be assigned to a resource. When a user connects to that resource, the agent automatically resolves the credential and injects it into the session.
Agent-Managed Secret Assignment Flow
- The agent operator creates a secret on the host:
onepam-agent --secrets add --secret-name "prod-db" - The agent syncs the secret title to onepam.com automatically.
- An administrator assigns the secret to a resource via the UI or CLI:
onepam resources assign-secret my-server <secret-id> - When a user connects, the agent resolves the credential from its local encrypted store and injects it.
Via the UI
Navigate to Resources, edit the target resource, and select the desired secret from the Secret dropdown. Agent-managed secrets appear alongside OnePAM-managed and gateway-managed secrets.
Via the API
POST /api/v1/resources/{id}/secret
Content-Type: application/json
{ "secret_id": "<secret-uuid>" }
Security Model
Encryption at Rest
All secrets are encrypted using AES-256-GCM. The encryption key is derived via SHA-256 from one of:
AGENT_SECRET_KEYenvironment variable (recommended for production)INTEGRATION_SECRET_KEYenvironment variable (fallback)- An auto-generated 256-bit random key stored in
<data-dir>/.secret_key(generated on first run)
The encrypted file (secrets.enc) is written atomically to prevent corruption.
Agent-Only Write Ownership
For agent-managed secrets, the agent is the sole authority for credential values. The onepam.com API enforces this with explicit guard rails:
- The Create endpoint rejects
storage_mode: "agent"— agent secrets can only be created on the host. - The Update and Store endpoints reject writes to any secret whose storage mode is
agent. - The Delete endpoint rejects deletion of agent-managed secret metadata — only the agent can remove them.
- The CLI client (
onepam secrets) validates input format before sending requests, providing an additional layer of defense.
Only the operator on the agent host can mutate the encrypted store via onepam-agent --secrets.
Title Sync (Metadata Only)
When the agent creates or removes a secret, it syncs a list of titles (secret ID, name, and type) to onepam.com. This metadata enables resource assignment in the UI and API. Credential values — passwords, keys, passphrases — are never included in the sync.
- Signed requests — every sync request is signed with HMAC-SHA256 using the agent's encryption key, both in long-running mode and standalone CLI mode.
- Strict validation — secret IDs must be valid UUIDv4 and types must match the allowed set (
credential,ssh_key,api_key,certificate,generic). Names are trimmed and length-limited (max 255 chars). - Atomic upsert — all creates, updates, and deletes within a single sync run inside a database transaction. A partial failure rolls back the entire batch, preventing inconsistent state.
- Collision protection — onepam.com rejects any agent-reported secret ID that already belongs to an OnePAM-managed or gateway-managed secret, preventing cross-mode ID conflicts.
- Rate-limited — a single sync accepts at most 500 secrets.
Audit Trail
Every Reveal operation (decrypting and displaying a secret) is logged with the user identity, timestamp, client IP, and the resource context. Access logs are available per-secret and in the organisation-wide audit log.
Configuration Reference
| Environment Variable | Flag | Default | Description |
|---|---|---|---|
AGENT_SECRET_KEY |
— | (auto-generated) | Encryption key for the local secret store and HMAC-SHA256 request signing. Set explicitly in production for deterministic key management. |
AGENT_DATA_DIR |
--data-dir |
/opt/onepam/data |
Directory where secrets.enc and .secret_key are stored. |
AGENT_API_URL |
--server |
— | onepam.com API URL. Required for automatic title sync after secret mutations. |
AGENT_TENANT_ID |
--tenant-id |
— | Organisation UUID. Required for title sync. |
AGENT_ID |
--agent-id |
(auto-generated) | Agent UUID. Required for title sync. |