Skip to content

Instantly share code, notes, and snippets.

@matinrco
Last active January 25, 2018 17:06
Show Gist options
  • Save matinrco/64e015ca6c314c192366b9d7c102105b to your computer and use it in GitHub Desktop.
Save matinrco/64e015ca6c314c192366b9d7c102105b to your computer and use it in GitHub Desktop.
Let’s Encrypt - issue certificates with certbot-auto and renew how to
#this file is not ready for execution
#go to /opt to download certbot-auto
cd /opt
wget https://dl.eff.org/certbot-auto
#correct permissions
chmod a+x certbot-auto
#stop nginx or other webserver temporary to free 443 port
service nginx stop
#issue a certificate from CA
/opt/certbot-auto certonly -n --standalone -d test.example.com -m me@example.com --agree-tos
#to renew all certificates (optional --force-renewal)
/opt/certbot-auto renew --quiet --no-self-upgrade --force-renewal --pre-hook 'service nginx stop' --post-hook 'service nginx start && service postfix reload && service dovecot reload'
#to manually renew
/opt/certbot-auto renew
#to list all certificates
/opt/certbot-auto certificates
#add it as cron job in /etc/cron.d/letsencrypt with following content
0 */12 * * * root /opt/certbot-auto renew --quiet --no-self-upgrade --force-renewal --pre-hook 'service nginx stop' --post-hook 'service nginx start && service postfix reload && service dovecot reload'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment