maxhoesel.smallstep.step_ca_provisioner module – Manage provisioners on a step-ca server

Note

This module is part of the maxhoesel.smallstep collection (version 0.24.5).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install maxhoesel.smallstep. You need further requirements to be able to use this module, see Requirements for details.

To use it in a playbook, specify: maxhoesel.smallstep.step_ca_provisioner.

New in maxhoesel.smallstep 0.3.0

Synopsis

  • Use this module to create and remove provisioners from a Smallstep CA server.

Requirements

The below requirements are needed on the host that executes this module.

  • step-cli must be installed on the remote host. You can set the executable name/path with step_cli_executable.

Parameters

Parameter

Comments

admin_cert

path

Admin certificate (chain) in PEM format to store in the ‘x5c’ header of a JWT.

admin_key

path

Private key file, used to sign a JWT,corresponding to the admin certificate that will be stored in the ‘x5c’ header.

admin_password

string

The password to encrypt or decrypt the private key. Will be passed to step-cli through a temporary file. Mutually exclusive with admin_password_file

admin_password_file

path

The path to the file containing the password to encrypt or decrypt the private key. Must already be present on the remote host. Mutually exclusive with admin_password

admin_provisioner

aliases: admin_issuer

string

The provisioner name to use for generating admin credentials.

admin_subject

aliases: admin_name

string

The admin subject to use for generating admin credentials.

allow_renewal_after_expiry

boolean

added in maxhoesel.smallstep 0.20.0

Allow renewals for expired certificates generated by this provisioner.

Choices:

  • false

  • true

aws_accounts

aliases: aws_account

list / elements=string

The AWS account ids used to validate the identity documents. Must be a list

azure_audience

string

added in maxhoesel.smallstep 0.20.0

The Microsoft Azure audience name used to validate the identity tokens.

azure_object_ids

aliases: azure_object_id

list / elements=string

added in maxhoesel.smallstep 0.20.0

The Microsoft Azure AD object ids used to validate the identity tokens. Must be a list

azure_resource_groups

aliases: azure_resource_group

list / elements=string

The Microsoft Azure resource group names used to validate the identity tokens. Must be a list

azure_subscription_ids

aliases: azure_subscription_id

list / elements=string

added in maxhoesel.smallstep 0.20.0

The Microsoft Azure subscription ids used to validate the identity tokens. Must be a list

azure_tenant

string

The Microsoft Azure tenant id used to validate the identity tokens.

ca_config

path

The path to the certificate authority configuration file on the host if managing provisioners locally.

Default: "CI($STEPPATH)/config/ca.json"

ca_url

string

added in maxhoesel.smallstep 0.20.0

URI of the targeted Step Certificate Authority

disable_custom_sans

boolean

On cloud provisioners, if enabled only the internal DNS and IP will be added as a SAN. By default it will accept any SAN in the CSR.

Choices:

  • false

  • true

disable_renewal

boolean

added in maxhoesel.smallstep 0.20.0

Disable renewal for all certificates generated by this provisioner.

Choices:

  • false

  • true

disable_trust_on_first_use

boolean

On cloud provisioners, if enabled multiple sign request for this provisioner with the same instance will be accepted. By default only the first request will be accepted.

Choices:

  • false

  • true

force_cn

boolean

added in maxhoesel.smallstep 0.20.0

Always set the common name in provisioned certificates.

Choices:

  • false

  • true

gcp_projects

aliases: gcp_project

list / elements=string

The Google project ids used to validate the identity tokens. Must be a list

gcp_service_accounts

aliases: gcp_service_account

list / elements=string

The Google service account emails or ids used to validate the identity tokens. Must be a list

instance_age

string

The maximum duration to grant a certificate in AWS and GCP provisioners. A duration is sequence of decimal numbers, each with optional fraction and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.

jwk_create

aliases: create

boolean

added in maxhoesel.smallstep 0.20.0

Create the JWK key pair for the provisioner.

Choices:

  • false

  • true

jwk_private_key

aliases: private_key

path

added in maxhoesel.smallstep 0.20.0

The file containing the JWK private key.

name

string / required

The name of the provisioner to add/remove.

nebula_root

path

added in maxhoesel.smallstep 0.20.0

Root certificate (chain) file used to validate the signature on Nebula provisioning tokens.

oidc_admins

aliases: admin, oidc_admin, oidc_admin_email

list / elements=string

The emails of admin users in an OpenID Connect provisioner, these users will not have restrictions in the certificates to sign. Must be a list

oidc_client_id

aliases: client_id

string

The id used to validate the audience in an OpenID Connect token.

