#!/bin/bash
set -euxo pipefail

ca_key="ca.key"
ca_pem="ca.pem"

# generate CA cert
cfssl gencert -initca ca-csr.json | cfssljson -bare ca
cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=client client-csr.json | cfssljson -bare client
cfssl gencert -ca=ca.pem -ca-key=ca-key.pem -config=ca-config.json -profile=server server-csr.json | cfssljson -bare server
rm -f *.csr ca-key.pem
