tls_csr
A certificate signing request for a key already on the host, such as one from tls_private_key, for your own CA to sign. Made with the host’s openssl.
Use tls_csr when your own CA signs the host’s certificate. Conn3x writes the certificate signing request on the host with its openssl, from a key that’s already there, so only the request travels to the CA, never the key.
Example usage
Section titled “Example usage”A key and a request for the CA, which then reads csr_pem:
step "web_key" { tls_private_key { path = "/etc/pki/tls/private/web.key" }}
step "web_csr" { tls_csr { path = "/etc/pki/tls/web.csr" key_path = "/etc/pki/tls/private/web.key" common_name = "web1.internal.example" dns_names = ["web1.internal.example"] }}Arguments
Section titled “Arguments”| Name | Type | Required | Description |
|---|---|---|---|
common_name |
string | Yes | Subject common name, such as the host’s name. |
dns_names |
list of string | No | Host names to ask for as subject alternative names. |
group |
string | No | Group. Unset keeps the file’s. |
ip_addresses |
list of string | No | IP addresses to ask for as subject alternative names. |
key_path |
string | Yes | Absolute path of the private key it’s for. |
mode |
string | No | Octal permissions. Defaults to “0644”. |
on_remove |
string | No | “forget” (default) leaves the file, “delete” removes it. |
owner |
string | No | Owner. Unset keeps the file’s. |
path |
string | Yes | Absolute path of the request file. |
Read-only attributes
Section titled “Read-only attributes”Conn3x sets these; reference them as conn3x_tls_csr.<circuit>__<step>["<host>"].<name>.
| Name | Type | Description |
|---|---|---|
csr_pem |
string | The request, PEM-encoded, for your CA. |
in_sync |
bool | Whether the file holds a request for the key with these names. |
revision |
string | Changes each time Conn3x changes this on the host. Handlers watch it. |
A step lowers to the conn3x_tls_csr resource, one instance per host, and connects with its circuit’s ssh block.
How it works
Section titled “How it works”Reading. On every plan, Conn3x reads the request and the public half of the key at key_path. in_sync is true when the request is signed by that key, for that key, with the common_name, dns_names and ip_addresses asked for, and the file has the mode, owner and group asked for.
Applying. The request asks for the same extensions as tls_self_signed_cert’s certificate: CA:FALSE, server and client use, and your names as subject alternative names. Your CA decides what it actually signs. When the key changes, the next plan makes a new request for it.
The host needs openssl 1.1.1 or newer.
Removal
Section titled “Removal”When you delete a tls_csr step, on_remove decides what happens on the host. The default, "forget", leaves the request. "delete" removes the file.
From Ansible
Section titled “From Ansible”conn3x convert ansible turns community.crypto.openssl_csr tasks with a common name and DNS: or IP: alternative names into tls_csr steps. With no alternative names, the common name becomes the one DNS name, as Ansible’s use_common_name_for_san does. Other subject fields, key usages, other extensions and a key passphrase stay a TODO.