oidc_client_secret

aliases: client_secret

string

The secret used to obtain the OpenID Connect tokens.

oidc_configuration_endpoint

aliases: configuration_endpoint

string

OpenID Connect configuration url.

oidc_groups

aliases: oidc_group, group

list / elements=string

The group list used to validate the groups extenstion in an OpenID Connect token. Must be a list

oidc_listen_address

aliases: listen_address, oidc_client_address

string

The callback address used in the OpenID Connect flow (e.g. “:10000”).

oidc_tenant_id

aliases: tenant_id

string

added in maxhoesel.smallstep 0.20.0

The tenant-id used to replace the templatized {tenantid} in the OpenID Configuration.

password

string

The password to encrypt or decrypt the private key. Will be passed to step-cli through a temporary file. Mutually exclusive with password_file

password_file

path

The path to the file containing the password to encrypt or decrypt the private key. Mutually exclusive with password

public_key

aliases: jwk_public_key, k8ssa_public_key, k8s_pem_keys_file

path

The file containing the JWK public key. Or, a file containing one or more PEM formatted keys, if used with the K8SSA provisioner.

require_eab

boolean

added in maxhoesel.smallstep 0.20.0

Require (and enable) External Account Binding (EAB) for Account creation. If this flag is set to false, then disable EAB.

Choices:

  • false

  • true

root

path

added in maxhoesel.smallstep 0.20.0

The path to the PEM file used as the root certificate authority.

scep_capabilities

aliases: capabilities

string

added in maxhoesel.smallstep 0.20.0

The SCEP capabilities to advertise

scep_challenge

aliases: challenge

string

added in maxhoesel.smallstep 0.20.0

The SCEP challenge to use as a shared secret between a client and the CA

scep_encryption_algorithm_identifier

aliases: encryption_algorithm_identifier

integer

added in maxhoesel.smallstep 0.20.0

The id for the SCEP encryption algorithm to use. Valid values are 0 - 4, inclusive. The values correspond to: 0: DES-CBC, 1: AES-128-CBC, 2: AES-256-CBC, 3: AES-128-GCM, 4: AES-256-GCM. Defaults to DES-CBC (0) for legacy clients.

scep_include_root

aliases: include_root

boolean

added in maxhoesel.smallstep 0.20.0

Include the CA root certificate in the SCEP CA certificate chain.

Choices:

  • false

  • true

scep_min_public_key_length

aliases: min_public_key_length

string

added in maxhoesel.smallstep 0.20.0

The minimum public key length of the SCEP RSA encryption key

ssh

boolean

Enable provisioning of ssh certificates. The default value is true. To disable ssh use ‘–ssh=false’.

Choices:

  • false

  • true ← (default)

ssh_host_default_dur

string

added in maxhoesel.smallstep 0.20.0

The default duration for an ssh host certificate generated by this provisioner. Value must be a sequence of decimal numbers, each with optional fraction, and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.

ssh_host_max_dur

string

added in maxhoesel.smallstep 0.20.0

The maximum duration for an ssh host certificate generated by this provisioner. Value must be a sequence of decimal numbers, each with optional fraction, and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.

ssh_host_min_dur

string

added in maxhoesel.smallstep 0.20.0

The minimum duration for an ssh host certificate generated by this provisioner. Value must be a sequence of decimal numbers, each with optional fraction, and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.

ssh_template

path

added in maxhoesel.smallstep 0.20.0

The ssh certificate template file, a JSON representation of the certificate to create.

ssh_template_data

path

added in maxhoesel.smallstep 0.20.0

The ssh certificate template data file, a JSON map of data that can be used by the certificate template.

ssh_user_default_dur

string

added in maxhoesel.smallstep 0.20.0

The default duration for an ssh user certificate generated by this provisioner. Value must be a sequence of decimal numbers, each with optional fraction, and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.

ssh_user_max_dur

string

added in maxhoesel.smallstep 0.20.0

The maximum duration for an ssh user certificate generated by this provisioner. Value must be a sequence of decimal numbers, each with optional fraction, and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.

ssh_user_min_dur

string

added in maxhoesel.smallstep 0.20.0

The minimum duration for an ssh user certificate generated by this provisioner. Value must be a sequence of decimal numbers, each with optional fraction, and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.

state

string

Whether the provisioner should be present or absent. Note that present does not update existing provisioners. updated will attempt to update the provisioner regardless of whether it has changed or not. Note that this will always report the task as changed.

Choices:

  • "present" ← (default)

  • "updated"

  • "absent"

step_cli_executable

path

Name (or absolute path) of the step-cli executable to use

