Signing with Your Own CA
This feature is currently available only to customers participating in a Private Preview. If you'd like to participate and be among the first to try this feature, ask our support or account team for details.
You can register a root certificate authority (CA) that you already have, or have Workload Secrets Vault generate one, and then use it to sign certificate signing requests (CSRs), generate certificates, and issue SSH user certificates. The CA and the certificates you choose to keep are stored as ordinary secrets at paths you choose, so secret policies control who can use them.
Certificates issued this way aren't tracked, and Workload Secrets Vault can't revoke them. For tracked certificates with revocation, use a Managed Certificate Authorities.
Registering an Existing Root CA
Provide the CA certificate and its RSA private key (PKCS #1 or PKCS #8), each as Base64-encoded PEM. Read the files directly so that the key doesn't end up in your shell history:
delinea --json workload pki ca register \
--root-ca-path pki/roots/corp \
--certificate "$(base64 -w0 root.pem)" \
--private-key "$(base64 -w0 root.key)" \
--domains '["build.corp.example.com", "deploy.corp.example.com"]' \
--max-ttl-hours 720 \
--crl http://crl.corp.example.com/root.crl
The value of --private-key is still visible to other processes on the same computer while the command runs, so on a shared computer, register the CA through the API.
base64 -w0 works with GNU base64, as on Linux, but not on macOS. On macOS, replace base64 -w0 root.pem with base64 < root.pem | tr -d '\n', and do the same for the other files in this topic. That form works on Linux too.
| Field | Description |
|---|---|
rootCaPath
|
The secret path where the CA is stored. No secret can exist at the path yet. |
certificate
|
The CA certificate, as Base64-encoded PEM. |
privateKey
|
The CA's RSA private key in PKCS #1 or PKCS #8 format, as Base64-encoded PEM. |
domains
|
The names this CA can sign for in Workload Secrets Vault. |
maxTtlHours
|
The longest lifetime, in hours, of certificates the CA signs, counted from when each one is signed. It can't be longer than the remaining validity of the CA certificate when you register it. |
crl
|
Optional. The address of a CRL that you publish. It's added to every certificate the CA signs. |
The response contains the certificate and private key that you supplied, and the CA's public key in OpenSSH format (sshPublicKey).
-
Every DNS name in the certificate's subject alternative names must be a valid domain. A certificate with a wildcard name, such as
*.corp.example.com, is rejected. -
Registration doesn't check that the private key matches the certificate, or that the certificate is a CA certificate. Check both before you register.
A certificate's lifetime isn't cut short when the CA certificate expires, and the CA's remaining validity is checked only when you register it. A certificate signed late in the CA's life can therefore outlive the CA, and the CA keeps signing after its own certificate expires. Stop signing with a CA once its remaining validity is shorter than the lifetimes you request, and register a new one.
Generating a New Root CA
delinea --json workload pki ca generate \
--root-ca-path pki/roots/internal \
--common-name ca.internal.example.com \
--domains '["app.internal.example.com"]' \
--max-ttl-hours 8760 > root.json
The CA is valid for maxTtlHours, which also limits the certificates it signs. As with a registered CA, a certificate's lifetime runs from when it's signed, so certificates can outlive the CA, and the CA keeps signing after it expires. You can add a crl address as for registration. Unlike registration, generation also accepts a subject object with any of country, state, locality, organization, organizationalUnit, and emailAddress. The response contains the CA certificate, its private key, and its public key in OpenSSH format (sshPublicKey).
Signing a CSR
delinea --json workload pki sign \
--root-ca-path pki/roots/internal \
--csr "$(base64 -w0 app.csr)" \
--ttl-hours 24 \
--chain | jq -r '.certificate' | base64 -d > app.pem
-
The CSR must have an RSA key and a common name. Only its public key and common name are used: other subject fields and extensions in the CSR are ignored.
-
The common name and every name in
subjectAlternativeNamesmust be in the CA's domains. -
If
ttlHoursis 0 or left out, the certificate gets the CA's maximum lifetime. Withchainset totrue, the response also includes the CA certificate asrootCertificate. -
Nothing is stored.
Generating a Certificate and Key
To have Workload Secrets Vault generate the key pair as well:
delinea --json workload pki leaf create \
--root-ca-path pki/roots/internal \
--common-name app.internal.example.com \
--store-path pki/leaves/app \
--ttl-hours 24 > leaf.json
The response contains the certificate, its private key, and its public key in OpenSSH format. If you set storePath, the certificate and key are also stored as a secret at that path, which can't exist yet. Leave storePath out to get the certificate without storing it.
-
The certificate gets a common name only, which must be one of the CA's domains. Unlike
pki sign,pki leaf createdoesn't takesubjectAlternativeNames. -
You can add a
subjectobject with the same fields as for generating a CA. -
With
chainset totrue, the response also includes the CA certificate asrootCertificate.
root.json and leaf.json contain private keys. When you've copied out what you need, such as the CA certificate and sshPublicKey, or the certificate and key for your workload, delete both files from the computer where you ran these commands.
Issuing SSH User Certificates
An SSH user certificate lets a workload sign in to SSH servers that trust your CA, without distributing its key to each server. The certificate is issued for a key pair that you generated with pki leaf create and stored with storePath, and it's signed by the CA's key:
delinea --json workload pki ssh-cert create \
--root-ca-path pki/roots/internal \
--leaf-ca-path pki/leaves/app \
--ttl-hours 8 \
--principals '["deploy"]' | jq -r '.sshCertificate' > id_rsa-cert.pub
-
principalslists the user names the certificate is valid for. Always list at least one principal. -
The certificate permits X11, agent, and port forwarding, a terminal, and user rc files. It has no critical options, and you can't change these settings.
-
The new certificate is also saved to the secret at
leafCaPath. -
To make an SSH server accept these certificates, add the CA's
sshPublicKeyto the server's trusted user CA keys, for example with theTrustedUserCAKeysoption of OpenSSH.
Permissions and Policy Actions
Policy targets are the secret paths in the request, in the form secret/<path>.
| Operation | Permission | Policy actions |
|---|---|---|
| Register or generate a CA | Manage PKI Certificate Authority | create on the CA path |
| Sign a CSR | Sign Certificate | read on the CA path |
| Generate a certificate and key | Create PKI Certificate | read on the CA path, and create on the store path if you set one |
| Issue an SSH certificate | Update PKI Certificate | read on the CA path, and read and update on the leaf path |
The CA, including its private key, is stored as a secret at its path. Anyone with read on that path and the Read Secret permission can read the private key with secret get. Because signing also needs read on the CA path, give signing access only to identities you'd trust with the CA's private key. If you need callers to issue certificates without that level of trust, use a managed CA instead.
Because the CA is an ordinary secret, signing CSRs, generating certificates, and issuing SSH certificates all use the secret's current version. Anyone with the Create Secret permission and create on the CA path can write a new version that changes the CA's domains, maximum lifetime, or CRL address, or that replaces the CA certificate and key. Treat write access to the CA path as control of the CA.
Errors
-
400with the error codepki_validation_failed: a name, domain, lifetime, certificate, or key breaks a rule. Thedetailfield says which. -
404with the error codepki_not_found:rootCaPathdoesn't hold a CA, orleafCaPathdoesn't hold a certificate stored withpki leaf create. For example, nothing is stored at the path, or the secret's current version is deleted or destroyed. -
409with the error codepki_conflict: a secret already exists at the CA path or store path.