Skip to content

Commit ebf8f49

Browse files
author
Keyfactor
committed
Update generated README
1 parent 97be5b0 commit ebf8f49

File tree

1 file changed

+81
-132
lines changed

1 file changed

+81
-132
lines changed

README.md

Lines changed: 81 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,8 @@ commands to request certificates from Keyfactor and allows security teams to mai
3535
certificates issued to Vault instances.
3636
This plugin connects Vault with trusted public, private, or cloud-hosted CAs configured in the Keyfactor platform.
3737
Certificates are requested through Vault using standard Vault commands, and are then redirected to Keyfactor so that the
38-
certificates can be issued off of a trusted enterprise
39-
certificate authority. After issuance, the certificate is then returned to Hashicorp Vault and stored within the Vault
40-
Secrets store to then be used in other applications.
38+
certificates can be issued off of a trusted enterprise certificate authority. After issuance, the certificate is then
39+
returned to Hashicorp Vault and stored within the Vault Secrets store to then be used in other applications.
4140

4241
---
4342

@@ -156,15 +155,23 @@ document.
156155

157156
## Installation - Keyfactor
158157

159-
### Create the Active Directory service account or oAuth client
158+
### Create the Service Account in Command
160159

161-
For the purposes of this document, we will not go into the details of how to create an Active Directory user since this
162-
process can vary widely, however, here are a couple of things to consider:
160+
This plugin can authenticate via username/password, TLS certificate authentication, and oAuth/openIDConnect.
163161

