Skip to content

Commit 4eb6e26

Browse files
author
Keyfactor
committed
Update generated README
1 parent a810838 commit 4eb6e26

File tree

1 file changed

+217
-0
lines changed

1 file changed

+217
-0
lines changed

README.md

Lines changed: 217 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,217 @@
1+
# Keyfactor Utility (kfutil)
2+
3+
`kfutil` is a go-lang CLI wrapper for Keyfactor API. It also includes other utility/helper functions around automating common Keyfactor operations.
4+
5+
#### Integration status: Pilot - Ready for use in test environments. Not for use in production.
6+
7+
## About the Keyfactor API Client
8+
9+
This API client allows for programmatic management of Keyfactor resources.
10+
11+
12+
13+
## Support for Keyfactor Utility (kfutil)
14+
15+
Keyfactor Utility (kfutil) is open source and there is **no SLA** for this tool/library/client. Keyfactor will address issues as resources become available. Keyfactor customers may request escalation by opening up a support ticket through their Keyfactor representative.
16+
17+
###### To report a problem or suggest a new feature, use the **[Issues](../../issues)** tab. If you want to contribute actual bug fixes or proposed enhancements, use the **[Pull requests](../../pulls)** tab.
18+
___
19+
20+
21+
22+
23+
## Quickstart
24+
25+
```bash
26+
make install
27+
kfutil --help
28+
````
29+
30+
### Environmental Variables
31+
32+
All the variables listed below need to be set in your environment. The `kfutil` command will look for these variables
33+
and use them if they are set. If they are not set, the utility will fail to connect to Keyfactor.
34+
35+
```bash
36+
export KEYFACTOR_HOSTNAME=<mykeyfactorhost.mydomain.com>
37+
export KEYFACTOR_USERNAME=<myusername> # Do not include domain
38+
export KEYFACTOR_PASSWORD=<mypassword>
39+
export KEYFACTOR_DOMAIN=<mykeyfactordomain>
40+
```
41+
42+
## Commands
43+
44+
### Bulk operations
45+
46+
#### Bulk create cert stores
47+
48+
*Not implemented*
49+
This will attempt to process a CSV input file of certificate stores to create. The template can be generated by
50+
running: `kfutil generate-template --type bulk-certstore` command.
51+
52+
```bash
53+
kfutil bulk create certstores --file <path to csv file>
54+
```
55+
56+
#### Bulk create cert store types
57+
58+
*Not implemented*
59+
This will attempt to process a CSV input file of certificate store types to create. The template can be generated by
60+
running: `kfutil generate-template --type bulk-certstore-types` command.
61+
62+
```bash
63+
kfutil bulk create certstores --file <path to csv file>
64+
```
65+
66+
### Root of Trust
67+
The root of trust (rot) utility is a tool that allows you to bulk manage Keyfactor certificate stores and ensure that a
68+
set of defined certificates are present in each store that meets a certain set of criteria or no criteria at all.
69+
70+
### Root of Trust Quickstart
71+
```bash
72+
echo "Generating cert template file certs_template.csv"
73+
kfutil stores rot generate-template-rot --type certs
74+
# edit the certs_template.csv file
75+
echo "Generating stores template file stores_template.csv"
76+
kfutil stores rot generate-template-rot --type stores
77+
# edit the stores_template.csv file
78+
kfutil stores rot audit --add-certs certs_template.csv --stores stores_template.csv #This will audit the stores and generate a report file
79+
# review/edit the report file generated `rot_audit.csv`
80+
kfutil stores rot reconcile --import-csv
81+
# Alternatively this can be done in one step
82+
kfutil stores rot reconcile --add-certs certs_template.csv --stores stores_template.csv
83+
```
84+
85+
#### Generate Certificate List Template
86+
87+
This will write the file `certs_template.csv` to the current directory.
88+
89+
```bash
90+
kfutil stores generate-template-rot --type certs
91+
```
92+
93+
#### Generate Certificate Store List Template
94+
95+
This will write the file `stores_template.csv` to the current directory.
96+
97+
```bash
98+
kfutil stores generate-template-rot --type stores
99+
```
100+
101+
#### Run Root of Trust Audit
102+
103+
Audit will take in a list of certificates and a list of certificate stores and check that the certificate store's
104+
inventory either contains the certificate or does not contain the certificate based on the `--add-certs` and
105+
`--remove-certs` flags. These flags can be used together or separately. The aforementioned flags take in a path to CSV
106+
files containing a list of certificate thumbprints. To generate a template for these files, run the following command:
107+
```bash
108+
kfutil stores rot generate-template --type certs
109+
```
110+
To prepopulate the template file you can provide `--cn` multiple times.
111+
```bash
112+
kfutil stores rot generate-template --type certs \
113+
--cn <cert subject name> \
114+
--cn <additional cert subject name>
115+
```
116+
117+
In addition, you must provide a list of stores you wish to audit. To generate a template for this file, run the following
118+
command:
119+
```bash
120+
kfutil stores rot generate-template --type stores
121+
```
122+
To prepopulate the template file you can provide `--store-type` and `--container-type` multiple times.
123+
```bash
124+
kfutil stores rot generate-template --type stores \
125+
--store-type <store type name> \
126+
--store-type <additional store type name> \
127+
--container-type <container type name> \
128+
--container-type <additional container type name>
129+
```
130+
131+
With all the files generated and populated, you can now run the audit command:
132+
```bash
133+
kfutil stores rot audit \
134+
--stores stores_template.csv \
135+
--add-certs certs_template.csv \
136+
--remove-certs certs_template2.csv
137+
```
138+
This will generate an audit file that contains the results of the audit and actions that will be taken if `reconcile` is
139+
executed. By default, the audit file will be named `rot_audit.csv` and will be written to the current directory. To output
140+
the audit file to a different location, use the `--output` flag:
141+
```bash
142+
kfutil stores rot audit \
143+
--stores stores.csv \
144+
--add-certs addCerts.csv \
145+
--remove-certs removeCerts.csv \
146+
--output /path/to/output/autdit_file.csv
147+
```
148+
149+
150+
#### Run Root of Trust Reconcile
151+
152+
Reconcile will take in a list of certificates and a list of certificate stores and check that the certificate store's
153+
inventory either contains the certificate or does not contain the certificate based on the `--add-certs` and
154+
`--remove-certs` flags. These flags can be used together or separately. The aforementioned flags take in a path to CSV
155+
files containing a list of certificate thumbprints. To generate a template for these files, run the following command:
156+
```bash
157+
kfutil stores rot generate-template --type certs
158+
```
159+
To prepopulate the template file you can provide `--cn` multiple times.
160+
```bash
161+
kfutil stores rot generate-template --type certs \
162+
--cn <cert subject name> \
163+
--cn <additional cert subject name>
164+
```
165+
In addition, you must provide a list of stores you wish to reconcile. To generate a template for this file, run the following
166+
command:
167+
```bash
168+
kfutil stores rot generate-template --type stores
169+
```
170+
To pre-populate the stores template file you can provide multiple values in any combination of the following flags:
171+
```bash
172+
kfutil stores rot generate-template --type stores \
173+
--store-type <store type name> \
174+
--store-type <additional store type name> \
175+
--container-type <container type name> \
176+
--container-type <additional container type name>
177+
```
178+
179+
With all the files generated and populated, you can now run the reconcile command:
180+
```bash
181+
kfutil stores rot reconcile \
182+
--stores stores_template.csv \
183+
--add-certs certs_template.csv \
184+
--remove-certs certs_template2.csv
185+
```
186+
This will generate an audit file that contains the results of the audit and actions will immediately execute those actions.
187+
By default, the reconcile file will be named `rot_audit.csv` and will be written to the current directory. To output
188+
the reconcile file to a different location, use the `--output` flag:
189+
```bash
190+
kfutil stores rot reconcile \
191+
--stores stores.csv \
192+
--add-certs addCerts.csv \
193+
--remove-certs removeCerts.csv \
194+
--output /path/to/output/audit_file.csv
195+
```
196+
Alternatively you can provide an audit CSV file as an input to the reconcile command using the `--import-csv` flag:
197+
```bash
198+
kfutil stores rot reconcile \
199+
--import-csv /path/to/audit_file.csv
200+
```
201+
202+
### Development
203+
204+
This CLI developed using [cobra](https://umarcor.github.io/cobra/)
205+
206+
#### Adding a new command
207+
208+
```bash
209+
cobra-cli add <my-new-command>
210+
```
211+
212+
alternatively you can specify the parent command
213+
214+
```bash
215+
cobra-cli add <my-new-command> -p '<parent>Cmd'
216+
```
217+

0 commit comments

Comments
 (0)