Skip to content

Commit

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

CLOUDFLARE_OPTS=""
if [ -d "/cloudflare-account.ini" ]; then
CLOUDFLARE_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 -n --agree-tos --register-unsafely-without-email -d ${1}
echo "End of script have a nice day! Enjoy you're new cert if it was created"
certbot certonly --config-dir $sslDirPath --webroot --webroot-path $certStuffRoot $CLOUDFLARE_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
else
echo "End of script have a nice day! Enjoy you're new cert if it was created"
exit 0
fi
7 changes: 6 additions & 1 deletion core_files/scripts/letsencrypt/renewAllCert.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,9 @@ if ! checkFile $logFile; then
touch $logFile
fi

/usr/bin/letsencrypt renew --config-dir $sslDirPath --webroot --webroot-path $certStuffRoot >> /scripts/letsencrypt/letsencrypt-renew.log
CLOUDFLARE_OPTS=""
if [ -d "/cloudflare-account.ini" ]; then
CLOUDFLARE_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
2 changes: 1 addition & 1 deletion install/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
apt-get update
apt-get full-upgrade -y

apt-get install -y curl wget gnupg neovim nano vim emacs apt-utils iftop iptraf wget git zip tar unzip bmon iptraf socat bash-completion certbot cron inetutils-ping software-properties-common ca-certificates lsb-release apt-transport-https python3 python2
apt-get install -y curl wget gnupg neovim nano vim emacs apt-utils iftop iptraf wget git zip tar unzip bmon iptraf socat bash-completion certbot cron inetutils-ping software-properties-common ca-certificates lsb-release apt-transport-https python3 python2 python3-certbot-dns-cloudflare

sh -c 'echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
wget -qO - https://packages.sury.org/php/apt.gpg | apt-key add -
Expand Down

0 comments on commit 7320cf4

Please sign in to comment.