4 # Ensure we have a mail address as argument.
6 echo "Need target domain and mail address as argument."
12 # If port 80 blocked by iptables, open it.
14 iptables -C INPUT -p tcp --dport 80 -j ACCEPT
17 if [ "${open_iptables}" -eq "1" ]; then
18 iptables -A INPUT -p tcp --dport 80 -j ACCEPT
21 # Create new certificate and copy it to /etc/letsencrypt.
22 certbot certonly --standalone --agree-tos -m "${mail_address}" -d "${domain}"
24 # Remove iptables rule to open port 80 if we added it.
25 if [ "${open_iptables}" -eq "1" ]; then
26 iptables -D INPUT -p tcp --dport 80 -j ACCEPT