Skip to content

Commit

Permalink
feat: Add (m)TLS
Browse files Browse the repository at this point in the history
This commit adds the option to configure TLS or mTLS on the server.

There is also a script to generate certs for testing which can be found
at `hack/scripts/gen_local_certs.sh`.

To manually test I did the following:
```
./hack/scripts/gen_local_certs.sh all --host localhost --cfssl $(which
ssl --cfssljson $(which cfssljson)

make build
sudo ./bin/flintlockd run \
  --containerd-socket=/run/containerd-dev/containerd.sock \
  --parent-iface="${NET_DEVICE}" \
  --grpc-endpoint=localhost:9091 \
  --tls-cert localhost/localhost.pem \
  --tls-key localhost/localhost-key.pem \
  --tls-client-ca localhost/intermediate-ca.pem \
  --tls-client-validate
```

I added `localhost/liquidmetalclient1.pem`  and the ca to `hammertime`,
and verified that the request failed without the certs.

On start, flintlockd will log whether TLS is enabled or disabled:
```
...
INFO[0000] flintlockd, version=undefined, built_on=undefined, commit=undefined
INFO[0000] flintlockd grpc api server starting
WARN[0000] basic authentication is DISABLED
INFO[0000] TLS is enabled
INFO[0000] starting microvm controller
INFO[0000] starting microvm controller with 1 workers    controller=microvm
...
```

There are unit tests for the validation, but to test that the certs have
been wired in to the server properly, I will need to add some e2e layer
testing. I am going to tackle that in another ticket.

Co-authored-by: Richard Case <richard@weave.works>
  • Loading branch information
Callisto13 and richardcase committed Jun 21, 2022
1 parent b4cb1b7 commit 9a5de2f
Show file tree
Hide file tree
Showing 11 changed files with 1,032 additions and 14 deletions.
5 changes: 3 additions & 2 deletions docs/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,8 @@ NET_DEVICE=$(ip route show | awk '/default/ {print $5}')

sudo ./bin/flintlockd run \
--containerd-socket=/run/containerd-dev/containerd.sock \
--parent-iface="${NET_DEVICE}"
--parent-iface="${NET_DEVICE}" \
--insecure
```

If you're running `flintlockd` from within a Vagrant VM, or anywhere different
Expand Down Expand Up @@ -330,7 +331,7 @@ There are both GUI and a CLI option.
### hammertime

[Hammertime](https://github.com/Callisto13/hammertime) is a cli client built
with the soel purpose of interacting with Flintlock services.
with the sole purpose of interacting with Flintlock services.

### grpc-client-cli

Expand Down
Loading

0 comments on commit 9a5de2f

Please sign in to comment.