set -e
# Ensure we have a mail address as argument.
-if [ $# -lt 1 ]; then
- echo "Need mail address as argument."
+if [ $# -lt 2 ]; then
+ echo "Need target domain and mail address as argument."
false
fi
-mail_address="$1"
+domain="$1"
+mail_address="$2"
# If port 80 blocked by iptables, open it.
set +e
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 "${domain}"
# Remove iptables rule to open port 80 if we added it.
if [ "${open_iptables}" -eq "1" ]; then