new sslproxy xai cli commands for build, deploy, rollback

This commit is contained in:
2020-05-30 09:43:40 -04:00
parent 10b5a1e012
commit 73ad921e3b
27 changed files with 482 additions and 34 deletions

View File

@@ -0,0 +1,36 @@
#!/usr/bin/env bash
set -e
echo -e "\033[36mCreate\033[39m: self-signed certificates"
CERTS_DIR=letsencrypt/live/xai-corp.net
function make_cert() {
mkdir -p $CERTS_DIR
openssl req -x509 -nodes -days 365 -newkey rsa:2048 -batch \
-keyout $CERTS_DIR/privkey.pem \
-out $CERTS_DIR/fullchain.pem \
-config certs/localhost.conf
#tell chrome to trust the cert
certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n "www.xai-corp.net" -i $CERTS_DIR/fullchain.pem
}
function test_cert() {
ls -l $CERTS_DIR | grep privkey.pem
ls -l $CERTS_DIR | grep fullchain.pem
}
function trap_exit() {
code=$?
if [ $code -gt 0 ]; then
echo
echo -e "\033[31mFailed to create certificates\033[39m"
exit $code
fi
}
trap trap_exit EXIT
# RUN
make_cert && test_cert