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