#! /bin/bash
set -e
# Create certs for jwtproxy to mitm outgoing TLS connections
echo '{"CN":"CA","key":{"algo":"rsa","size":2048}}' | cfssl gencert -initca - | cfssljson -bare mitm
cp mitm-key.pem /conf/mitm.key
cp mitm.pem /conf/mitm.cert
cp mitm.pem /usr/local/share/ca-certificates/mitm.crt
# Add extra trusted certificates
if [ -d /conf/stack/extra_ca_certs ]; then
cp /conf/stack/extra_ca_certs/* /usr/local/share/ca-certificates/
fi
update-ca-certificates