fi
mail_address="$1"
+# We need certbot to get LetsEncrypt certificates.
+apt install -y certbot
+
# If port 80 blocked by iptables, open it.
set +e
iptables -C INPUT -p tcp --dport 80 -j ACCEPT
fi
# Create new certificate and copy it to /etc/letsencrypt.
-certbot certonly --standalone --agree-tos -m "${mail}" -d "$(hostname -f)"
+certbot certonly --standalone --agree-tos -m "${mail_address}" -d "$(hostname -f)"
# Remove iptables rule to open port 80 if we added it.
if [ "${open_iptables}" -eq "1" ]; then