step-certificates

by Smallstep Labs, Inc

Helm chartv1.30.1App 0.30.2

An online certificate authority and related tools for secure automated certificate management, so you can use TLS everywhere.

About this chart

Step Certificates

An online certificate authority and related tools for secure automated certificate management, so you can use TLS everywhere.

To learn more, visit https://github.com/smallstep/certificates.

TL;DR

helm repo add smallstep https://smallstep.github.io/helm-charts/
step ca init --helm > values.yaml
echo "password" | base64 > password.txt
helm install -f values.yaml \
     --set inject.secrets.ca_password=$(cat password.txt) \
     --set inject.secrets.provisioner_password=$(cat password.txt) \
     --set service.targetPort=9000 \
     step-certificates smallstep/step-certificates

Prerequisites

  • Kubernetes 1.10+

Installing the Chart

Before installing the chart, we need to generate the configuration that we will use. To do this, we will use step:

step ca init --helm > values.yaml
echo "password" | base64 > password.txt

Now we can install the chart with release name step-certificates using the generated configuration and password:

helm install -f values.yaml \
     --set inject.secrets.ca_password=$(cat password.txt) \
     --set inject.secrets.provisioner_password=$(cat password.txt) \
     step-certificates smallstep/step-certificates

The command deploys Step certificates on the Kubernetes cluster in the default configuration. The configuration section lists the parameters that can be configured during installation.

The chart also has an option to generate the configuration automatically. This option is deprecated, and it will be removed in a future release. To install the chart using this option, we can run:

helm install my-release smallstep/step-certificates

Tip: List all releases using helm list

Uninstalling the Chart

To uninstall the step-certificates release:

helm uninstall step-certificates

The command removes all the Kubernetes components associated with the chart and deletes the release.

Linked CA

Linked CA is an instance of step-ca that you run that connects to your Certificate Manager) account for reporting, alerting, revocation, and other managed services.

When you create a Linked CA authority, you will get a token that you will use to connect your instance to it.

There're two ways to configure the token. You can define the value for linkedca.token:

helm install --set linkedca.token=xxx \
  step-certificates smallstep/step-certificates

Or set the reference to another secret managed with your preferred infrastructure automation tool.

helm install \
  --set linkedca.secretKeyRef.name=my-secret-name \
  --set linkedca.secretKeyRef.key=my-key-name \
  step-certificates smallstep/step-certificates

Configuration

The easiest way to configure step-certificates is to use step.

Starting with step v0.17+ and step-certificates Chart v1.17+, you can use step ca init to create a values.yaml that you can use to configure your CA:

