No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

etc_cron-monthly_letsencrypt-renew 822B

1234567891011121314151617181920212223
  1. #!/bin/bash
  2. # Renew all live certificates with LetsEncrypt. This needs to run at least
  3. # once every three months.
  4. # Given a certificate file returns "domain1,domain2"
  5. # https://community.letsencrypt.org/t/help-me-understand-renewal-config/7115
  6. function getDomains() {
  7. openssl x509 -text -in "$1" |
  8. grep -A1 "Subject Alternative Name:" | tail -n1 |
  9. tr -d ' ' | tr -d 'DNS:'
  10. }
  11. service apache2 stop
  12. for c in `ls /etc/letsencrypt/live`; do
  13. domains=$(getDomains /etc/letsencrypt/live/$c/cert.pem)
  14. /root/letsencrypt/letsencrypt-auto --renew certonly -c /etc/letsencrypt/cli.conf --domains=$domains
  15. done
  16. service apache2 start
  17. # Services that rely on LE certificates will need restarted. In some cases
  18. # their certificates are based on copies of the LE certs and will need
  19. # regenerated as well.