Default: "step-cli"

type

string

The type of provisioner to create (case-sensitive). Ignored when state == absent or updated. Required if state == present

Choices:

  • "JWK"

  • "OIDC"

  • "AWS"

  • "GCP"

  • "Azure"

  • "ACME"

  • "X5C"

  • "K8SSA"

  • "SSHPOP"

  • "SCEP"

  • "Nebula"

x509_default_dur

string

added in maxhoesel.smallstep 0.20.0

The default duration for an x509 certificate generated by this provisioner. Value must be a sequence of decimal numbers, each with optional fraction, and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.

x509_max_dur

string

added in maxhoesel.smallstep 0.20.0

The maximum duration for an x509 certificate generated by this provisioner. Value must be a sequence of decimal numbers, each with optional fraction, and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.

x509_min_dur

string

added in maxhoesel.smallstep 0.20.0

The minimum duration for an x509 certificate generated by this provisioner. Value must be a sequence of decimal numbers, each with optional fraction, and a unit suffix, such as “300ms”, “-1.5h” or “2h45m”. Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h”.

x509_template

path

added in maxhoesel.smallstep 0.20.0

The x509 certificate template file, a JSON representation of the certificate to create.

x509_template_data

path

added in maxhoesel.smallstep 0.20.0

The x509 certificate template data file, a JSON map of data that can be used by the certificate template.

x5c_root

aliases: x5c_root_file

path

Root certificate (chain) file used to validate the signature on X5C provisioning tokens.

Notes

Note

  • Existing provisioners will not be modified by default, use the update flag to force provisioner updates

  • Most of the options correspond to the command-line parameters for the step ca provisioner command. See the documentation for more information.

  • Any files used to create the provisioner (e.g. root certificate chains) must already be present on the remote host.

  • Check mode is supported.

Examples

# NOTE: All examples assume that the module is executed as a user with STEPPATH set to
# the step-ca config directory. If this is not the case, you can always specify the required
# parameters with ca_config

- name: Create a JWK provisioner with newly generated keys and a template for x509 certificates
  maxhoesel.smallstep.step_ca_provisioner:
    name: cicd
    type: JWK
    jwk_create: yes
    x509_template: ./templates/example.tpl

- name: Create a JWK provisioner with duration claims
  maxhoesel.smallstep.step_ca_provisioner:
    name: cicd
    type: JWK, cli
    create: yes
    x509_min_dur: 20m
    x509_default_dur: 20m
    x509_max_dur: 24h

- name: Create a JWK provisioner with existing keys
  maxhoesel.smallstep.step_ca_provisioner:
    name: jane@doe.com
    type: JWK
    public_key: jwk.pub
    private_key: jwk.priv

- name: Create an OIDC provisioner
  maxhoesel.smallstep.step_ca_provisioner:
    name: Google
    type: OIDC
    client_id: 1087160488420-8qt7bavg3qesdhs6it824mhnfgcfe8il.apps.googleusercontent.com
    client_secret: udTrOT3gzrO7W9fDPgZQLfYJ
    configuration_endpoint: https://accounts.google.com/.well-known/openid-configuration

- name: Create an X5C provisioner
  maxhoesel.smallstep.step_ca_provisioner:
    name: x5c
    type: X5C
    x5c_root: x5c_ca.crt

- name: Create an ACME provisioner, forcing a CN and requiring EAB
  maxhoesel.smallstep.step_ca_provisioner:
    name: acme
    type: ACME
    force_cn: yes
    require_eab: yes

- name: Crate an K8SSA provisioner
  maxhoesel.smallstep.step_ca_provisioner:
    name: kube
    type: K8SSA
    ssh: true
    public_key: key.pub

- name: Create an SSHPOP provisioner
  maxhoesel.smallstep.step_ca_provisioner:
    name: sshpop
    type: SSHPOP

- name: Create a SCEP provisioner
  maxhoesel.smallstep.step_ca_provisioner:
    name: scep_provisioner
    type: SCEP
    scep_challenge: secret
    scep_encryption_algorithm_identifier: 2

- name: Create a complexAzure provisioner
  maxhoesel.smallstep.step_ca_provisioner:
    name: Azure
    type: Azure
    azure_tenant: bc9043e2-b645-4c1c-a87a-78f8644bfe57
    azure_resource_groups:
      - identity
      - accounting
    azure_subscription_ids:
      - dc760a01-2886-4a84-9abc-f3508e0f87d9
    azure_object_ids:
      - f50926c7-abbf-4c28-87dc-9adc7eaf3ba7

Authors

  • Max Hösel (@maxhoesel)