Certificate issuers and deployment platforms
ReadyEvery certificate of a Ydentifi deployment is issued by the deployer’s own certificate authority (CA). The server signs no certificate. It reads its certificates and keys from files, verifies client certificates against the deployment’s root, and takes up renewed files without a restart. A deployment can therefore be served by any CA that issues to the certificate contract.
Supported combinations#
The combinations below are supported, at the versions named.
| Issuer | Workstation, Docker Compose | Linux virtual machine, Docker Compose | Kubernetes, local (kind 0.33.0, Kubernetes 1.37.0) | Kubernetes, managed (GKE 1.36.4, regular release channel) |
|---|---|---|---|---|
| step-ca 0.30.2 (on Kubernetes, with step-issuer 0.11.0) | ✓ Supported | ✓ Supported | ✓ Supported | ✓ Supported |
| cert-manager 1.17.1, CA issuer | ○ Not applicable (1) | ○ Not applicable (1) | ✓ Supported | ✓ Supported |
| HashiCorp Vault 2.2.1, PKI secrets engine | ✓ Supported | ✓ Supported | ✓ Supported | ✓ Supported |
| Google Cloud Certificate Authority Service, DevOps tier (with google-cas-issuer 0.14.0) | ○ Not applicable (2) | ○ Not applicable (2) | ○ Not applicable (2) | ✓ Supported |
On Kubernetes, every issuer is reached through cert-manager 1.17.1.
(1) cert-manager runs only inside a Kubernetes cluster. On a single machine it runs in a local cluster, which the third column covers.
(2) The CA Service is reached from Kubernetes through google-cas-issuer, Google’s issuer for cert-manager, which acts as a Google service account through GKE Workload Identity. The DevOps tier is the CA Service’s tier for short-lived certificates.
How certificates reach the server#
- step-ca on Docker Compose. The server’s certificates are renewed on the server’s host by
step ca renew --daemon, and each client certificate is issued anew before it expires (step-ca recipes). - Vault on Docker Compose. Vault Agent keeps each certificate. It logs in with an AppRole, issues each certificate under its role in Vault, and issues it again when half of its lifetime has passed (HashiCorp Vault).
- Kubernetes. cert-manager issues every certificate: through its CA issuer, through step-issuer for step-ca, through its Vault issuer for Vault, or through google-cas-issuer for the CA Service. Each certificate is a Secret, which is mounted in the server’s pod as a directory. The kubelet replaces the files as cert-manager issues each next certificate, and the server reads them without a restart (cert-manager).
- Each issuer holds the contract’s names and key usages itself: a template for each role in step-ca, a role for each name in Vault, and a server template and a client template in the CA Service.
The intermediate under the offline root#
With every issuer, the deployment’s root is made offline, as in the step-ca recipe with an offline root, and the issuer issues through an intermediate that the offline root signs. The issuer makes the intermediate’s key and its certificate request; cert-manager’s CA issuer, which keeps no key of its own, is given both (cert-manager). The request’s key fingerprint is computed beside the issuer, read on that screen, and typed on the offline machine, where the root signs the request:
# Beside the issuer: the request's key fingerprint. step certificate key intermediate.csr > intermediate.pub step crypto key fingerprint intermediate.pub # On the offline machine: sh offline.sh sign root/ intermediate.csr intermediate.pem <key fingerprint>
intermediate.pem holds the intermediate, then the root. Each intermediate lives 3 years and has a path length of 0. It is replaced every year, as in the recipe: the issuer makes the next key and request, the offline root signs it, and the issuer issues under the new intermediate.
How each issuer is configured#
Each configuration below issues to the certificate contract: the server’s certificates, 1 pair for each listener, and the relying parties’, operators’ and metrics scrapers’ certificates, each with its SPIFFE ID as its only URI name, over a P-256 key. The lifetimes are those of the step-ca recipes: 24 hours for a server certificate (at most 30 days), 2 years for a relying party’s, 90 days for an operator’s or a scraper’s. <trust domain> is the server’s YDFI_SERVER_TRUST_DOMAIN.
HashiCorp Vault
Vault’s PKI secrets engine issues to the contract with 1 role for each name. The engine is mounted at pki/, and its longest lifetime is an intermediate’s, 3 years:
vault secrets enable pki vault secrets tune -max-lease-ttl=26280h pki
The intermediate’s key is made in Vault. Its request is signed by the offline root (above), and the signed intermediate, followed by the root, is imported:
vault write -field=csr pki/intermediate/generate/internal \
common_name="Example Vault Intermediate CA" key_type=ec key_bits=256 > intermediate.csr
# After the offline signature:
vault write -format=json pki/intermediate/set-signed certificate=@intermediate.pem
vault write pki/config/issuers default=<issuer ID>The import’s output maps each issuer it imported to its key; <issuer ID> is the one whose key is in Vault. Vault dates each certificate 30 seconds before it issues it, and refuses to date one before its issuer’s start. The new intermediate is therefore made the default issuer once it has been valid for 30 seconds.
The 4 roles of the contract. Each holds a P-256 key, the key usage digitalSignature, and a common name that names no host and is left out of the names a certificate carries:
# The server: the host names clients dial, its addresses, and its SPIFFE ID. vault write pki/roles/server \ allowed_domains=<host names, separated by commas> allow_bare_domains=true \ allow_localhost=true allow_ip_sans=true \ allowed_uri_sans=spiffe://<trust domain>/server/main \ server_flag=true client_flag=true max_ttl=720h \ cn_validations=disabled key_type=ec key_bits=256 key_usage=DigitalSignature ext_key_usage= \ allow_subdomains=false allow_glob_domains=false no_store=true # A relying party: 1 role for each, which issues its SPIFFE ID alone. vault write pki/roles/rp-<rp-id> \ allowed_domains= allow_localhost=false allow_ip_sans=false \ allowed_uri_sans=spiffe://<trust domain>/rp/<rp-id> \ server_flag=false client_flag=true max_ttl=17520h \ cn_validations=disabled key_type=ec key_bits=256 key_usage=DigitalSignature ext_key_usage= \ allow_subdomains=false allow_glob_domains=false no_store=true
The roles operator and monitoring are written as a relying party’s, with allowed_uri_sans=spiffe://<trust domain>/operator/<operator-id> and spiffe://<trust domain>/monitoring/<instance>, and max_ttl=2160h.
A certificate is issued under its role with its common name, its SPIFFE ID in uri_sans, exclude_cn_from_sans=true, and its lifetime in ttl. The server’s names its host names in alt_names, and its addresses, if any, in ip_sans. Whatever issues the deployment’s certificates holds this policy, written with vault policy write issuer issuer.hcl, which lets it issue, and sign requests, under the roles:
path "pki/issue/*" { capabilities = ["update"] }
path "pki/sign/*" { capabilities = ["update"] }A deployment’s Vault serves TLS.
Vault Agent, on Docker Compose. Vault Agent keeps each certificate. It logs in with an AppRole whose tokens hold the policy above alone:
vault auth enable approle vault write auth/approle/role/issuer token_policies=issuer token_ttl=1h token_max_ttl=24h vault read -field=role_id auth/approle/role/issuer/role-id > role-id vault write -f -field=secret_id auth/approle/role/issuer/secret-id > secret-id
Its configuration issues each certificate under its role, and issues it again when half of its lifetime has passed. For the relying-party listener’s certificate:
vault {
address = "https://vault.example.internal:8200"
}
auto_auth {
method "approle" {
config = {
role_id_file_path = "/agent/role-id"
secret_id_file_path = "/agent/secret-id"
remove_secret_id_file_after_reading = false
}
}
}
template_config {
exit_on_retry_failure = true
lease_renewal_threshold = 0.5
}
template {
destination = "/etc/ydentifi/server-rp.pem"
perms = "0600"
contents = <<EOT
{{ with pkiCert "pki/issue/server" "common_name=main" "alt_names=ydentifi.example.com" "uri_sans=spiffe://example.com/server/main" "exclude_cn_from_sans=true" "ttl=24h" }}{{ .Cert }}{{ .CA }}{{ .Key }}{{ end }}
EOT
}Each certificate has a template of its own: the phone listener’s and the admin listener’s under the role server, each with its own host name in alt_names; a relying party’s under rp-<rp-id>, with common_name=<rp-id>; an operator’s under operator; a scraper’s under monitoring. Vault Agent writes the certificate, the intermediate and the key into 1 file. The server reads such a file as its certificate file and its key file at once: YDFI_SERVER_TLS_CERT and YDFI_SERVER_TLS_KEY both name it, and so do the phone and admin listeners’ 2 settings for their files.
cert-manager’s Vault issuer, on Kubernetes. cert-manager’s Vault issuer signs each request under the role for its name, with a Vault token that holds the policy above alone. 1 Issuer is made for each role, with the role in path:
apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: vault-server
spec:
vault:
server: https://vault.example.internal:8200
path: pki/sign/server
auth:
tokenSecretRef:
name: vault-token
key: tokenThe token is made with vault token create -policy=issuer -orphan -field=token, and kept in the Secret vault-token under the key token. The Certificates that use the Issuers are in cert-manager.
cert-manager
On Kubernetes, each certificate is a cert-manager Certificate, whatever the issuer. The server’s listeners have 1 Certificate each. For the relying-party listener:
apiVersion: cert-manager.io/v1
kind: Certificate
metadata:
name: ydfi-server-rp
spec:
secretName: ydfi-server-rp
commonName: main
duration: 24h
renewBefore: 8h
privateKey:
algorithm: ECDSA
size: 256
rotationPolicy: Always
uris:
- spiffe://example.com/server/main
dnsNames:
- ydentifi.example.com
usages:
- digital signature
- server auth
- client auth
issuerRef:
name: <issuer>
kind: <issuer kind>
group: <issuer group>The phone listener’s and the admin listener’s Certificates are the same, each with its own host name in dnsNames; the phone listener’s names the host of YDFI_SERVER_DEPLOYMENT_URL. A client’s Certificate names no host and no address: commonName is its ID (<rp-id>, the operator’s ID, or the scraper’s instance name), uris holds its SPIFFE ID, usages are digital signature and client auth, and duration is 17520h for a relying party, 2160h for an operator or a scraper. rotationPolicy: Always gives each next certificate a new key. Who may create a Certificate that names a relying party is the cluster’s own control: a relying party’s certificate names the relying party the operator created (The certificate contract).
issuerRef names the issuer, by its kind and group:
- cert-manager’s CA issuer, and its Vault issuer: kind
Issuer, groupcert-manager.io; - step-issuer: kind
StepIssuer, groupcertmanager.step.sm; - google-cas-issuer: kind
GoogleCASIssuer, groupcas-issuer.jetstack.io.
Each Secret is mounted in the server’s pod as a directory, and each listener’s 2 settings name tls.crt and tls.key in it. The root’s certificate, and the backup root’s, are in a Secret of their own, mounted at /etc/ydentifi/ca: the root’s certificate is then where the server looks for it, ca/ca.crt in its folder, and the trust bundles default to it (Configuration, The server’s folder):
env:
- {name: YDFI_SERVER_TLS_CERT, value: /etc/ydentifi/servers/rp/tls.crt}
- {name: YDFI_SERVER_TLS_KEY, value: /etc/ydentifi/servers/rp/tls.key}
- {name: YDFI_SERVER_PHONE_TLS_CERT, value: /etc/ydentifi/servers/phone/tls.crt}
- {name: YDFI_SERVER_PHONE_TLS_KEY, value: /etc/ydentifi/servers/phone/tls.key}
- {name: YDFI_ADMIN_SERVER_TLS_CERT, value: /etc/ydentifi/servers/admin/tls.crt}
- {name: YDFI_ADMIN_SERVER_TLS_KEY, value: /etc/ydentifi/servers/admin/tls.key}
- {name: YDFI_SERVER_BACKUP_ROOT_CA_CERT_PATH, value: /etc/ydentifi/ca/backup.crt}
- {name: YDFI_SERVER_TRUST_DOMAIN, value: example.com}
volumeMounts:
- {name: rp-tls, mountPath: /etc/ydentifi/servers/rp, readOnly: true}
- {name: phone-tls, mountPath: /etc/ydentifi/servers/phone, readOnly: true}
- {name: admin-tls, mountPath: /etc/ydentifi/servers/admin, readOnly: true}
- {name: roots, mountPath: /etc/ydentifi/ca, readOnly: true}
volumes:
- {name: rp-tls, secret: {secretName: ydfi-server-rp}}
- {name: phone-tls, secret: {secretName: ydfi-server-phone}}
- {name: admin-tls, secret: {secretName: ydfi-server-admin}}
- {name: roots, secret: {secretName: ydfi-roots}}cert-manager’s CA issuer. The CA issuer signs with an intermediate whose key is in a Secret of the cluster. The key and its request are made outside the cluster; the request is signed by the offline root (above); the Secret holds the intermediate, its key and the root:
step certificate create "Example Kubernetes Intermediate CA" intermediate.csr intermediate.key \
--csr --kty EC --crv P-256 --no-password --insecure
# After the offline signature: intermediate.crt is the first certificate of intermediate.pem.
kubectl create secret generic ydfi-intermediate --type=kubernetes.io/tls \
--from-file=tls.crt=intermediate.crt --from-file=tls.key=intermediate.key \
--from-file=ca.crt=root_ca.crt --dry-run=client -o yaml | kubectl apply -f -apiVersion: cert-manager.io/v1
kind: Issuer
metadata:
name: ydfi-ca
spec:
ca:
secretName: ydfi-intermediateWhoever reads the Secret holds the intermediate’s key. The yearly replacement applies the Secret again, with the next intermediate and its key.
step-issuer, for step-ca. step-issuer reaches the CA of the step-ca recipes through the contract’s provisioners, 1 StepIssuer for each:
apiVersion: certmanager.step.sm/v1beta1
kind: StepIssuer
metadata:
name: ydfi-server
spec:
url: https://ca.example.internal:9000
caBundle: <the root's certificate, in base64>
provisioner:
name: ydfi-server
kid: <the provisioner's key ID>
passwordRef:
name: step-ca-password
key: passwordThe 4 StepIssuers name the provisioners ydfi-server, ydfi-rp, ydfi-operator and ydfi-monitoring. step ca provisioner list, run in the CA’s container, prints each provisioner’s key ID, in key.kid. The Secret step-ca-password holds the CA’s password, the first line of /home/step/secrets/password in the CA’s volume, under the key password. The CA’s intermediate is put under the offline root as in recipe 2.
Google Cloud Certificate Authority Service
A CA pool in the DevOps tier issues the deployment’s certificates, under 2 certificate templates: the server’s and the clients’.
gcloud privateca pools create <pool> --location <region> --tier devops \ --no-publish-ca-cert --no-publish-crl
Each template fixes the key usages, and limits the names a certificate carries. The server’s template, from server-values.yaml:
keyUsage:
baseKeyUsage:
digitalSignature: true
extendedKeyUsage:
serverAuth: true
clientAuth: true
caOptions:
isCa: falseThe clients’ template, from client-values.yaml, is the same with clientAuth: true alone under extendedKeyUsage. The 2 templates:
gcloud privateca templates create <pool>-server --location <region> \
--copy-subject --copy-sans --predefined-values-file server-values.yaml \
--identity-cel-expression "subject_alt_names.all(san, san.type == DNS || san.type == IP_ADDRESS || (san.type == URI && san.value == 'spiffe://<trust domain>/server/main'))"
gcloud privateca templates create <pool>-client --location <region> \
--copy-subject --copy-sans --predefined-values-file client-values.yaml \
--identity-cel-expression "subject_alt_names.all(san, san.type == URI && san.value.startsWith('spiffe://<trust domain>/'))"The clients’ template admits any SPIFFE ID of the trust domain. Who may request a client certificate is therefore set by who holds the role roles/privateca.templateUser on that template.
The pool’s CA is a subordinate CA. The CA Service makes its key, and the offline root signs its request. It is created with the type SUBORDINATE, a P-256 key (EC_P256_SHA256), a lifetime of 3 years (94608000s), the CA options isCa: true and maxIssuerPathLength: 0, and the key usages certSign and crlSign. It then waits for its certificate (AWAITING_USER_ACTIVATION). Its request is fetched and signed offline (above). The CA is activated with the intermediate as its certificate and the root as its issuer chain, and enabled. Once it is enabled, the CA it replaces is disabled, so that the pool issues under the new CA alone.
google-cas-issuer issues through 1 GoogleCASIssuer for each template:
apiVersion: cas-issuer.jetstack.io/v1beta1 kind: GoogleCASIssuer metadata: name: ydfi-cas-server spec: project: <project> location: <region> caPoolId: <pool> certificateTemplate: projects/<project>/locations/<region>/certificateTemplates/<pool>-server
The second, ydfi-cas-client, names the template <pool>-client, and issues the relying parties’, operators’ and scrapers’ certificates. google-cas-issuer acts, through GKE Workload Identity, as a Google service account that holds roles/privateca.certificateRequester on the pool and roles/privateca.templateUser on both templates. The Kubernetes service account cert-manager/cert-manager-google-cas-issuer holds roles/iam.workloadIdentityUser on that Google service account. The Certificates are those of cert-manager.
Other setups#
Other standard setups are expected to work, since the server depends only on certificate files that follow the certificate contract, and not on any particular CA or orchestrator. Such setups include other managed Kubernetes services, such as Amazon EKS and Azure AKS, other cert-manager issuers, and existing enterprise CAs, such as Microsoft Active Directory Certificate Services and EJBCA.
A CA is suitable when it can issue what the certificate contract requires: one SPIFFE ID per server and client certificate as its only URI name, client certificates that list client authentication and name no host, a phone listener’s certificate over an ECDSA key, and intermediates that outlive the certificates issued under them. These setups are not among the supported combinations.