Skip to content

Commit

Permalink
letsencrypt: update call for port installed acme.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
msimerson committed Oct 19, 2024
1 parent f451f49 commit 7c5856d
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions provision/letsencrypt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ install_letsencrypt()
{
tell_status "installing ACME.sh & Let's Encrypt"
pkg install -y curl socat acme.sh

if [ ! -d "/root/.acme.sh" ]; then
mkdir "/root/.acme.sh"
fi
}

install_deploy_haproxy()
Expand Down Expand Up @@ -468,18 +472,18 @@ install_deploy_scripts()

update_haproxy_ssld()
{
if [ ! -d "$ZFS_DATA_MNT/haproxy" ]; then
# haproxy not installed, nothing to do
return
fi
if [ ! -d "$ZFS_DATA_MNT/haproxy" ]; then
# haproxy not installed, nothing to do
return
fi

local _haconf="$ZFS_DATA_MNT/haproxy/etc/haproxy.conf"
if ! grep -q 'ssl crt /etc' "$_haconf"; then
# already updated
return
fi

tell_status "switching haproxy TLS cert dir to /data/etc/tls.d"
tell_status "switching haproxy TLS cert dir to /data/etc/tls.d"
sed -i.bak \
-e 's!ssl crt /etc.*!ssl crt /data/etc/tls.d!' \
"$_haconf"
Expand All @@ -493,11 +497,11 @@ configure_letsencrypt()

local _HTTPDIR="$ZFS_DATA_MNT/webmail/htdocs"

acme.sh --set-default-ca --server letsencrypt
acme.sh --set-default-ca --server letsencrypt

if acme.sh --issue --force -d "$TOASTER_HOSTNAME" -w "$_HTTPDIR"; then
if acme.sh --issue --force -d "$TOASTER_HOSTNAME" -w "$_HTTPDIR"; then
update_haproxy_ssld
acme.sh --deploy -d "$TOASTER_HOSTNAME" --deploy-hook mailtoaster
acme.sh --deploy -d "$TOASTER_HOSTNAME" --deploy-hook mailtoaster
else
tell_status "TLS Certificate Issue failed"
exit 1
Expand Down

0 comments on commit 7c5856d

Please sign in to comment.