You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Keyfactor Secrets Engine for Hashicorp Vault is a Vault plugin that replicates Vault’s onboard PKI API and processes certificate enrollment requests through the Keyfactor Command or Keyfactor Control platform. In many cases the onboard PKI engine included with Vault can be swapped for the Keyfactor engine seamlessly, with no impact to Vault client applications. While the simplicity of the onboard PKI is attractive to developers who are trying to implement the simplest solution in order to meet encryption requirements, it presents other enterprise teams with some challenges when it comes to PKI operations and security:
@@ -32,46 +66,48 @@ Keyfactor Command can provide the control and visibility needed for a Vault envi
This Vault Plugin has been tested against Hashicorp Vault version 1.10.0 and the Keyfactor Platform 9.6+. We provide several pre-built binaries that correspond to various operating systems and processor architectures. If not building the plugin from source code, select the os/architecture combination that corresponds to your environment.
71
+
This Vault Plugin has been tested against Hashicorp Vault version 1.10+ and the Keyfactor Platform 9.6+. We provide several pre-built binary files that correspond to various operating systems and processor architectures. If not building the plugin from source code, select the os/architecture combination that corresponds to your environment.
38
72
39
-
###Installation Requirements
73
+
## Installation Requirements
40
74
41
75
The requirements for the plugin are relatively simple. It runs as a single executable on the Hashicorp Vault server.
42
76
There are no specific system requirements to install it, however there are a few general things that must be in place for
43
77
it to function properly. These requirements are listed below, and are then expanded in the details throughout this
44
78
document.
45
79
46
-
1.**General Keyfactor Requirements**
80
+
### Keyfactor Requirements
81
+
47
82
- A functional instance of Keyfactor Command
48
83
- An administrative user account to be used for configuring the Keyfactor options needed for the implementation
49
84
- A functional integrated certificate authority to be used for issuing the certificates
50
85
- A certificate template (or templates) defined to use for certificate issuance.
51
86
- A user account with permissions to connect to the Keyfactor API and submit certificate requests. This user account will require READ and ENROLL permissions on the certificate template that you will use for the Vault plugin.
52
87
53
-
2.**General Hashicorp Vault Requirements**
54
-
- A functional Hashicorp Vault Installation
88
+
### Hashicorp Vault Requirements
89
+
90
+
- A functional Hashicorp Vault Installation **version 1.10.xx or greater**.
55
91
- An administrative account with permission to login to the Hashicorp Vault server in order to make administrative changes.
56
92
- An adequate number of unseal keys to meet the minimum criteria to unseal the Hashicorp Vault
57
93
- A Hashicorp Vault login token
58
94
59
95
## Installation - Keyfactor
60
96
61
-
1.**Create the Active Directory service account**
97
+
### Create the Active Directory service account
62
98
63
-
For the purposes of this document, we will not go into the details of how to create an Active Directory user since this process varies widely by company, however, here are a couple things to consider:
99
+
For the purposes of this document, we will not go into the details of how to create an Active Directory user since this process can vary widely, however, here are a couple things to consider:
64
100
65
-
- Ensure that the user does not have an expiring password, or if it does, ensure that the password resets are managed carefully. Expiration of this password could result in production outages with the plugin.
66
-
- Ensure that the user does not have logon time restrictions unless you only want the Hashicorp Vault plugin to function during specific timeframes.
101
+
- Ensure that the user does not have an expiring password, or if it does, ensure that the password resets are managed carefully. Expiration of this password could result in production outages with the plugin.
102
+
- Ensure that the user does not have logon time restrictions unless you only want the Hashicorp Vault plugin to function during specific timeframes.
67
103
68
-
1.**Assign the user permissions in Keyfactor Command**
104
+
### Assign the user permissions in Keyfactor Command
69
105
70
-
In order to be able to enroll for certificates through the Keyfactor Command API, it will be necessary to create the necessary role and delegate permissions within Keyfactor. It is not a requirement that this be a new role. If there is an existing role within your organization that allows for these basic permissions, that role can be used for this connection. If you do not have an existing role, and would like to create one, those steps are described later in this document.
106
+
In order to be able to enroll for certificates through the Keyfactor Command API, it will be necessary to create the necessary role and delegate permissions within Keyfactor. It is not a requirement that this be a new role. If there is an existing role within your organization that allows for these basic permissions, that role can be used for this connection. If you do not have an existing role, and would like to create one, those steps are described later in this document.
71
107
72
-
1.**Create the certificate template to use**
108
+
### Create a certificate template
73
109
74
-
The first step to configuring Keyfactor is to create the certificate template that will be used for the enrollment and publish it into Keyfactor.
110
+
The first step to configuring Keyfactor is to create the certificate template that will be used for the enrollment and publish it into Keyfactor.
75
111
76
112
**To create a new certificate template and import into Keyfactor:**
77
113
@@ -112,7 +148,7 @@ template.
112
148
113
149
1. Click OK to save the template.
114
150
115
-
### Publish the template on the Certificate Authority
151
+
### Publish the template for the Certificate Authority
116
152
117
153
It is now necessary to take the certificate template that you created and publish it so that it is an available template for issuance off of the CA.
118
154
@@ -157,14 +193,15 @@ To enable CSR enrollment on the template:
157
193
1. On the properties tab for the template, enable CSR enrollment. Then click Save
158
194

