Add config and makefile command to generate CA and client/server certs.

This commit is contained in:
Mariano Uvalle 2021-08-11 18:28:38 -05:00
parent 0d71b5abfb
commit d03afcfd50
5 changed files with 93 additions and 0 deletions

View file

@ -1,3 +1,31 @@
CONFIG_PATH=${HOME}/.proglog/
.PHONY: init
init:
mkdir -p ${CONFIG_PATH}
.PHONY: gencert
gencert:
cfssl gencert \
-initca certs/ca-csr.json | cfssljson -bare ca
cfssl gencert \
-ca=ca.pem \
-ca-key=ca-key.pem \
-config=certs/ca-config.json \
-profile=server \
certs/server-csr.json | cfssljson -bare server
cfssl gencert \
-ca=ca.pem \
-ca-key=ca-key.pem \
-config=certs/ca-config.json \
-profile=client \
certs/client-csr.json | cfssljson -bare client
mv *.pem *.csr ${CONFIG_PATH}
.PHONY: compile
compile:
protoc api/v1/*.proto \
--go_out=. \
@ -6,5 +34,6 @@ compile:
--go-grpc_opt=paths=source_relative \
--proto_path=.
.PHONY: test
test:
go test -race ./...