Updated the script to prompt for a email address to use with letsencrypt and sets --agree-tos and --no-eff-email

This commit is contained in:
2026-05-03 12:18:35 +01:00
parent 29e94dec93
commit 46d7553017
+15 -3
View File
@@ -18,6 +18,14 @@ if [[ -z "$DOMAIN" ]]; then
exit 1
fi
# Ask for email (NEW)
read -p "Enter email address for Let's Encrypt notifications: " EMAIL
if [[ -z "$EMAIL" ]]; then
echo "Email cannot be empty"
exit 1
fi
# Ask for Cloudflare API token/key
read -p "Enter your Cloudflare API Token/Key: " CF_API_KEY
@@ -32,9 +40,9 @@ apt install -y python3 python3-dev python3-venv libaugeas-dev gcc
echo "Setting up virtual environment..."
python3 -m venv /opt/certbot/
/opt/certbot/bin/pip install --upgrade pip
/opt/certbot/bin/pip install certbot
/opt/certbot/bin/pip install certbot-dns-cloudflare
/opt/certbot/bin/pip install --upgrade pip
/opt/certbot/bin/pip install certbot
/opt/certbot/bin/pip install certbot-dns-cloudflare
# Symlink certbot
ln -sf /opt/certbot/bin/certbot /usr/bin/certbot
@@ -51,6 +59,10 @@ chmod 600 /root/certbot-cloudflare/cloudflare.ini
echo "Requesting certificate for $DOMAIN ..."
certbot certonly \
--non-interactive \
--agree-tos \
--no-eff-email \
--email "$EMAIL" \
--dns-cloudflare \
--dns-cloudflare-credentials /root/certbot-cloudflare/cloudflare.ini \
-d "$DOMAIN"