type: required. one of awskms, cloudkms, pkcs11, or yubikey
uri: this field can be used to specify other fields in this section, and its value will take precedence over those values. See cryptographic protection for examples.
region: for awskms, the AWS region
profile: for awskms, the AWS profile
credentialsFile: for cloudkms, the path to a Google Cloud Platform credentials JSON file for a role that can access cloudkms
pin: for yubikey, the PIN of the YubiKey PIV application
password: optionally store the password for decrypting the intermediate private key (this should be the same password you chose during PKI initialization). If the value is not stored in configuration then you will be prompted for it when starting the CA.
address: ex. 127.0.0.1:8080 - address and port on which the CA will bind and respond to requests.
dnsNames: comma separated list of DNS name(s) for the CA.
logger: the default logging format for the CA is text. The other option is json.
ssh: enables the provisioning of SSH certificates by the CA. Add this section to an existing ca.json to enable SSH for an existing CA. SSH keys can be created by running
step crypto keypair host.pub host.key and step crypto keypair user.pub user.key.
userKey: the signing key for user SSH certificates.
hostKey: the signing key for host SSH certificates.
dataSource: string that can be interpreted differently depending on the type of the database. Usually a path to where the data is stored. See the database configuration docs for more info.
database: name of the database. Used for back-ends that may have multiple databases. ex. MySQL
valueDir: directory to store the value log in (Badger specific).
tls: settings for negotiating communication with the CA; includes acceptable ciphersuites, min/max TLS version, etc.
authority: controls the request authorization and signature processes.
type: the type of backing CA service that issues certificates for this step-ca instance. The default is an internal certificate authority service.
Other options can turn step-ca into a Registration Authority: stepcas uses a remote step-ca instance as the backend, and cloudcas uses a Google CloudCAS.
template: default ASN1DN values for new certificates.
claims: default validation for requested attributes in the certificate request. Can be overridden by similar claims objects defined by individual provisioners.
minTLSCertDuration: do not allow certificates with a duration less than this value.
maxTLSCertDuration: do not allow certificates with a duration greater than this value.
defaultTLSCertDuration: if no certificate validity period is specified, use this value.
minUserSSHCertDuration: do not allow certificates with a duration less than this value.
maxUserSSHCertDuration: do not allow certificates with a duration greater than this value.
defaultUserSSHCertDuration: if no certificate validity period is specified, use this value.
minHostSSHCertDuration: do not allow certificates with a duration less than this value.
maxHostSSHCertDuration: do not allow certificates with a duration greater than this value.
defaultHostSSHCertDuration: if no certificate validity period is specified, use this value.
enableSSHCA: enable this provisioner to generate SSH Certificates. The default value is false.
disableIssuedAtCheck: disable a check verifying that provisioning tokens must be issued after the CA has booted. This claim is one prevention
against token reuse. The default value is false. Do not change this unless you know what you are doing.
provisioners: list of provisioners. Each provisioner has a name, associated authentication attributes, and an optional claims attribute that will override any values set in the global claims directly underneath authority. See provisioner documentation for more info.
password: plain text password for starting the CA. Used to decrypt the intermediate private key.
We do not recommend storing the password plain text in your ca.json. The recommended option is to use the --password-file flag when running step-ca. This attribute is a convenience that should be avoided in production.
Provisioners are people or entities that are registered with the certificate authority and
authorized to issue certificates. Visit the step-ca provisioners page to learn about the
different provisioners, their target use cases, and how to add, remove, and configure them.
People use private CAs for all sorts of things, in many different contexts:
web apps, mobile apps, code signing, cloud VM instances, SSH, IoT devices, etc.
So step-ca must be flexible enough to handle a wide variety of flows.
X.509 and SSH certificate templates open up these possibilities.
With certificate templates, you can do things like:
Add custom SANs or extensions to X.509 certificates
Make longer certificate chains, with multiple intermediate CAs
Use SSH force-command or source-address extensions
Add conditionals around a certificate's parameters, and fail if they are not met
step-ca uses a simple key-value interface over popular database
implementations to store persistent certificate management meta-data. Our
recommended default database implementation is nosql-Badger, a NoSQL interface
over the popular Badger database. As a
first pass, the database layer will store every certificate (along with
metadata surrounding the provisioning of the certificate) and
revocation data that will be used to enforce passive revocation.
Configuring step-ca to use a database is as simple as adding a top-level db
stanza to your ca.json file. Below users can find documentation and examples
for supported databases:
badger: currently refers to Badger V1. However, as Badger V1 is deprecated, this will refer to Badger V2 starting with a the next major version release.
badgerV1: explicitly select Badger V1.
badgerV2: explicitly select Badger V2. Anyone looking to use Badger V2 will need to set it explicitly until it becomes the default.
dataSource: path, database directory.
valueDir [optional]: path, value directory, only if different from dataSource.
badgerFileLoadingMode [optional]: can be set to FileIO (instead of the default MemoryMap) to avoid memory-mapping log files. This can be useful in environments with low RAM. Make sure to use badgerV2 as the database type if using this option.
FileIO: This can be useful in environments with low RAM.
Extra parameters can be passed in the mysql dataSource name as follows: "dataSource": "user:password@tcp(127.0.0.1:3306)/myDBName?tls=true&". The & in the end is important.
As the interface is a key-value store, the schema is very simple. We support tables, keys, and values. An entry in the database is a byte value that is indexed by byte table and byte key.
At this time step-ca does not have any API or interface for easily exporting data. Because the data is stored in a noSQL like manner, it is difficult to explore the data even when using a SQL backend like MySQL. We do have a scripted example for accessing the DB to give users a jumping off point for writing their own reporting and logging tools.
Note that some DBs, like Badger and BoltDB, cannot have multiple processes accessing them simultaneously. You'll need to stop the step-ca process in order to run a export script against those DBs.
Cloud KMS is Google's cloud-hosted KMS that allows you to store the cryptographic keys and sign certificates using their infrastructure. Cloud KMS supports two different protection levels: SOFTWARE and HSM.
To configure Cloud KMS in your certificate authority, add the kms object to your ca.json file and replace the property key with the Cloud KMS key name of your intermediate key:
Currently, step does not provide an automatic way to initialize the public key infrastructure (PKI) using Cloud KMS. Still, an experimental tool named step-cloudkms-init addresses this use case. This tool generates the public certificates root_ca.crt and intermediate_ca.crt for inclusion in ca.json and prints the intermediate key name for use in the key property. In a future release, this tool will be integrated into step.
When using Azure Key Vault with step-ca, you will first need to authenticate to Azure.
Authentication to Azure is handled via environment variables;
we recommend using either file-based authentication via the AZURE_AUTH_LOCATION environment variable,
or creating a service principal
and setting the AZURE_TENANT_ID, AZURE_CLIENT_ID, and AZURE_CLIENT_SECRET variables when starting step-ca.
See Option 1 under Authentication Methods for Azure SDK for Go for examples of authentication methods and environment variables.
For local development and testing, Azure CLI credentials will be used if no authentication environment variables are set.
Initialize a PKI
To initialize a PKI backed by Azure Key Vault, start by authenticating to Azure using one of the above approaches.
Set the environment variables necessary for authentication to your tenant.
$ step ca init --kms azurekms
You will be walked through the process of creating root and intermediate CA signing keys in Key Vault, and configuring the CA to use them.
If you're creating an SSH CA, SSH host and user CA keys will be created in Key Vault as well.
To configure an existing CA for Azure Key Vault, or to import an existing Azure Key Vault signing key, add the kms object to your ca.json, and replace the key properties with the key name, vault name, and version of your intermediate (signing) key in Azure Key Vault:
In the key URI, the name and vault refer to the key name and vault name of your intermediate key in Azure Key Vault.
In the key URI, the version is the version of the Azure Key Vault key name. Though it is optional, we recommend setting this value explicitly. If omitted, the latest version will be used.
In the key URI, the optional hsm property can be set to true if HSM protection is desired. This is only used when the key is being created by step-ca. The default is to use software-protected (non-HSM-backed) keys. See Key Vault's About Keys page for more details.
In kms, an optional uri property can be added to provide client credentials (eg. azurekms:client-id=fooo;client-secret=bar;tenant-id=9de53416-4431-4181-7a8b-23af3EXAMPLE) instead of using the environment variables described above.
AWS KMS is Amazon's managed encryption and key management service. It creates and stores the cryptographic keys and uses AWS infrastructure for signing operations. Amazon KMS operations are always backed by HSMs.
To configure AWS KMS in your certificate authority, add the kms object to ca.json and replace the key property with the AWS KMS key name of your intermediate key:
By default, step-ca uses the credentials stored in ~/.aws/credentials. Use the credentials-file option to override. The region and profile options specify the AWS region and configuration profiles respectively. These options can also be configured using environment variables as described in the AWS SDK for Go session documentation.
In similar manner, to configure SSH certificate signing, replace the SSH keys with the keys from AWS KMS:
step-ca can also accept just the Amazon Key ID or the ARN as key options, but using the format based on the RFC7512 will allow more flexibility for future step releases.
Currently, step does not provide an automatic way to initialize the public key infrastructure (PKI) using AWS KMS, but an experimental tool named step-awskms-init addresses this use case. This tool generates the public certificates root_ca.crt and intermediate_ca.crt for inclusion in ca.json and prints the intermediate key name for use in the key property. In a future release, this tool will be integrated into step.
You can use the YubiKey for X.509 and SSH CAs; however, the step-yubikey-init utility only supports X.509 at this time. For SSH support, you must manually generate and configure SSH CA keys on the YubiKey.
The initialization of the public key infrastructure (PKI) for YubiKeys is not currently integrated into step, but an experimental tool named step-yubikey-init addresses this use case. In a future release, this tool will be integrated into step.
What is the YubiKey PIN?:
Creating PKI ...
✔ Root Key: yubikey:slot-id=9a
✔ Root Certificate: root_ca.crt
✔ Intermediate Key: yubikey:slot-id=9c
✔ Intermediate Certificate: intermediate_ca.crt
Run the step-yubikey-init --help command for more options.
Finally, to enable it in ca.json, point the root and crt options to the generated certificates, replace the key option with the YubiKey URI generated in the previous part, and configure the kms option with the appropriate type and pin.
This feature is not enabled by default. To enable support, you will need to build step-ca yourself, using CGO support. See Building From Source Using CGO.
A Hardware Security Module (HSM) is a specialized piece of hardware that is designed to generate and store private keys, and sign messages using those keys.
The private keys on an HSM cannot be exported from the device.
One can only run signing operations using the key.
This is an excellent way to protect private keys for a Certificate Authority,
which in normal operation simply needs to be able to sign Certificate Signing Requests.
1. Initialize your PKI using the step-pkcs11-init tool.
The step-pkcs11-init tool will create or import CA keys and/or certificates onto your HSM, for use with step-ca.
It is configured to work with the YubiHSM2 by default, but you can provide a different PKCS #11 URI by using the --kms flag.
Here are some examples of PKCS #11 URIs for various HSMs:
Sometimes you may wish to run a Registration Authority (RA).
An RA acts as a front-end to a CA, authenticating certificate requests from its clients
before passing them along to an upstream Certificate Authority that trusts the RA and will issue the certificates.
RAs are often used to distribute certificates across several cloud providers or on-prem environments.
The RA operational mode for step-ca centralizes and simplifies key management,
because a single backing CA can serve several RAs.
Certificate Authority Service (CAS) vs. Key Management Service (KMS) In an RA setup, the upstream CA is also known as a Certificate Authority Service (CAS). A CAS is a service that implements an API to sign certificate requests from a trusted source. If you've used a KMS before, you may wonder: How is a CAS different from a KMS? A KMS can sign any data, while a CAS is intended to sign only X.509 certificates.
In RA mode, step-ca currently supports two backing CA types:
Another step-ca instance ("StepCAS"),
or a Google Cloud CAS private CA.
StepCAS RA mode
StepCAS allows configuring a step-ca server as an RA, with a second, upstream step-ca server acting as the main CA.
StepCAS supports the JWK and X5C provisioners for requests between RAs and the CA.
The JWK provisioner balances security and simplicity, and it covers the most common use cases.
The X5C provisioner allows for more complex trust relationships and expiring certificates,
but it requires setting up ongoing certificate lifecycle management on the RAs.
Example: A Simple RA ↔ CA Configuration
Let's set up a simple RA ↔ CA pair, with one RA and one upstream CA.
The CA will be configured with a JWK provisioner,
and the RA will use that provisioner to make authenticated certificate requests to the CA.
The RA, in turn, can offer its clients certificates using any step-ca provisioners.
In this example, we'll configure an ACME provisioner in the RA.
Configure additional RA provisioners just as you would configure provisioners for a CA.
Setting up the CA
You can set up the CA using the Getting Started guide.
You will need the name and password of the first provisioner you created during the step ca init process.
Setting up the RA
Here's an example configuration file for an RA that uses the JWK provisioner to connect to the CA,
and that offers an ACME provisioner to its clients:
The crucial bit of configuration here is the "certificateIssuer" section.
This section connects this RA to the CA using the JWK provisioner named email@example.com on the CA.
When step-ca starts up with this RA configuration, it will download the encrypted JWK key from the CA automatically.
The RA will still need the JWK provisioner password, to decrypt the key.
The JWK password can be supplied in a "password" field in the "certificateIssuer" block,
or it can be passed in via a file when starting the RA:
Finally, use --issuer-password-file to provide a password file when starting up the CA.
Using the X5C provisioner
Instead of a JWK, the RA can alternatively use certificate authentication with the CA, via the X5C Provisioner.
While this approach is more complex,
it offers more security because it uses expiring certificates instead of non-expiring JWKs.
In this scenario, the RA "certificateIssuer" block will need to be configured with a certificate and key signed by a CA that the CA's X5C provisioner is configured to trust.
To configure an RA ↔ CA connection using an X5C provisioner,
first add an X5C provisioner to the CA.
(See the X5C Provisioner configuration section.)
Next, change the "certificateIssuer" object in the RA configuration as follows:
These files will are read by step-ca upon every certificate request made to the RA.
Finally, use --issuer-password-file to provide a private key password file when starting up the CA.
An RA can use any step-ca provisioners to authenticate requests, but there are some caveats:
step ca renew (mTLS renewals) and step ca rekey are not yet supported between step clients and a StepCAS RA. As an alternative, you can create a CSR using the same private key, and have the RA sign it. For example, if you have a JWK provisioner on the RA, you could run the following:
# 1. Create a CSR# (Add --insecure --no-password if you don't use a password on the private key.)
$ step certificate create --csr db.example.com db.csr db.key
# 2. Sign the CSR using the ACME provisioner
$ step ca sign db.csr db.crt
SSH is not supported.
ACME load balancing across StepCAS RAs is not officially supported, but it may work just fine if you use a shared mysql database for your RAs.
StepCAS RA keys cannot be stored in KMS or HSMs; only files are supported. This is because all the keys are kept in memory.
Google Cloud CAS RA mode
Google Cloud CAS is in a pre-release state As of March 30, 2021, Google Certificate Authority Service is still a Preview product. The setup and configuration of the RA will change when Google CAS v1 is released. Google doesn't plan to support any kind of migration.
Finally, download the service account credentials, which you will use to configure the RA:
$gcloud iam service-accounts keys create credentials.json \ --iam-account firstname.lastname@example.org
The RA will use the service account you just created, via the keys you exported into credentials.json.
Initialize your PKI.
Run step ca init --ra cloudcas to create a new PKI in CAS.
This will generate a root and intermediate certificate in Google CAS.
You will be prompted for your GCP project id, a resource id, region, and other information.
Here's an example of what a ca.json for a CloudCAS RA might look like:
The "credentialsFile" field isn't the only option for providing Google Cloud credentials.json filename to the RA.
You can alternatively set the GOOGLE_APPLICATION_CREDENTIALS environment variable.
step-ca will automatically download the root certificate from Google CAS.
In ca.json, you don't need to configure "root",
and because the intermediate is in Google Cloud, "crt" and "key" are also not needed.
The RA will print your CA's root fingerprint upon startup:
$step-ca /home/jane/.step/config/ca.json2020/09/22 13:17:15 Using root fingerprint '3ef16343cf0952eedbe2b843066bb798fa7a7bceb16aa285e8b0399f661b28b7'
2020/09/22 13:17:15 Serving HTTPS on :9000 ...
Save the fingerprint! You will need it to bootstrap new clients into your PKI:
$step ca bootstrap --ca-url https://ra.example.com --fingerprint 3ef16343cf0952eedbe2b843066bb798fa7a7bceb16aa285e8b0399f661b28b7
Finally, we can sign sign a certificate as always:
$step ca certificate test.example.com test.crt test.key