Leased Secrets
Issue short-lived, per-machine PostgreSQL, MySQL, MariaDB, Supabase, or Redis credentials on demand.
Leased secrets create short-lived database or Redis credentials when an authorized machine reads them. Each machine receives its own provider account, password, and expiry, while applications continue to connect with the provider’s normal client libraries.
A leased secret returns connection fields and a credential together: host, port, database, username, and password. Redis returns an empty database field because its ACL users apply to the Redis instance.
#How leased secrets work
You connect a supported provider and choose the access each issued account should receive.
You set the credential lifetime, renewal behavior, and revocation controls.
A machine with project membership and an explicit grant reads the leased secret.
SikkerKey creates a provider account for that machine, stores its password encrypted, and returns the connection fields.
Later reads reuse or renew the credential according to the lease policy.
When the lease ends, the machine is disabled, or the leased secret is deleted, SikkerKey removes the issued provider account.
The provider username is stable for one machine and leased secret, begins with sk_l_, and remains separate from the usernames issued to other machines. Re-minting replaces its password so the previous credential stops authenticating.
Part | Purpose |
|---|---|
Provider connection | Lets SikkerKey create, renew, and remove accounts in the selected database or Redis instance |
Credential shape | Controls the generated password and the access granted to each issued account |
Lease policy | Controls lifetime, renewal, maximum age, and revocation behavior |
Machine grant | Authorizes one machine to request its own leased credential |
Access policy | Evaluates the project’s additional read rules before a credential is issued or returned |
Audit history | Records which machine minted, read, renewed, or lost a leased credential |
#Supported providers
Provider | Issued account | Expiry |
|---|---|---|
PostgreSQL | Login role created for the reading machine | Optional database-enforced VALID UNTIL plus account removal |
PostgreSQL (Supabase) | PostgreSQL login role reached through the Supabase pooler | Optional database-enforced VALID UNTIL plus account removal |
MySQL | User created as username@% | Account removal at lease expiry |
MariaDB | User created as username@% | Account removal at lease expiry |
Redis | Redis 6+ ACL user | ACL user removal at lease expiry |
Administrative account requirements
PostgreSQL and PostgreSQL (Supabase): CREATEROLE or SUPERUSER, plus permission to apply the configured grants.
MySQL and MariaDB: CREATE USER, ALL PRIVILEGES, or equivalent operator access, plus permission to apply the configured grants.
Redis: an ACL account with the administrative command permissions needed to list, create, update, and delete ACL users.
For PostgreSQL (Supabase), enter the 16–32 character lowercase project reference from the Supabase pooler hostname. SikkerKey appends it when connecting through Supavisor while keeping the database role name unchanged.
#Prepare the provider connection
Use a publicly routable hostname that resolves to the provider and accepts connections from SikkerKey. The connection check rejects loopback, private, link-local, and metadata addresses. Configure the provider firewall or network allowlist so SikkerKey can reach the selected port.
Connection security | Behavior |
|---|---|
Encrypted + verified | Encrypts traffic and verifies the provider certificate and hostname. Use a pasted CA certificate for a self-signed or private-CA service. |
Encrypted | Encrypts traffic without verifying the provider identity. This is the default. |
None | Uses an unencrypted provider connection. Use only when another trusted network layer protects the route. |
Use Test connection before creating the leased secret. It confirms network access, credentials, connection security, and the administrative account’s ability to manage provider users.
#Create a leased secret
Open the project that should own the leased credential, then open Secrets.
Select the plus button and choose Leased Secret.
Enter a name and select PostgreSQL, PostgreSQL (Supabase), MySQL, MariaDB, or Redis.
Enter the provider host, port, database, administrative username, and administrative password. Redis does not require a database name.
For PostgreSQL (Supabase), enter the project reference used by the pooler.
Choose the connection security level and add a CA certificate when Encrypted + verified uses a private certificate authority.
Select Test connection and confirm that the connection succeeds.
Continue to Lease & credential.
Choose the generated password shape, configure grants, and set the lease policy.
Review the complete configuration and select Create leased secret.
New leased secrets default to 32-character passwords using uppercase letters, lowercase letters, and numbers. The default lease lasts one hour, renews on reads made within the final 15 minutes, revokes when its machine is disabled, and uses PostgreSQL database-enforced expiry when available.
#Configure issued access
Grants define what each issued provider account can do. Leave the grants field empty to issue a login-only SQL account or a Redis account limited to connection commands.
Use the grant builder
Select Build template to start with Read-only, Read / write, or a broader provider-specific preset. You can then adjust individual privileges and scope before inserting the result.
PostgreSQL can scope grants to a schema, include sequence access, and apply matching default privileges to future tables and sequences.
MySQL and MariaDB scope generated grants to the configured database.
Redis can scope commands to a key pattern and optionally a Pub/Sub channel pattern.
Write a SQL grant template
For PostgreSQL, MySQL, or MariaDB, use {{name}} wherever the issued account should appear. SikkerKey replaces it with the safely quoted provider username during each mint.
GRANT SELECT ON ALL TABLES IN SCHEMA public TO {{name}};Write Redis ACL rules
For Redis, enter the key patterns, channel patterns, and command categories that should follow the issued username and password.
~app:* +@read +@writeOnly the vault owner can create or change a custom grants template because it runs with the configured administrative account. To reduce SQL privileges for accounts that are already active, create a replacement leased secret with the narrower grants and delete the original so its issued accounts are revoked.
#Configure the lease policy
Setting | How it works |
|---|---|
Credential lifetime | Sets how long an issued credential remains active. The minimum is one minute. |
Renew on read | Extends an active credential when its machine reads close to expiry. |
Renew window | Defines how close to expiry a read must occur before renewal. When automatic, SikkerKey uses half the credential lifetime. |
Hard maximum | Caps how long one issued credential can be extended. A later read mints a fresh password after the ceiling is reached. |
Database-native expiry | Adds PostgreSQL VALID UNTIL so PostgreSQL rejects the login at expiry, then SikkerKey removes the role. |
Revoke when machine disabled | Removes the machine’s active account after that machine is disabled. |
Mint fresh on every read | Generates and applies a new password for every successful read instead of reusing the active credential. |
MySQL, MariaDB, and Redis enforce expiry through account removal. If the provider is temporarily unreachable, SikkerKey retries revocation with increasing intervals until the account is removed.
#Grant a machine access
A read passes through machine authentication, project membership, the explicit secret grant, project lock state, and any attached access policy before SikkerKey contacts the provider.
Add the application machine to the leased secret’s project.
Configure that machine and grant it the leased secret.
Read the secret by its stable secret ID using a SikkerKey SDK or the CLI.
Use the returned host, port, database, username, and password with the provider client.
#Understand reads, renewal, and expiry
Situation | Result |
|---|---|
First read by a machine | Creates the machine’s provider account and returns a new password |
Read while the lease is active | Returns the same credential and records the read |
Read inside the renewal window | Extends expiry when renewal is enabled, up to the hard maximum |
Read after expiry | Mints a fresh password and returns the renewed provider account |
Mint fresh on every read enabled | Replaces the provider password during every read |
Machine disabled with revocation enabled | Removes that machine’s provider account |
Leased secret disabled | Stops minting and serving credentials until it is enabled again |
Lease expires | Removes the provider account; PostgreSQL can also reject it at its own expiry timestamp |
Reuse a credential for the lifetime of an application connection pool. Read again when opening a new pool or when the application needs to refresh an expiring credential.
#Manage an existing leased secret
Open the row menu and select Configure. The leased-secret configuration has four tabs.
Status
Active allows authorized machine reads to mint or return leased credentials.
Disable minting stops new reads. Provider accounts already issued remain active until their lease expires or another revocation event removes them.
Enable minting resumes authorized reads.
Policy
Change the lifetime, renewal window, hard maximum, database-native expiry, machine-disable revocation, or mint-on-every-read behavior, then select Save policy. Existing provider credentials retain their current account and expiry until subsequent reads, renewal, expiry, or revocation applies the new behavior.
Grants
Edit the access template directly or use Build template, then select Save grants. The saved template is used when SikkerKey next mints the provider credential.
Connection
Update the host, port, database, connection security, project reference, or administrative credentials. Re-enter the administrative username and password, select Test connection, and then select Save connection.
When moving to a different provider host or database, create and test a replacement leased secret first. After workloads use the replacement, delete the original so accounts issued in the original provider are revoked with its original connection.
#Delete a leased secret
Deleting a leased secret stops further reads immediately, queues every issued provider account for removal, removes its provider connection and lease configuration, and moves the retained secret record to Trash for 30 days. The same account-removal workflow runs when its project or vault is deleted.
Open the leased secret’s row menu and select Delete.
Review the machines that will lose access.
Confirm the deletion.
SikkerKey retries queued account removal when the provider is temporarily unavailable. Restoring the retained Trash record recovers its name, secret ID, and history in the original project. Create a new leased secret to establish a new provider connection, policy, grants, and credential lifecycle.
Permanent deletion from Trash, or automatic cleanup after 30 days, removes the retained leased-secret record and its history.
#Troubleshoot leased secrets
Symptom | What to check |
|---|---|
Test connection fails | Check the public hostname, port, firewall, database name, administrative credentials, provider privileges, and selected connection security. |
Host is blocked | Use a publicly routable provider hostname. Loopback, private, link-local, and metadata addresses are rejected. |
Certificate verification fails | Confirm the hostname matches the certificate. Paste the issuing CA certificate when the provider uses a self-signed certificate or private CA. |
Machine receives Access denied | Confirm the machine is approved, enabled, in the project, explicitly granted the leased secret, and allowed by the attached access policy. |
Project is locked | Resolve the project lock before requesting credentials. |
Minting fails | Confirm the administrative account can create or update users and apply the configured grants. Review the audit entry for the failed mint. |
Mint is in progress | Retry shortly; SikkerKey serializes concurrent requests for one machine’s provider account. |
Issued login can connect but lacks access | Review the grants template. An empty SQL template creates a login without database privileges, and empty Redis rules permit only connection commands. |
Renewal does not extend PostgreSQL expiry | Confirm the administrative account can alter the issued role and that the provider connection remains reachable. The current credential stays valid until its existing expiry. |
Disabled machine’s account remains | Confirm Revoke when machine disabled is enabled and the provider is reachable. SikkerKey retries removal when the provider becomes available. |
Leased secret is disabled | Open Configure, then Status, and select Enable minting. |