Credential Management
How AsPeekIt stores and masks discovery zone credentials, and how the agent credentials work: zone keys, dedicated keys, enrollment tokens and client certificates, with their lifecycle and best practices.
Discovery Zone Credentials
Each discovery zone keeps the credentials for its target (cloud account, vCenter, cluster, monitoring source, SNMP devices) in its connection_config, a JSON object whose keys depend on the zone type: see the page of each discovery source for the exact fields. Zones are created and edited by managers and admins in Discovery → Zones (/dashboard/discovery).
- connection_config is stored in PostgreSQL as JSON: it is not encrypted by the application, so the database and its backups must be protected
- By default zones must carry their own credentials: the backend never falls back to its ambient credentials (in-cluster service account, GCP application default credentials, a local kubeconfig) unless DISCOVERY_ALLOW_SERVER_CREDENTIALS=true
- Relay-mode zones are executed by a relay in the remote network; the relay authenticates to AsPeekIt with its own key (see Relay Overview, /docs/relay/overview)
Credential Masking
The API never returns zone secrets, in the zone list, the detail or after an update. Every value whose key looks secret is replaced by ***MASKED***, recursively in nested objects and lists, and a PEM private key is masked whatever its key. The same applies to the zone settings.
- Keys are considered secret when they contain password, passwd, passphrase, secret, token, key, credential, credentials_json, kubeconfig, community, cert, bearer, authorization, cookie, session, sas, connection_string or dsn (case-insensitive)
- A few harmless keys are never masked: verify_ssl, verify_tls, verify_cert, insecure_skip_tls_verify, auth_protocol, priv_protocol, key_count
- Empty values and booleans are returned as they are, so the form can show whether a secret is set
- On update, a field sent back as ***MASKED*** keeps the stored value (deep merge): you only type a secret when you want to change it. The mask literal itself is never stored
Credential Best Practices
Recommendations for the identities used by discovery zones.
- Use a dedicated read-only identity for AsPeekIt, never one with write or administrative rights
- Scope it as narrowly as possible: one subscription (Azure), one project (GCP), the objects to discover (vCenter), get/list/watch only (Kubernetes)
- Rotate it on your usual schedule and update the zone after each rotation; check the next run in Job History (/dashboard/discovery/jobs), where authentication errors appear in the job result
- Deactivate or delete zones that are no longer used, so their credentials do not linger
Warning: Never share zone credentials through e-mail, chat or shared documents: use your secrets manager.
Agent Keys
Agents authenticate with an API key sent in the X-API-Key header together with their X-Agent-ID. Keys are managed by managers and admins on the Agents page (Discovery → Agents, /dashboard/discovery/agents): Zone keys on each agent-based zone, and Set dedicated key / Manage dedicated key on each agent card.
- Format: idpk_ followed by a random string. AsPeekIt stores only the SHA-256 hash and the first 8 characters (the prefix shown in the table)
- The full key is shown once, in the API Key Created dialog, together with the install command; it cannot be displayed again
- Zone key: valid for every agent of the zone that has no dedicated key of its own. A zone key never authenticates an agent that has a dedicated key, and by default it cannot register a new agent (AGENT_ALLOW_ENV_KEY_ENROLLMENT=false): new agents enroll with a token
- Dedicated key: authenticates exactly one agent_id; revoke it to cut off one host without rotating the zone key
- The key table shows name, prefix, status (Active or Revoked), last used and creation date. An optional expiry (expires_at) can be set through the API; expired keys are rejected
- Revoke marks the key inactive (it is kept for traceability and cannot be re-enabled); the agent using it is rejected from its next request. Creation and revocation are recorded in the audit log (agent_key.created, agent_key.revoked) with the prefix, never the key

Enrollment Tokens
An enrollment token lets a new agent register itself once and receive a dedicated key of its own, so no long-lived shared secret has to be distributed to every host. Tokens are created per zone (Enrollment tokens on the zone in the Agents page) with an expiry of at most AGENT_ENROLLMENT_TOKEN_MAX_HOURS (default 720) and a maximum number of uses (default 1); they are stored hashed and can be revoked. See Agent Enrollment & mTLS (/docs/agent/enrollment).
Client Certificates (Automatic mTLS)
On top of its key, an agent obtains a client certificate from the platform CA: the private key is generated on the host and never sent, the certificate lasts AGENT_CERT_VALIDITY_DAYS (default 90) and is renewed automatically. An agent that obtained its first certificate with a zone key also receives a dedicated key at that moment, and the zone key stops authenticating it.
- The agent card shows whether a client certificate is bound and when it expires
- Reset on the agent card (admin only, confirmed with Reset certificate) unbinds the certificate of an agent whose host key was lost or compromised; the agent then requests a new one
- Issued and reset certificates are recorded in the audit log (agent_cert.issued, agent_cert.reset)
Warning: Before revoking a zone key, make sure every agent that still uses it has a dedicated key or a new zone key: revocation takes effect at once.