Skip to content

Commit f4434cc

Browse files
committed
adding client directory and pk8 key option
1 parent 69bf8ee commit f4434cc

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

example-secure/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,11 @@ docker exec -ti roach-1 /bin/bash
3737
docker exec -ti roach-2 /bin/bash
3838
docker exec -ti lb /bin/sh
3939
docker exec -ti roach-cert /bin/sh
40+
```
41+
42+
### Copy Client Certificate and Key
43+
```bash
44+
docker cp roach-cert:/certs/client/client.root.crt .
45+
docker cp roach-cert:/certs/client/client.root.key .
46+
docker cp roach-cert:/certs/client/client.root.key.pk8 .
4047
```

example-secure/roach-cert/Dockerfile

+6-5
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,27 @@ RUN cockroach cert create-ca --certs-dir=/tmp/certs/ca --ca-key=/tmp/safe/ca.key
4040
&& cp -v /tmp/certs/ca/ca.crt /tmp/certs/roach-1 \
4141
&& cp -v /tmp/certs/ca/ca.crt /tmp/certs/roach-2
4242

43-
RUN cockroach cert create-client root --certs-dir=/tmp/certs/client --ca-key=/tmp/safe/ca.key
43+
RUN cockroach cert create-client root --certs-dir=/tmp/certs/client --ca-key=/tmp/safe/ca.key --also-generate-pkcs8-key
4444

4545
RUN cp -v /tmp/certs/client/client.* /tmp/certs/roach-0 \
4646
&& cp -v /tmp/certs/client/client.* /tmp/certs/roach-1 \
4747
&& cp -v /tmp/certs/client/client.* /tmp/certs/roach-2
4848

49-
RUN cockroach cert create-node roach-0 --certs-dir=/tmp/certs/roach-0 --ca-key=/tmp/safe/ca.key
50-
RUN cockroach cert create-node roach-1 --certs-dir=/tmp/certs/roach-1 --ca-key=/tmp/safe/ca.key
51-
RUN cockroach cert create-node roach-2 --certs-dir=/tmp/certs/roach-2 --ca-key=/tmp/safe/ca.key
49+
RUN cockroach cert create-node roach-0 localhost lb --certs-dir=/tmp/certs/roach-0 --ca-key=/tmp/safe/ca.key
50+
RUN cockroach cert create-node roach-1 localhost lb --certs-dir=/tmp/certs/roach-1 --ca-key=/tmp/safe/ca.key
51+
RUN cockroach cert create-node roach-2 localhost lb --certs-dir=/tmp/certs/roach-2 --ca-key=/tmp/safe/ca.key
5252

5353
# Stage 2 - share certs
5454

5555
FROM alpine:latest
5656

5757
LABEL maintainer="[email protected]"
5858

59-
RUN mkdir -pv /certs/roach-0 /certs/roach-1 /certs/roach-2
59+
RUN mkdir -pv /certs/roach-0 /certs/roach-1 /certs/roach-2 /certs/client
6060

6161
COPY --from=generator /tmp/certs/roach-0/* /certs/roach-0/
6262
COPY --from=generator /tmp/certs/roach-1/* /certs/roach-1/
6363
COPY --from=generator /tmp/certs/roach-2/* /certs/roach-2/
64+
COPY --from=generator /tmp/certs/client/* /certs/client/
6465

6566
CMD tail -f /dev/null

0 commit comments

Comments
 (0)