Install and initialize a Smallstep certificates server (step-ca
).
This role performs the following actions:
- Install
step-cli
if required - Install
step-ca
- Create a user to run the step-ca server, if it doesn't already exist
- Initialize a fresh ca server with no provisioners using
step ca init
- Daemonize step-ca using a systemd service
NOTE
Please make sure that you have read the considerations for running a step-ca server in production.
step_ca
follows these considerations where possible, but you should still be familiar with the basic operation of the step-ca
server.
ABOUT PRIVATE KEYS
By default step-ca
generates two keys when initialized - a root CA key and an intermediate key used to sign certificates. Both are present and encrypted on the ca host after this role exits,
with the step-ca
server configured to read the intermediate key password from a protected file in step_ca_path
. The root key can thus only be decrypted with the password set in step_ca_root_password
.
It is thus very important that you back up your root key and password in a safe and secure location. The details of your backup scheme will depend on your environment and threat model.
- The following distributions are currently supported:
- Ubuntu 18.04 LTS or newer
- Debian 10 or newer
- A CentOS 8-compatible distribution like RockyLinux or AlmaLinux. RockyLinux is used for testing
- Supported architectures: amd64, arm64
- This role requires root access. Make sure to run this role with
become: yes
or equivalent - This role requires
expect
to answer some interactive prompts. It will automatically installexpect
if it is not present
- Set the version of step-ca to install
- Can be a version tag (e.g.
0.15.3
), orlatest
to always install the most recent version - It is highly recommended that your ca version matches the collection version (e.g. if you are using the collection version 0.20.x you should be installing step-ca version 0.20.x as well)
- Note that the role will query the GitHub API if this value is set to
latest
. Try setting a specific version if you are running into rate limiting issues - Default:
latest
- Set the version of step to install
- Can be a version tag (e.g.
0.15.3
), orlatest
to always install the most recent version - It is highly recommended that your cli version matches the collection version (e.g. if you are using the collection version 0.20.x you should be installing step-cli version 0.20.x as well)
- Note that the role will query the GitHub API if this value is set to
latest
. Try setting a specific version if you are running into rate limiting issues - Default:
latest
- User under which the step-ca server will run
- Default:
step-ca
- Directory under which to place step-ca configuration files
- Default:
/etc/step-ca
These variables correspond to the arguments passed to step ca init
.
See the step docs for more information.
- The name of the new PKI
- Required
- Default: Not set
- Password used to encrypt the root key
- Required
- Default: Not set
- Password used to encrypt the intermediate key
- If unset, uses the root password for both
- Default: Not set
- The comma separated DNS names or IP addresses of the new CA
- Default:
{{ ansible_fqdn}},{{ ansible_default_ipv4.address }}
- The address that the new CA will listen at
- Default:
:443
- URI of the Step Certificate Authority to write in defaults.json
- Default: Not set
- Create keys to sign SSH certificates
- Default:
false
Set these values if you want to use an existing cert/key. These variables need to be set as a group.
- The path of an existing PEM file to be used as the root certificate authority
- The file must already exist on the remote host
- Default: Not set
- The path of an existing key file of the root certificate authority
- The key file must not be password-protected
- The file must already exist on the remote host
- Default: Not set
Set these values if you are using a registration authority such as CloudCAS. These variables need to be set as a group
- The registration authority name to use. Currently only "CloudCAS" is supported
- Default: Not set
- The registration authority issuer name to use
- Default: Not set
- The registration authority credentials file to use
- Default: Not set
- Path or name of the step-cli executable to use for executing commands in this role
- Can be an absolute path or a command (make sure the executable is in $PATH) for all users
- Default:
step-cli
# Performs a basic step-ca installation with all default values.
# Please make sure that your passwords are provided by a secure mechanism,
# such as ansible-vault or via vars-prompt
- hosts: all
roles:
- role: maxhoesel.smallstep.step_ca
become: yes
vars:
step_ca_name: Foo Bar Private CA
step_ca_root_password: "very secret password"
step_ca_intermediate_password: "also very secret password"