Skip to content

Commit 79eac45

Browse files
updated readme
1 parent 6f9faa4 commit 79eac45

File tree

3 files changed

+122
-112
lines changed

3 files changed

+122
-112
lines changed

README.md

Lines changed: 112 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,40 @@ certificate authority. After issuance, the certificate is then returned to Hashi
1313

1414
---
1515

16+
## Table of contents
17+
18+
- [Overview](#overview)
19+
- [Compatibility](#compatibility)
20+
- [Installation Requirements](#installation-requirements)
21+
- [Keyfactor Requirements](#keyfactor-requirements)
22+
- [Hashicorp Vault Requirements](#hashicorp-vault-requirements)
23+
- [Installation - Keyfactor](#installation---keyfactor)
24+
- [Create the Active Directory service account](#create-the-active-directory-service-account)
25+
- [Create a certificate template](#create-a-certificate-template)
26+
- [Publish the template for the Certificate Authority](#publish-the-template-for-the-certificate-authority)
27+
- [Installation - Vault](#installation---vault)
28+
- [Check the Vault server status](#check-the-vault-server-status)
29+
- [Install and register the plugin](#install-and-register-the-plugin)
30+
- [Configure the plugin](#configure-the-plugin)
31+
- [Using the plugin](#using-the-plugin)
32+
- [Adding Roles](#adding-roles)
33+
- [Issuing Certificates](#issuing-certificates)
34+
- [Viewing Certificates](#viewing-certificates)
35+
- [Command Reference](#plugin-command-reference)
36+
- [Create/update configuration](#createupdate-configuration)
37+
- [Read configuration](#read-configuration)
38+
- [Create/update Roles](#createupdate-role)
39+
- [List roles](#list-roles)
40+
- [Read a role](#read-role)
41+
- [Delete a role](#delete-role)
42+
- [Request a certificate](#request-certificate)
43+
- [List certificates](#list-certificates)
44+
- [View a certificate](#read-certificate)
45+
- [Revoke a certificate](#revoke-certificate)
46+
- [Sign a CSR](#sign-csr)
47+
- [View CA Certificate](#read-ca-cert)
48+
- [View CA Certificate Chain](#read-ca-chain)
49+
1650
## Overview
1751

1852
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
3266

3367
!["high-level-architecture"](images/arch-diagram.png)
3468

35-
### Compatibility
69+
## Compatibility
3670

37-
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.
3872

39-
### Installation Requirements
73+
## Installation Requirements
4074

4175
The requirements for the plugin are relatively simple. It runs as a single executable on the Hashicorp Vault server.
4276
There are no specific system requirements to install it, however there are a few general things that must be in place for
4377
it to function properly. These requirements are listed below, and are then expanded in the details throughout this
4478
document.
4579

46-
1. **General Keyfactor Requirements**
80+
### Keyfactor Requirements
81+
4782
- A functional instance of Keyfactor Command
4883
- An administrative user account to be used for configuring the Keyfactor options needed for the implementation
4984
- A functional integrated certificate authority to be used for issuing the certificates
5085
- A certificate template (or templates) defined to use for certificate issuance.
5186
- 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.
5287

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**.
5591
- An administrative account with permission to login to the Hashicorp Vault server in order to make administrative changes.
5692
- An adequate number of unseal keys to meet the minimum criteria to unseal the Hashicorp Vault
5793
- A Hashicorp Vault login token
5894

5995
## Installation - Keyfactor
6096

61-
1. **Create the Active Directory service account**
97+
### Create the Active Directory service account
6298

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:
64100

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.
67103

68-
1. **Assign the user permissions in Keyfactor Command**
104+
### Assign the user permissions in Keyfactor Command
69105

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.
71107

72-
1. **Create the certificate template to use**
108+
### Create a certificate template
73109

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.
75111

76112
**To create a new certificate template and import into Keyfactor:**
77113

@@ -112,7 +148,7 @@ template.
112148

113149
1. Click OK to save the template.
114150

115-
### Publish the template on the Certificate Authority
151+
### Publish the template for the Certificate Authority
116152

117153
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.
118154

@@ -157,14 +193,15 @@ To enable CSR enrollment on the template:
157193
1. On the properties tab for the template, enable CSR enrollment. Then click Save
158194
!["template12"](images/template12.png)
159195

160-
## Installation - Hashicorp Vault
196+
## Installation - Vault
161197

162198
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.
163199

164200
On the server that will host the vault plugin, it will be necessary to setup the appropriate environment variables and
165201
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.
166202

167-
1. Confirm functionality of the Hashicorp Vault environment
203+
### Check the Vault server status
204+
168205
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:
169206

170207
`vault status`
@@ -195,79 +232,6 @@ cuE1X01NrNgeAU6ao5aNUFsjWAPhOgEPkgaW5Vl19XDg
195232

196233
Once the appropriate number of keys has been entered, the status should indicate "Unsealed = True"
197234

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:
203-
204-
[https://base64.guru/converter/encode/text](https://base64.guru/converter/encode/text)
205-
206-
The credential string to be encoded should be in the format of: `Domain\Username:Password`
207-
208-
!["vault2"](images/vault2.png)
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.
217-
The file will look something like this:
218-
219-
```
220-
{
221-
"host":"kftrain.keyfactor.lab",
222-
"creds":"S0VZRkFDVB9SXEFkbWluaXN0cmF0b3I6UGFzc3dvcmQx",
223-
"template":"HashiCorpVaultServer",
224-
"protocol":"https",
225-
"CA":"kftrain.keyfactor.lab\\\\keyfactor-KFTRAIN-CA"
226-
}
227-
```
228-
229-
The values within the file are as follows:
230-
231-
**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.
257-
258-
example:
259-
260-
`export KF_CONF_PATH='/usr/bin/keyfactor/config.json'`
261-
262-
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.
266-
267-
This line should look something like this:
268-
269-
`ExecStartPre=/bin/bash -c export KF_CONF_PATH='/usr/bin/keyfactor/config.json'`
270-
271235
### Install and register the plugin
272236

273237
To install and register the plugin on the Vault server, follow these steps:
@@ -276,7 +240,7 @@ To install and register the plugin on the Vault server, follow these steps:
276240

277241
An example plugins path may look like this:
278242

279-
`/usr/bin/keyfactor/vault-guides/secrets/engine/vault/plugins`
243+
`/usr/bin/vault/plugins`
280244

281245
1. Set the file to be executable.
282246

@@ -293,20 +257,22 @@ To install and register the plugin on the Vault server, follow these steps:
293257

294258
Linux:
295259

296-
`# vault plugin register -sha256=47f549d44ab2abcb528aa45725b3a83334a9465bb487f3d1182add55e5580c36 secret keyfactor`
260+
`# vault plugin register -sha256=47f549d44ab2abcb528aa45725b3a83334a9465bb487f3d1182add55e5580c36 secret <instance name>`
297261

298262
Windows:
299263

300-
`> vault plugin register -sha256=97a76ee45f8bbc3e852520cba38d16206f6a92ab0b8a2d2bbd7eaaae064ae9bf -command="keyfactor.exe" secret keyfactor`
264+
`> vault plugin register -sha256=97a76ee45f8bbc3e852520cba38d16206f6a92ab0b8a2d2bbd7eaaae064ae9bf -command="keyfactor.exe" secret <instance name>`
265+
266+
> Windows requires the binary to have a recognized executable extension, so we name the windows executable keyfactor.exe.
301267
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>`
303269

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"._
305271
306272
1. Enable the plugin within Hashicorp Vault
307273
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.
308274

309-
run the following command:
275+
run the following command:
310276

311277
`vault secrets enable keyfactor`
312278

@@ -344,7 +310,10 @@ you may or may not be able to access certain paths.
344310
Fetch a CA, CRL, CA Chain, or non-revoked certificate.
345311
346312
^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.
348317
349318
^issue/(?P<role>\w(([\w-.]+)?\w)?)$
350319
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.
365334
366335
```
367336

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.
342+
343+
To set a configuration value:
344+
345+
`vault write <instance name>/config <key>="<value>"`
346+
347+
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+
!["configread"](images/configread.png)
365+
368366
## Using the plugin
369367

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.
372371
`vault write keyfactor/roles/hashiwebserver allowed_domains=kftrain.lab allow_subdomains=true`
373372

374-
1. Issuing Certificates
373+
### Issuing Certificates
374+
375375
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.
376376

377377
`vault write keyfactor/issue/hashiwebserver common_name=foo.kftrain.lab dns_sans=foo.kftrain.lab`
@@ -380,7 +380,8 @@ you may or may not be able to access certain paths.
380380

381381
!["vault3"](images/vault3.png)
382382

383-
1. Reading Certificates from the secret store
383+
### Viewing Certificates
384+
384385
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.
385386

386387
`vault list keyfactor/certs`
@@ -456,7 +457,15 @@ you may or may not be able to access certain paths.
456457

457458
## Plugin command reference
458459

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`
460469

461470
### Create/update role
462471

@@ -502,11 +511,4 @@ The following commands are supported by the Keyfactor Hashicorp Vault Secrets En
502511

503512
### Read CA chain
504513

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
514+
`vault read keyfactor/ca_chain`

images/configread.png

4.72 KB
Loading

0 commit comments

Comments
 (0)