katefike / sage

A personal finance app that's like Mint, but better. It uses a dockerized postfix/dovecot email server. Parses transaction data from alert emails.
MIT License
5 stars 0 forks source link

Refactor automated TLS renewal #117

Closed katefike closed 7 months ago

katefike commented 7 months ago

Testing

kfike@prod:~/sage$ sudo bash docker/certbot/get_certs.sh 
Expiration date: Wed Dec 13 02:20:04 UTC 2023
Renewal date: Mon Nov 13 02:20:04 UTC 2023
The TLS cert is expires on Wed Dec 13 02:20:04 UTC 2023. Renewing in a dry-run...
Saving debug log to /var/log/letsencrypt/letsencrypt.log

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Processing /etc/letsencrypt/renewal/prod.sagefinancial.dev.conf
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Simulating renewal of an existing certificate for prod.sagefinancial.dev

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Congratulations, all simulated renewals succeeded: 
  /etc/letsencrypt/live/prod.sagefinancial.dev/fullchain.pem (success)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Copying TLS certs to sage-mailserver Docker container...
Successfully copied 7.17kB to sage-mailserver:/etc/letsencrypt/archive/prod.sagefinancial.dev/fullchain1.pem
Successfully copied 2.05kB to sage-mailserver:/etc/letsencrypt/archive/prod.sagefinancial.dev/privkey1.pem
Restarting the sage-mailserver Docker container...

kfike@prod:~/sage$ sudo crontab -l
#Ansible: Get TLS certs
#* * * * * /usr/bin/env bash -c "date; . /home/kfike/sage/docker/certbot/get_certs.sh >> /var/log/certbot_cronjob.log 2>&1"

kfike@prod:~/sage$ sudo crontab -l
#Ansible: Get TLS certs or renew at midnight every day
0 0 * * * /usr/bin/env bash -c "date; . /home/kfike/sage/docker/certbot/get_certs.sh >> /var/log/certbot_cronjob.log 2>&1"

Resources

https://eff-certbot.readthedocs.io/en/latest/using.html#setting-up-automated-renewal