159
195
160
-
## Installation - Hashicorp Vault
196
+
## Installation - Vault
161
197
162
198
This document covers configuration of the Keyfactor Secrets Engine Plugin for Hashicorp Vault, and assumes that there is a running Vault environment in place. This document does not cover the steps necessary to do the initial install and configuration of Hashicorp Vault.
163
199
164
200
On the server that will host the vault plugin, it will be necessary to setup the appropriate environment variables and
165
201
configuration files to enable the plugin to run and establish a connection back to Keyfactor Command. The specific syntax for setting environment variables will differ slightly between Windows and Linux distributions, but the approach is the same.
166
202
167
-
1. Confirm functionality of the Hashicorp Vault environment
203
+
### Check the Vault server status
204
+
168
205
Hashicorp Vault must be installed and running to install and register the Keyfactor Secrets Plugin. To check the status of the Vault installation on the server being used, log into the Vault server with a logon account that has sufficient administrative privileges, and issue the following command:
Once the appropriate number of keys has been entered, the status should indicate "Unsealed = True"
197
234
198
-
### Encode the user credentials
199
-
200
-
In order to connect to the Keyfactor system, the Keyfactor plugin will need to use the credentials for the Active Directory Service Account that you created earlier in the process. These credentials will be used within Keyfactor plugin config file, and must be in Base64 encoded Basic Auth format.
201
-
202
-
To create the encoded string to use in the config file, use a Text to Base64 converter such as the one provided here:
The credential string to be encoded should be in the format of: `Domain\Username:Password`
207
-
208
-