$ step ca init --helm > values.yaml
✔ Deployment Type: Standalone
What would you like to name your new PKI?
✔ (e.g. Smallstep): Smallstep
What DNS names or IP addresses would you like to add to your new CA?
✔ (e.g. ca.smallstep.com[,1.1.1.1,etc.]): step-certificates.default.svc.cluster.local
What IP and port will your new CA bind to (it should match service.targetPort)?
✔ (e.g. :443 or 127.0.0.1:443): :9000
What would you like to name the CA's first provisioner?
✔ (e.g. [email protected]): [email protected]
Choose a password for your CA keys and first provisioner.
✔ [leave empty and we'll generate one]:

Generating root certificate... done!
Generating intermediate certificate... done!

By default, the values.yaml won't contain the password used to encrypt the keys, nor the password of the default provisioner, so we have to pass it as values using the base64 encoding. And the port where the CA binds to, in the example, :9000 must be set as service.targetPort=9000.

echo "password" | base64 > password.txt
helm install -f values.yaml \
     --set inject.secrets.ca_password=$(cat password.txt) \
     --set inject.secrets.provisioner_password=$(cat password.txt) \
     --set service.targetPort=9000 \
     step-certificates smallstep/step-certificates

With this method, the automatic bootstrap of the PKI is deprecated and it will be removed in future releases.

Advanced configuration

In some circumstainces it is not an option to use Helm install or to inject secrets at the command line. For example when using GitOps / ArgoCD. Secrets and configurations can be provided before the helm chart is deployed by defining existingSecrets in the values file:

existingSecrets:
  enabled: true
  ca: true
  issuer: true
  certsAsSecret: true
  configAsSecret: true
  sshHostCa: true
  sshUserCa: true

bootstrap:
  secrets: false
  enabled: false
  configmaps: false

inject:
  enabled: false

Enabling existingSecrets can't be combined with enabling bootstrap nor inject elements from helm chart. Therefore the bootstrap and inject are disabled in the example above.

Note, the MutatingWebhookConfiguration created by autocert is not patched with CA bundle as the bootstrap init-container is not started when existingSecrets are enabled.

The following naming conventions are used for secret names:

secret name: {{ include "step-certificates.fullname" . }}-secrets which contains the following data:

  • intermediate_ca_key
    • The encrypted X.509 intermediate certificate private key.
  • root_ca_key (optional)
    • The encrypted X.509 root certificate private key.
  • ssh_host_ca_key (optional)
    • The encrypted private key used to sign SSH host certificates.
  • ssh_user_ca_key (optional)
    • The encrypted private key used to sign SSH user certificates.
  • certificate_issuer_key (optional)
    • The encrypted private key used to sign tokens used on RA mode. This is required if an X5C provisioner is used to talk with the CA, but it can also be used with JWK if the encrypted key is not distributed by the CA.

When existingSecrets.certsAsSecret is true secret name: {{ include "step-certificates.fullname" . }}-certs which contains the following data:

  • root_ca.crt
    • The root CA certificate.
  • intermediate_ca.crt
    • The intermediate CA certificate (optional).
  • ssh_host_ca_key.pub:
    • The SSH host CA public key (optional).
  • ssh_user_ca_key.pub:
    • The SSH user CA public key (optional).

When existingSecrets.configAsSecret is true secret name: {{ include "step-certificates.fullname" . }}-config which contains the following data:

  • ca.json
    • The configuration file used by step-ca.
  • default.json
    • The configuration file used by step with the default flags.

When existingSecrets.ca is true secret name: {{ include "step-certificates.fullname" . }}-ca-password secret type: smallstep.com/ca-password which contains the following data:

  • password
    • The password used to decrypt the X.509 intermediate certificate private key.

When existingSecrets.sshHostCa is true secret name: {{ include "step-certificates.fullname" . }}-ssh-host-ca-password secret type: smallstep.com/ssh-host-ca-password which contains the following data:

  • password
    • The password used to decrypt the private key used to sign SSH host certificates.

When existingSecrets.sshUserCa is true secret name: {{ include "step-certificates.fullname" . }}-ssh-user-ca-password secret type: smallstep.com/ssh-user-ca-password which contains the following data:

  • password
    • The password used to decrypt the private key used to sign SSH user certificates.

When existingSecrets.issuer is true secret name: {{ include "step-certificates.fullname" . }}-certificate-issuer-password secret type: smallstep.com/certificate-issuer-password which contains the following data:

  • password
    • The password used to decrypt the private key used to sign RA tokens.

Further more the secret name {{ include "step-certificates.fullname" . }}-provisioner-password is used for the password used to encrypt JWK provisioner.

Configuration parameters

The following table lists the configurable parameters of the Step certificates chart and their default values.

ParameterDescriptionDefault
commandThe command entrypoint array[]
argsArguments to the entrypoint[]
workingDirThe container working directory"/home/step"
ca.nameName for you CAStep Certificates
ca.addressTCP address where Step CA runs:9000
ca.dnsDNS of Step CA, if empty it will be inferred""
ca.urlURL of Step CA, if empty it will be inferred""
ca.passwordPassword for the CA keys, if empty it will be automatically generated""
ca.provisioner.nameName for the default provisioneradmin
ca.provisioner.passwordPassword for the default provisioner, if empty it will be automatically generated""
ca.db.enabledIf true, step certificates will be configured with a databasetrue
ca.db.persistentIf true a persistent volume will be used to store the dbtrue
ca.db.accessModesPersistent volume access mode["ReadWriteOnce"]
ca.db.sizePersistent volume size10Gi
ca.db.existingClaimPersistent volume existing claim name. If defined, PVC must be created manually before volume will be bound""
ca.kms.typeKey management system to use.""
ca.envEnvironment variables to set in step-certificates container.[]
ca.bootstrap.postInitHookExtra script snippet to run after step ca init has completed.""
ca.init.containerSecurityContextSet SecurityContext for the STEP CA init containerSee values.yaml
ca.containerSecurityContextSet SecurityContext for the STEP CA containerSee values.yaml
ca.ssh.enabledIf true, step certificates will be configured with ssh support enabledfalse
linkedca.tokenThe token used to configure step-ca using the linkedca mode.""
linkedca.secretKeyRef.nameThe secret name where the linkedca token can be found.""
linkedca.secretKeyRef.keyThe secret key where the linkedca token can be found.""
service.typeService typeClusterIP
service.portIncoming port to access Step CA443
service.nodePortIncoming port to access Step CA""
service.targetPortInternal port where Step CA runs9000

Deploy step-certificates with OpenTenant

Each tenant gets its own release of this chart, with its own namespace, secrets and domain. The builder below already has step-certificates on a Hetzner server. Change the host, add apps from the marketplace, then copy the generated files. Providers and prices are samples, and nothing here is sent anywhere.

  1. Pick a serverConnect Hetzner, OVHcloud or AWS. The builder starts on Hetzner, the cheapest sample rate.
  2. Place the chartstep-certificates is pinned at v1.30.1 in opentenant.yaml. Drag more apps from the marketplace onto a rack.
  3. ApplySave opentenant.yaml and main.tf from the console, then run the commands below.
# opentenant.yaml, main.tf and dns.tf come from the builder below
opentenant validate opentenant.yaml
terraform init && terraform apply