in theory make LE work

This commit is contained in:
Matthew Hodgson
2024-11-08 10:19:32 +00:00
parent 78fd054943
commit 483f71d58f
16 changed files with 32 additions and 50 deletions

View File

@@ -8,10 +8,10 @@ if ! [ -x "$(command -v docker-compose)" ]; then
fi
. .env
domains=($DOMAIN $HOMESERVER_FQDN $ELEMENT_FQDN $CALL_FQDN $MAS_FQDN)
domains=$DOMAINS
rsa_key_size=4096
data_path="./data/certbot"
email="" # Adding a valid address is strongly recommended
read -p "admin email address for letsencrypt: " email
staging=0 # Set to 1 if you're testing your setup to avoid hitting request limits
if [ -d "$data_path" ]; then
@@ -21,26 +21,26 @@ if [ -d "$data_path" ]; then
fi
fi
if [ ! -e "$data_path/conf/options-ssl-nginx.conf" ] || [ ! -e "$data_path/conf/ssl-dhparams.pem" ]; then
if [ ! -e "data/ssl/options-ssl-nginx.conf" ] || [ ! -e "data/ssl/ssl-dhparams.pem" ]; then
echo "### Downloading recommended TLS parameters ..."
mkdir -p "$data_path/conf"
curl -s https://raw.githubusercontent.com/certbot/certbot/master/certbot-nginx/certbot_nginx/_internal/tls_configs/options-ssl-nginx.conf > "$data_path/conf/options-ssl-nginx.conf"
curl -s https://raw.githubusercontent.com/certbot/certbot/master/certbot/certbot/ssl-dhparams.pem > "$data_path/conf/ssl-dhparams.pem"
curl -s https://raw.githubusercontent.com/certbot/certbot/master/certbot-nginx/certbot_nginx/_internal/tls_configs/options-ssl-nginx.conf > "data/ssl/options-ssl-nginx.conf"
curl -s https://raw.githubusercontent.com/certbot/certbot/master/certbot/certbot/ssl-dhparams.pem > "data/ssl/ssl-dhparams.pem"
echo
fi
echo "### Creating dummy certificate for $domains ..."
# N.B. in bash, $domains will return the first value of the array in string context, so this is not a bug:
path="/etc/letsencrypt/live/$domains"
mkdir -p "$data_path/conf/live/$domains"
docker-compose run --rm --entrypoint "\
openssl req -x509 -nodes -newkey rsa:$rsa_key_size -days 1\
-keyout '$path/privkey.pem' \
-out '$path/fullchain.pem' \
-subj '/CN=localhost'" certbot
-subj '/CN=localhost'; \
cp /etc/ssl/certs/ca-certificates.crt '$path'" certbot
echo
echo "### Starting nginx ..."
docker-compose up --force-recreate -d nginx
echo