Skip to content

Commit

Permalink
more documentation updates
Browse files Browse the repository at this point in the history
  • Loading branch information
3goats committed Feb 10, 2024
1 parent dbafd5c commit 50bbb06
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 12 deletions.
11 changes: 7 additions & 4 deletions config/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@ bootstrap:
url: https://api.venafi.cloud
auth:
privateKeyFile: /etc/firefly/private-key.pem
clientID: f531953f-c51c-11ee-aa38-62722f50b33a
clientID: a6498bb7-c804-11ee-bcff-7a10aefd838f
csr:
instanceNaming: Demo
server:
grpc:
uds:
socketPath: /opt/firefly/grpc.sock
rest:
port: 8281
tls:
dnsNames:
- firefly.venafi.example
ipAddress: 127.0.0.1
6 changes: 3 additions & 3 deletions config/private-key.pem
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-----BEGIN PRIVATE KEY-----
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgcIG8PWL/TJNsXDQh
JdkNl3ZRu4EBAc87HoYdOXuVJtGhRANCAARhSwH6nAhxmkyr6inAHdtUwS4X8EPN
03Ge9G72kK5CrrrgHO9I8wvzqoQowrHUxWk3ibzgMuoqSRxDzmgA54eV
MIGHAgEAMBMGByqGSM49AgEGCCqGSM49AwEHBG0wawIBAQQgto8qvBuEP3mdbObG
btclw6jD9fGtGYPldLwCEMzb25mhRANCAASzq3PktfgkSQAkbS8Riy2tFUwsVGKL
X2vvjPiRtEsuAemT2Ve+zVUT4uhOmOHVnAZxsF8ecfy1Hog3FrkfdKZY
-----END PRIVATE KEY-----
114 changes: 109 additions & 5 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -283,10 +283,14 @@ token=$( curl -H "Content-Type: application/x-www-form-urlencoded" \
-k -s | jq -r '.access_token' )
```
You can decode and see the JWT content using the `jq` command line. e.g.
You can decode and see the JWT content using a nifty trick with the `jq` command. e.g.
```bash title="JQ Usage to decode JWT"
$echo ${token} | jq -R 'split(".") | .[0],.[1] | @base64d | fromjson'
echo ${token} | jq -R 'split(".") | .[0],.[1] | @base64d | fromjson'
```
```bash title="Output"

{
"alg": "ES256",
Expand Down Expand Up @@ -330,14 +334,114 @@ csr=$( jq -n --arg string "$tmp" '$string' | tr -d '"' )
### Step 5 - Request a certificate
Now that we both a JWT and a CSR we can make a request to our Firefly instance.
Now that we have both a JWT and a CSR we can make a request to our Firefly instance.
The following cURL command sends a simple JSON data structure to Firefly that contains the CSR and a reference to the policy that will be used to fulfill the certificate request. The policy reference must correspond to one of the `venafi-firefly.allowedPolicies` within the JWT.
```bash title="cURL Usage to request certificate"
curl --location 'https://localhost:8289/v1/certificatesigningrequest' \
curl 'https://localhost:8289/v1/certificatesigningrequest' \
--header 'Content-Type: application/json' \
-H "Authorization: Bearer $token" \
--data '{
"request": "'"$csr"'",
"policyName": "Basic Demo"
}' -k -s
```
```
You should see output similar to the following. Note: The response includes the following certificates which are returned in the order listed:
* The entity/leaf certificate itself
* The intermediate certificate for the `Firefly SubCA` used to sign the requested entity/leaf certificate
* The intermediate/SubCa certificate for the`Sub CA Provider` as listed in the Venafi Control plane
```bash title="Truncated Output"
{"certificateChain":"-----BEGIN CERTIFICATE-----\nMIICgDCCAiagAwIBAgIRAPVKH ....
```
???+ tip "Tip - Removing the JSON Formatting"
You can also use the `JQ` utility to reformat the certificate chain and remove the JSON encoding. To do this pipe the output to `JQ` and specifiy the `-r` for raw falg.
```bash title="Example"
curl --location 'https://localhost:8289/v1/certificatesigningrequest' \
--header 'Content-Type: application/json' \
-H "Authorization: Bearer $token" \
--data '{
"request": "'"$csr"'",
"policyName": "Basic Demo"
}' -k -s | jq -r .certificateChain
```
This will produce a PEM output that will probably be more useful and can be used directly by your applications.
```bash title="Example PEM Output"
-----BEGIN CERTIFICATE-----
MIICgDCCAiagAwIBAgIRALcojaIkJtPIm7suinBqQPgwCgYIKoZIzj0EAwIwFjEU
MBIGA1UEAxMLRGVtbyBJc3N1ZXIwHhcNMjQwM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