209
-
210
-
### Build the Keyfactor config file
211
-
212
-
*Note: The current version of this plugin stores configuration in a text file. Future plans include moving the configuration to the built in Vault configuration store*
213
-
214
-
The Keyfactor plugin requires a configuration file to be built to store the parameters for the connection to Keyfactor. This file is in a standard JSON format on the Hashicorp server. The file can be stored anywhere, but is typically in a location such as: `/usr/bin/keyfactor/config.json`
215
-
216
-
Based on the values below, create the config file and save it into a location on the Vault server.
**HOST** - This is is the hostname or IP Address for the Keyfactor server.
232
-
233
-
**CREDS** - This is the username and password for the service account used to connect to Keyfactor encoded as a Base64 Basic Auth string. The details for creating this are in section 11 above.
234
-
235
-
**TEMPLATE** - The Template value is the Template Short Name for the template that was created to be used for the certificate issuance. This template nme must be the same template that is setup on the API key within
236
-
Keyfactor, and the user account specified in the CREDS parameter must have READ and ENROLL permissions on this template.
237
-
238
-
**PROTOCOL** - The protocol used to connect to the Keyfactor server. This can be HTTP or HTTPS. Keyfactor recommends that HTTP only be used for sandbox or testing scenarios.
239
-
240
-
**CA** - This is the CA name for the certificate authority that the certificate template is published on. Note that it may be necessary to double escape special characters in some scenarios.
241
-
242
-
**IMPORTANT NOTE:***When using HTTPS for the protocol, the Keyfactor SSL certificate or chain should be included in the trusted root store of the Hashicorp server to avoid TLS connection failures due to an untrusted certificate chain.*
243
-
244
-
### Set the environment variables
245
-
246
-
Once the config file is created, it is necessary to set the appropriate environment variables so that the Keyfactor plugin is able to locate the config file. To do this, set a system variable for KF_CONF_PATH that points to the location of the config file. The method to accomplish this will vary based on your system configuration.
247
-
248
-
> Set environment variables in Linux with the following command:
249
-
>
250
-
> `export <variable name>='<value>'`
251
-
>
252
-
> in Windows:
253
-
>
254
-
> `$env:<variable name>="<value>"`
255
-
256
-
Set the **KF_CONF_PATH** to the path of the plugin configuration file.
You may also be able to add this into your environment file or rc.local startup process based on your linux
263
-
distribution.
264
-
265
-
If you are running Hashicorp Vault as a service with system, it may be necessary to add a line in the vault service config file so that this variable is set prior to Vault startup.
> Windows requires the binary to have a recognized executable extension, so we name the windows executable keyfactor.exe.
301
267
302
-
> Windows requires the binary to have a recognized executable extension, so we name the windows binaries keyfactor.exe, but keep the path "keyfactor"
268
+
The result should look like this: `Success! Registered plugin: <instance name>`
303
269
304
-
The result should look like this: `Success! Registered plugin: keyfactor`
270
+
> _For the rest of this document, we will assume that the instance of the plugin is named "keyfactor"._
305
271
306
272
1. Enable the plugin within Hashicorp Vault
307
273
Once the plugin is installed into Vault, it just needs to be enabled. As a part of this enable process, you must specify the endpoint name that will be used for the secrets engine. This name is arbitrary. For this example, we are using keyfactor as the enpoint name, but it can be named to match existing endpoints that you are looking to replace with a connection to Keyfactor if necessary.
308
274
309
-
run the following command:
275
+
run the following command:
310
276
311
277
`vault secrets enable keyfactor`
312
278
@@ -344,7 +310,10 @@ you may or may not be able to access certain paths.
344
310
Fetch a CA, CRL, CA Chain, or non-revoked certificate.
345
311
346
312
^certs/?$
347
-
Fetch a CA, CRL, CA Chain, or non-revoked certificate.
313
+
Use with the "list" command to display the list of certificate serial numbers for certificates managed by this secrets engine.
314
+
315
+
^config$
316
+
Configure the Keyfactor Secrets Engine backend.
348
317
349
318
^issue/(?P<role>\w(([\w-.]+)?\w)?)$
350
319
Request a certificate using a certain role with the provided details.
@@ -365,13 +334,44 @@ you may or may not be able to access certain paths.
365
334
366
335
```
367
336
337
+
### Configure the plugin
338
+
339
+
Once the plugin has been successfully installed, the next step is to set the configuration values that will allow it to interact with the Keyfactor platform.
340
+
341
+
The Keyfactor plugin implements a per-instance configuration which allows multiple instances of the plugin to exist simultaneously. This is useful in cases where you want to manage multiple certificate authorities or templates.
The values that will need to be set are the following:
348
+
349
+
- url
350
+
- The url pointing to the keyfactor platform with no trailing slashes **(example: "https://kftrain.keyfactor.lab")**
351
+
- username
352
+
- The username of the account used for authenticating to the platform including the domain **(example: "KEYFACTOR\VaultUser")**
353
+
- password
354
+
- The password corresponding to the user account for authenticating to the platform.
355
+
- ca
356
+
- The certificate authority used when issuing certificates via the plugin **(example: kftrain.keyfactor.lab\\\\keyfactor-KFTRAIN-CA)**
357
+
- template
358
+
- The certificate template name to use when issuing certificates. It should be issuable by the CA
359
+
360
+
Once you've set the configuration properties, run the command:
361
+
`vault read <instance name>/config`
362
+
in order to view the configuration settings (see example below).
363
+
364
+

365
+
368
366
## Using the plugin
369
367
370
-
1. Adding Roles
371
-
Hashicorp Vault supports being able to add roles to control certificate issuance policies such as allowed domains. To create a role, use the vault write command as noted below
368
+
### Adding Roles
369
+
370
+
Hashicorp Vault supports being able to add roles to control certificate issuance policies such as allowed domains. To create a role, use the vault write command as in the below example.
When requesting a certificate using the Keyfactor plugin, the command is the same as if you were issuing the certificate through the vault integrated PKI. As a part of the write command you will specify the role name you would like to use, as well as the common name on the certificate. A typical certificate issuance command is listed below for the hashiwebserver role, and a CN of foo.kftrain.lab on the certificate.
@@ -380,7 +380,8 @@ you may or may not be able to access certain paths.
380
380
381
381

382
382
383
-
1. Reading Certificates from the secret store
383
+
### Viewing Certificates
384
+
384
385
After certificates are stored in the secrets store, you can then retrieve those certificates at a later time if necessary. To list the certificates that exist within the Vault store, use the LIST option with vault. The only parameter that you need to include is the secrets store name for the store that you would like to read. The system will then return a list of all of the serial numbers for certificates that are present in that secrets store.
385
386
386
387
`vault list keyfactor/certs`
@@ -456,7 +457,15 @@ you may or may not be able to access certain paths.
456
457
457
458
## Plugin command reference
458
459
459
-
The following commands are supported by the Keyfactor Hashicorp Vault Secrets Engine plugin:
460
+
The following commands are supported by the Keyfactor Hashicorp Vault Secrets Engine plugin. These examples assume the instance of the plugin is named "keyfactor".
461
+
462
+
### Create/update configuration
463
+
464
+
`vault write keyfactor/config <key>=<value>`
465
+
466
+
### Read configuration
467
+
468
+
`vault read keyfactor/config`
460
469
461
470
### Create/update role
462
471
@@ -502,11 +511,4 @@ The following commands are supported by the Keyfactor Hashicorp Vault Secrets En
502
511
503
512
### Read CA chain
504
513
505
-
`vault read keyfactor/ca_chain`
506
-
507
-
---
508
-
509
-
Additional notes for this plugin:
510
-
511
-
TTL management is not handled through the secrets engine. Validity period is determined by certificate template.
512
-
Expiration time is not reported in the enrollment output
0 commit comments