mirror of
https://github.com/outbackdingo/labca.git
synced 2026-01-27 02:19:27 +00:00
25 lines
858 B
Bash
Executable File
25 lines
858 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
cd /etc/nginx/ssl
|
|
echo >> certbot.log
|
|
date >> certbot.log
|
|
|
|
set +e
|
|
curve_count=$(openssl pkey -pubin -in /opt/boulder/labca/certs/webpki/issuer-01-pubkey.pem -text | grep -i curve | wc -l)
|
|
set -e
|
|
keytype=ecdsa
|
|
[ "$curve_count" == "0" ] && keytype=rsa || /bin/true
|
|
|
|
email=$(grep "\"email\":" /opt/labca/data/config.json | grep -v " {" | cut -d ":" -f 2 | sed -e "s/[\", ]*//g")
|
|
fqdn=$(grep "\"fqdn\":" /opt/labca/data/config.json | grep -v " {" | cut -d ":" -f 2 | sed -e "s/[\", ]*//g")
|
|
|
|
certbot certonly --agree-tos --config-dir $(pwd) -d $fqdn --email $email --key-type $keytype -n --server http://boulder:4001/directory --webroot --webroot-path /var/www/html >> certbot.log 2>&1 || exit 1
|
|
|
|
ln -sf live/$fqdn/fullchain.pem labca_cert.pem
|
|
ln -sf live/$fqdn/privkey.pem labca_key.pem
|
|
|
|
cd /opt/boulder
|
|
docker compose restart nginx
|