Skip to content

Commit

Permalink
Certbot script update
Browse files Browse the repository at this point in the history
  • Loading branch information
Vooperino authored Jun 17, 2024
1 parent e0b2a40 commit 9c891e1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
7 changes: 4 additions & 3 deletions core_files/scripts/letsencrypt/createLetsEncryptCert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,14 @@ if ! checkDir $sslDirPath; then
mkdir -p $sslDirPath
fi

CLOUDFLARE_OPTS=""
WEBROOT_OPTS="--webroot --webroot-path $certStuffRoot"
if [ -d "/cloudflare-account.ini" ]; then
CLOUDFLARE_OPTS+="--dns-cloudflare --dns-cloudflare-credentials /cloudflare-account.ini"
echo "Using CloudFlare API for DNS"
WEBROOT_OPTS="--dns-cloudflare --dns-cloudflare-credentials /cloudflare-account.ini"
fi

echo "Creating a cert for ${1}"
certbot certonly --config-dir $sslDirPath --webroot --webroot-path $certStuffRoot $CLOUDFLARE_OPTS -n --agree-tos --register-unsafely-without-email -d ${1}
certbot certonly --config-dir $sslDirPath $WEBROOT_OPTS -n --agree-tos --register-unsafely-without-email -d ${1}
if [ $? -ne 0 ]; then
echo "[Failure] Unable to create certificate '${1}' due to an error"
exit 1
Expand Down
9 changes: 5 additions & 4 deletions core_files/scripts/letsencrypt/renewAllCert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ if ! checkDir $certStuffRoot; then
fi

if ! checkDir $sslDirPath; then
echo "Creating ssl folder"
echo "Creating SSL folder"
mkdir -p $sslDirPath
fi

Expand All @@ -26,9 +26,10 @@ if ! checkFile $logFile; then
touch $logFile
fi

CLOUDFLARE_OPTS=""
WEBROOT_OPTS="--webroot --webroot-path $certStuffRoot"
if [ -d "/cloudflare-account.ini" ]; then
CLOUDFLARE_OPTS+="--dns-cloudflare --dns-cloudflare-credentials /cloudflare-account.ini"
echo "Using CloudFlare API for DNS"
WEBROOT_OPTS="--dns-cloudflare --dns-cloudflare-credentials /cloudflare-account.ini"
fi

certbot renew $CLOUDFLARE_OPTS --config-dir $sslDirPath --webroot --webroot-path $certStuffRoot >> /scripts/letsencrypt/letsencrypt-renew.log
certbot renew --config-dir $sslDirPath $WEBROOT_OPTS >> /scripts/letsencrypt/letsencrypt-renew.log

0 comments on commit 9c891e1

Please sign in to comment.