164-
- Ensure that the user does not have an expiring password, or if it does, ensure that the password resets are managed
165-
carefully. Expiration of this password could result in production outages with the plugin.
166-
- Ensure that the user does not have logon time restrictions unless you only want the Hashicorp Vault plugin to function
167-
during specific timeframes.
162+
For the purposes of this document, we will not go into the details of how to create each type of service entity.
163+
Refer to the Keyfactor platform documentation for guidance on creating these service accounts.
164+
165+
The configuration of the plugin will differ slightly for each different approach. Here is a table with the values
166+
needed for authentication for each approach:
167+
168+
| basic | oAuth | TLS |
169+
| ----------------- | ----- | --- |
170+
| Username | Client ID | Certificate Path |
171+
| Password | Client Secret | |
172+
| AD Domain | Token Endpoint | |
173+
174+
These values will be discussed in greater detail in the [Configure the plugin](#configure-the-plugin) section of this document.
168175

169176
### Assign the user permissions in Keyfactor Command
170177

@@ -177,89 +184,14 @@ document.
177184
### Create a certificate template
178185

179186
The first step to configuring Keyfactor is to create the certificate template that will be used for the enrollment and
180-
publish it into Keyfactor.
181-
182-
**To create a new certificate template and import into Keyfactor:**
183-
184-
1. Open up the Certificate Authority MMC console.
185-
186-
1. Right Click on Certificate Templates, and select "Manage". This will open up the Certifcate Templates MMC
187-
console.
188-
189-
1. In the Certificate Templates MMC console, choose a template that you would like to use as a starting point for
190-
your new Vault Plugin template, and duplicate it as a starting point. For standard SSL certificates, most companies
191-
will start with a template such as "Web Server" for a general template. In situations where you
192-
need the certificate to do mutual TLS authentication, you may wish to choose the Computer template so that it will
193-
include both the Client Authentication and Server Authentication key usages. To duplicate the template, right click
194-
on the template and select "Duplicate Template".
195-
196-
1. You should now see the properties for the new template you are creating, and you will need to customize the
197-
template for use with the plugin. In most cases, there will be only a few minor changes that need made to the
198-
template.
199-
200-
1. On the General tab, change the Template Display Name to represent the name that you want to have on the template.
201-
202-
!["template1"](images/template1.png)
203-
204-
1. On the General tab, set the Validity Period and Renewal Period for the certificates that you are going to issue
205-
off of this template.
206-
207-
!["template2"](images/template2.png)
208-
209-
> Validity and Renewal period values depend on use case and organizational policy.
210-
211-
1. On the Request Handling tab, ensure that the option is selected for "Allow Private Keys to be Exported"
212-
213-
!["template3"](images/template3.png)
214-
215-
1. Unless you are planning to implement an approval workflow process for the certificates issued through Hashicorp
216-
Vault, ensure that "CA Certificate Manager Approval" is not checked on the Issuance Requirements tab.
217-
218-
!["template4"](images/template4.png)
219-
220-
1. On the Security tab, add the service account that was created earlier so that it has permissions to enroll
221-
certificates off of this template. Click Add to search for the user to add, and then grant the user READ and
222-
ENROLL permissions on the Template.
223-
224-
!["template5"](images/template5.png)
225-
226-
1. Click OK to save the template.
227-
228-
### Publish the template for the Certificate Authority
229-
230-
It is now necessary to take the certificate template that you created and publish it so that it is an available template
231-
for issuance off of the CA.
232-
233-
**To publish the template**:
234-
235-
1. Open the Certificate Authority MMC console
236-
1. Right-click on Certificate Templates in the left hand pane and select NEW – Certificate Template to Issue
237-
!["template6"](images/template6.png)
238-
239-
1. Select the template that was created in the previous step, and then click OK.
240-
!["template7"](images/template7.png)
187+
publish it into Keyfactor. This template can be created in Active Directory for AD based Certificate Authorities, or created as
188+
Certificate Profiles in EJBCA and imported into Command.
241189

242-
### Import the new template into the Keyfactor console
190+
Refer to the Keyfactor Command documentation for instructions on how to create a Certificate Template in Command.
243191

244-
Now that the new certificate template has been created on the CA, we need to ensure that the template is available for
245-
issuance within the Keyfactor Command console.
192+
### Allow the template to be used for CSR enrollment through Keyfactor
246193

247-
**To import the certificate template**:
248-
249-
1. Log into the Keyfactor Command console as a user with administrative privileges
250-
251-
1. Select "Locations" from the top menu bar, then select "Certificate Templates"
252-
!["template8"](images/template8.png)
253-
254-
1. Click the "Import Templates" button at the top of the screen
255-
!["template9"](images/template9.png)
256-
257-
1. Select the Active Directory Forest where you created the template, and then click "Import Templates"
258-
!["template10"](images/template10.png)
259-
260-
### Enable the template for CSR enrollment through Keyfactor
261-
262-
Once the template has been imported into Keyfactor Command, it is then necessary to enable that template for PFX
194+
Once the template has been imported into Keyfactor Command, it is then necessary to enable that template for CSR
263195
enrollment through the console.
264196

265197
To enable CSR enrollment on the template:
@@ -406,12 +338,12 @@ you may or may not be able to access certain paths.
406338
^ca_chain(/pem)?$
407339
Fetch a CA, CRL, CA Chain, or non-revoked certificate.
408340
409-
^cert/(?P<serial>[0-9A-Fa-f-:]+)$
410-
Fetch a CA, CRL, CA Chain, or non-revoked certificate.
411-
412341
^certs/?$
413342
Use with the "list" command to display the list of certificate serial numbers for certificates managed by this secrets engine.
414343
344+
^certs/(?P<serial>[0-9A-Fa-f-:]+)$
345+
Fetch a CA, CRL, CA Chain, or non-revoked certificate.
346+
415347
^config$
416348
Configure the Keyfactor Secrets Engine backend.
417349
@@ -422,82 +354,96 @@ you may or may not be able to access certain paths.
422354
^revoke/(?P<serial>[0-9A-Fa-f-:]+)$
423355
Revoke a certificate by serial number.
424356
425-
^roles/(?P<name>\w(([\w-.]+)?\w)?)$
426-
Manage the roles that can be created with this backend.
427-
428357
^roles/?$
429358
List the existing roles in this backend
430359
360+
^roles/(?P<name>\w(([\w-.]+)?\w)?)$
361+
Manage the roles that can be created with this backend.
362+
431363
^sign/(?P<role>\w(([\w-.]+)?\w)?)$
432364
Request certificates using a certain role with the provided details.
433365
example: vault write keyfactor/sign/<role> csr=<csr>
434366
435367
```
436368

369+
If you see this, you have successfully installed the plugin. Now we can configure it for connecting with Command for certificate enrollment.
370+
437371
### Configure the plugin
438372

439373
Once the plugin has been successfully installed, the next step is to set the configuration values that will allow it to
440374
interact with the Keyfactor platform.
441375

442376
The Keyfactor plugin implements a per-instance configuration which allows multiple instances of the plugin to exist
443-
simultaneously. This is useful in cases where you want to manage multiple certificate authorities or templates.
377+
simultaneously. This could be useful for creating multiple instances of the plugin; each scoped to a specific Command service account identity that
378+
is specific to a particular issuance workflow.
444379

445380
To set a configuration value:
446381

447382
`vault write <instance name>/config <key>="<value>"`
448383

449-
The values that will need to be set are the following:
450-
451-
- url
452-
- The url pointing to the keyfactor platform with no trailing slashes **(example: "https://kftrain.keyfactor.lab")**
453-
- ca
454-
- The certificate authority used when issuing certificates via the plugin **(example:
455-
kftrain.keyfactor.lab\\\\keyfactor-KFTRAIN-CA)**
456-
- template
457-
- The certificate template name to use when issuing certificates. It should be issuable by the CA
384+
Here is a table of the available configuration paramaters
385+
| name | value type | required | default | description |
386+
| ---- | ---------- | -------- | ------- | ----------- |
387+
| **url** | string | yes | | The url pointing to the keyfactor platform with no trailing slashes **(example: "https://kftrain.keyfactor.lab")** |
388+
| **api_path** | string | no | _"KeyfactorAPI"_ | The path after the Command instance url to reach the Keyfactor API |
389+
| **ca** | string | no[^1] | | | The certificate authority used when issuing certificates via the plugin **(example: kftrain.keyfactor.lab\\\\keyfactor-KFTRAIN-CA)** |
390+
| **template** | string | no[^1] | | The certificate template name to use when issuing certificates. It should be issuable by the CA |
391+
| **username** | string | no[^2] | | basic authentication: username |
392+
| **domain** | string | no[^2] | | basic authentication: Active Directory Domain |
393+
| **password** | string | no[^2] | | basic authentication: password |
394+
| **client_id** | string | no[^3] | | oAuth authentication: client ID |
395+
| **client_secret** | string | no[^3] | |oAuth authentication: Client Secret |
396+
| **token_url** | string | no[^3] | | oAuth authentication: Endpoint for retreiving the authentication token |
397+
| **access_token** | string | no | | oAuth access token, if retrieved outside the context of the plugin |
398+
| **scopes** | []string (comma separated list) | no | | the defined scopes to apply to the retreived token in the oAuth authorization flow. If not provided, all available scopes for the service account will be assigned to the token upon authentication |
399+
| **audience** | []string (comma seperated list) | no | | the OpenID Connect v1.0 or oAuth v2.0 token audience |
400+
| **skip_verify** | bool | no | _false_ | set this to true to skip checking the CRL list of the HTTPS endpoint |
401+
| **command_cert_path** | string | no | | set this value to the local path of the CA cert if it is untrusted by the client and skip_verify is false
402+
403+
[^1]: The **ca** and **template** fields can be provided via command line parameters. If they are not provided, the plugin will default to what is set in the configuration values. If neither are available an error will occur.
458404

459405
#### Basic Authentication Configuration
460406

461407
If you are using basic authentication to Keyfactor Command, you will also need to set the following values:
462408

463-
- username
464-
- The username of the account used for authenticating to the platform including the domain **(example: "
465-
KEYFACTOR\VaultUser")**
466-
- password
409+
- **domain**
410+
- The Active Directory domain of the account **(example: "KEYFACTOR")**
411+
- **username**
412+
- The username of the account used for authenticating to the platform excluding the domain **(example: "VaultUser")**
413+
- **password**
467414
- The password corresponding to the user account for authenticating to the platform.
468415

469-
#### oAuth2 Configuration
416+
[^2]: While none of these configuration values are explicitly required; they are _all_ required in order to use basic (username/password) authentication into Command.
470417

471-
##### Client Credentials Grant
418+
#### OpenID Connect / oAuth Configuration
472419

473-
If you are using the client credentials grant to authenticate to Keyfactor Command, you will also need to set the
474-
following values:
420+
If you are using an oAuth or OpenID Connect provider to authenticate into Keyfactor Command, you will also need to set the following values:
421+
- **client_id**
422+
- The client ID of the service principal account used to authenticate
475423

476-
- client_id
477-
- The client ID of the oAuth2 client used for authenticating to the platform
478-
- client_secret
479-
- The client secret corresponding to the oAuth2 client for authenticating to the platform
480-
- token_url
481-
- The URL to the oAuth2 token endpoint for the platform
482-
- scopes
483-
- The scopes of the oAuth2 client
484-
- audience
485-
- The audience of the oAuth2 client
424+
- **client_secret**
425+
- The client secret value generated via the identity provider when the service account was created
486426

487-
##### Access Token
427+
- **token_url**
428+
- The url where the token can be requested
429+
430+
[^3]: While none of these configuration values are explicitly required; they are _all_ required in order to use openID Connect / oAuth authentication into Command.
488431

489-
If you are using a static access token to authenticate to Keyfactor Command, you will also need to set the following
490-
value:
432+
##### Access Token
491433

492-
- access_token
493-
- The access token used for authenticating to the platform
434+
Rather than have the plugin perform the oAuth/OpenID authentication workflow, it is also possible to retreive the access token yourself and provide it in the configuration.
435+
If a valid access token is provided then the values for **client_id**, **client_secret** or **token_url** are not required.
494436

495437
Once you've set the configuration properties, run the command:
496438
`vault read <instance name>/config`
497439
in order to view the configuration settings (see example below).
498440

499441
!["configread"](images/configread.png)
500442

443+
> [!NOTE]
444+
> By default the sensitive values (password, client_secret) are hidden. To show these, pass the "show_hidden=true" parameter to the request; `vault read <instance name>/config show_hidden=true`
445+
446+
501447
### Adding Roles
502448

503449
Hashicorp Vault supports being able to add roles to control certificate issuance policies for allowed domains and
@@ -509,7 +455,10 @@ To create a role, use the vault write command as in the below example.
509455
This will create a role called "hashiwebserver" that can be used to generate certificates for domains ending with "
510456
kftrain.lab".
511457

512-
These properties can also be set in the certificate template. If they differ, the most restrictive setting is applied.
458+
> [!NOTE]
459+
> Use "*" for the value in "allowed_domains" to allow issuing for any domain.
460+
461+
These properties can also be set in the certificate template configured in Command. If they differ, the most restrictive setting is applied.
513462

514463
## Using the plugin
515464

@@ -622,7 +571,7 @@ instance of the plugin is named "keyfactor".
622571

623572
### Create/update role
624573

625-
`vault write keyfactor/roles/<rolename> allowed_domains=<domain1>,<domain2> allow_subdomains=true`
574+
`vault write keyfactor/roles/<rolename> allowed_domains="<domain1>,<domain2>" allow_subdomains=true`
626575

627576
### List roles
628577

@@ -646,7 +595,7 @@ instance of the plugin is named "keyfactor".
646595

647596
### Read certificate
648597

649-
`vault read keyfactor/cert/<serial number>`
598+
`vault read keyfactor/certs/<serial number>`
650599

651600
> Note: Certificate serial numbers are provided in the output for enrollment and list commands
652601

0 commit comments

Comments
 (0)