From 408676c80e3fa37e3794584b12e73c2060cfa55f Mon Sep 17 00:00:00 2001 From: Abhishek Balam Date: Wed, 9 Sep 2020 19:38:18 +0530 Subject: [PATCH] fix: removed force renewal as it would extend by 3 months every month, now the job runs daily --- bench/config/lets_encrypt.py | 4 ++-- bench/patches/v5/fix_letsencrypt_renew_frequency.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bench/config/lets_encrypt.py b/bench/config/lets_encrypt.py index f9e596e0..bea1b86b 100755 --- a/bench/config/lets_encrypt.py +++ b/bench/config/lets_encrypt.py @@ -86,11 +86,11 @@ def run_certbot_and_setup_ssl(site, custom_domain, bench_path, interactive=True) def setup_crontab(): - job_command = '/opt/certbot-auto renew --force-renewal -a nginx --post-hook "systemctl reload nginx"' + job_command = '/opt/certbot-auto renew -a nginx --post-hook "systemctl reload nginx"' system_crontab = CronTab(user='root') if job_command not in str(system_crontab): job = system_crontab.new(command=job_command, comment="Renew lets-encrypt every month") - job.setall('0 0 1 * *') # Run at 00:00 on every day-of-month 1 + job.setall('0 0 */1 * *') # Run at 00:00 every day-of-month system_crontab.write() diff --git a/bench/patches/v5/fix_letsencrypt_renew_frequency.py b/bench/patches/v5/fix_letsencrypt_renew_frequency.py index 61b82111..73806c54 100644 --- a/bench/patches/v5/fix_letsencrypt_renew_frequency.py +++ b/bench/patches/v5/fix_letsencrypt_renew_frequency.py @@ -7,13 +7,13 @@ def execute(bench_path): This patch fixes a cron job that would renew letsencrypt certificate """ - job_command = '/opt/certbot-auto renew --force-renewal -a nginx --post-hook "systemctl reload nginx"' + job_command = '/opt/certbot-auto renew -a nginx --post-hook "systemctl reload nginx"' system_crontab = CronTab(user='root') job_comment = "Renew lets-encrypt every month" - for job in system_crontab.find_comment(job_comment) + for job in system_crontab.find_comment(job_comment): system_crontab.remove(job) job = system_crontab.new(command=job_command, comment=job_comment) - job.setall('0 0 1 * *') # Run at 00:00 on every day-of-month 1 + job.setall('0 0 */1 * *') # Run at 00:00 every day-of-month system_crontab.write() break