From a4daec3fc1d0242fac8c19956c586b480eeb5167 Mon Sep 17 00:00:00 2001 From: Kishi85 Date: Mon, 25 Mar 2019 19:25:33 +0100 Subject: [PATCH] acertmgr: fix initial certificate validity check --- acertmgr/__init__.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/acertmgr/__init__.py b/acertmgr/__init__.py index 6ddfd23..e6a75f4 100755 --- a/acertmgr/__init__.py +++ b/acertmgr/__init__.py @@ -151,9 +151,11 @@ def main(): # check certificate validity and obtain/renew certificates if needed for config in configs: cert_file = config['cert_file'] - - if not os.path.isfile(cert_file) or not tools.is_cert_valid(cert_file, config['ttl_days']): - cert_get(config) + cert_file_exists = os.path.isfile(cert_file) + if cert_file_exists: + cert = tools.read_pem_file(cert_file) + if not cert_file_exists or not tools.is_cert_valid(cert, config['ttl_days']): + cert_get(config) for cfg in config['actions']: if not tools.target_is_current(cfg['path'], cert_file):