|
2 | 2 | title: Configuring `step-ca` Templates |
3 | 3 | html_title: Configuring open source step-ca Templates |
4 | 4 | description: Learn how to configure step-ca Templates |
5 | | -updated_at: March 25, 2025 |
| 5 | +updated_at: March 26, 2025 |
6 | 6 | --- |
7 | 7 |
|
8 | 8 | People use private CAs for all sorts of things, in many different contexts: |
@@ -42,9 +42,9 @@ A few custom [functions for ASN.1 encoding](#asn1-values) and [time formatting]( |
42 | 42 | <Alert severity="warning"> |
43 | 43 | <div> |
44 | 44 | <strong>Warning: Always wrap values in <code>toJson</code></strong><br /> |
45 | | - In the templates on this page, constants are pulled into templates using <code>{`{{`} toJson .constantName {`}}`}</code> |
46 | | - to sanitize the value of the constant. |
47 | | - When using templates, you must sanitize all constants using <code>toJson</code> to avoid template injection vulnerabilities. |
| 45 | + In the templates on this page, variables are pulled into templates using <code>{`{{`} toJson .variableName {`}}`}</code> |
| 46 | + to sanitize the value of the variable. |
| 47 | + When using templates, you must sanitize all variables using <code>toJson</code> to avoid template injection vulnerabilities. |
48 | 48 | </div> |
49 | 49 | </Alert> |
50 | 50 |
|
@@ -126,8 +126,8 @@ The following snippet shows a provisioner with custom X.509 and SSH templates: |
126 | 126 | location of which would be `$(step path)/templates/certs/x509/leaf.tpl`. |
127 | 127 | - **_relative to the execution directory of `step-ca`_**: e.g. `./path/to/file.tpl` or `../path/to/file.tpl` |
128 | 128 |
|
129 | | - - **templateData**: defines constants that can be used in the template. |
130 | | - In the example above, you are able to use the defined organizational unit as the constant `{{ .OrganizationalUnit }}`, |
| 129 | + - **templateData**: defines variables that can be used in the template. |
| 130 | + In the example above, you are able to use the defined organizational unit as the variable `{{ .OrganizationalUnit }}`, |
131 | 131 | for example in a template like: |
132 | 132 |
|
133 | 133 | ```json |
@@ -209,15 +209,15 @@ See [the complete list of fields supported in `step-ca` templates](https://githu |
209 | 209 |
|
210 | 210 | <Alert severity="info" id="star11"> |
211 | 211 | <div> |
212 | | - <strong>A note on <code>.Insecure</code> constants</strong><br /> |
213 | | - In templates, some constants are prefixed with <code>.Insecure</code>. |
| 212 | + <strong>A note on <code>.Insecure</code> variables</strong><br /> |
| 213 | + In templates, some variables are prefixed with <code>.Insecure</code>. |
214 | 214 | They contain information that has not been cryptographically signed |
215 | 215 | by a source that the CA trusts. |
216 | 216 | For example, the <code>.Insecure.CR</code> map holds the user-supplied Certificate Request. |
217 | 217 | </div> |
218 | 218 | </Alert> |
219 | 219 |
|
220 | | -Here are some constants available in X.509 certificate templates: |
| 220 | +Here are some variables available in X.509 certificate templates: |
221 | 221 |
|
222 | 222 | - **.Subject**: |
223 | 223 | The subject that was passed in to `step certificate` or `step ca certificate`. Specifically, |
@@ -247,7 +247,7 @@ Here are some constants available in X.509 certificate templates: |
247 | 247 | this is an array of the certificate chain from the request. |
248 | 248 | This chain connects the authorization certificate to the root CA configured in the provisioner. |
249 | 249 |
|
250 | | -- **.Insecure** These constants are marked insecure because they contain client-supplied data that is not signed by a trusted party. |
| 250 | +- **.Insecure** These variables are marked insecure because they contain client-supplied data that is not signed by a trusted party. |
251 | 251 |
|
252 | 252 | - **.Insecure.CR**<Reference id="star11" marker="*" />: ☠️ |
253 | 253 | This holds the Certificate Request (CSR) received from the client. |
@@ -325,7 +325,7 @@ Use these functions to populate custom certificate OID `extensions`: |
325 | 325 | ] |
326 | 326 | ``` |
327 | 327 |
|
328 | | -When applied to template constants, these functions enable dynamic OID extensions: |
| 328 | +When applied to template variables, these functions enable dynamic OID extensions: |
329 | 329 |
|
330 | 330 | ``` |
331 | 331 | { |
@@ -482,7 +482,7 @@ Here are the most relevant parameters available in SSH certificate template: |
482 | 482 | - **.Insecure.CR**<Reference id="star11" marker="*" />: |
483 | 483 | SSH certificate requests to `step-ca` are not CSRs in the X.509 sense. |
484 | 484 | So, `step-ca` creates a virtual certificate request, |
485 | | - and that's what this constant represents. |
| 485 | + and that's what this variable represents. |
486 | 486 |
|
487 | 487 | - **.Insecure.CR.Principals**: If you trust a host to register its own custom SANs |
488 | 488 | (for example, when using the IID provisioner), |
@@ -570,13 +570,13 @@ delimited by `{{` and `}}`. These are called **_actions_** - **_actions_** are |
570 | 570 | data evaluations or control structures. The ones in the default template are: |
571 | 571 |
|
572 | 572 | - `{{ toJson .Subject }}`: renders `.Subject` as JSON. `toJson` is a function in |
573 | | -Sprig that encodes the passed item into JSON. `.Subject` is a constant available |
| 573 | +Sprig that encodes the passed item into JSON. `.Subject` is a variable available |
574 | 574 | in all templates that contains the `<subject>` parameter passed in the CLI, in |
575 | 575 | this case, `[email protected]`, and to be more precise, this value is available |
576 | 576 | in `.Subject.CommonName`. |
577 | 577 |
|
578 | 578 | - `{{ toJson .SANs }}`: renders `.SANs` (Subject Alternative Names) as JSON. |
579 | | -The constant `.SANs` is also available in all templates and contains the list |
| 579 | +The variable `.SANs` is also available in all templates and contains the list |
580 | 580 | of `SANs` passed from the CLI. If no `SANs` are specified, the |
581 | 581 | `.Subject.CommonName` will be used as a default `SAN` (e.g. |
582 | 582 | `[email protected]` in our example). If you add more `SANs` using the |
|
0 commit comments