Certbot example: standalone

From wikinotes
Revision as of 03:14, 2 May 2020 by Will (talk | contribs) (→‎Setup)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

If you aren't running a webserver, you can use the certbot standalone renewal. It will spin up it's own webserver just for the cert renewal.

Documentation

official docs https://certbot.eff.org/docs/using.html#standalone

Setup

Generate Certificate

certbot --standalone certonly \
    --domain yourdomain.com \
    --agree-tos \
    --no-eff-email

Cron job to rewnew SSL certificate (every 2 months, within 1hr of 6am)

0 6 1 */2 *  /usr/bin/bash -c 'sleep $[RANDOM\%60]m' && /usr/bin/certbot renew --agree-tos --no-eff-email