diff --git a/templates/pdns-letsencrypt.py.j2 b/templates/pdns-letsencrypt.py.j2 index 019fa4a..6ce855e 100644 --- a/templates/pdns-letsencrypt.py.j2 +++ b/templates/pdns-letsencrypt.py.j2 @@ -27,7 +27,8 @@ def get_challenge(db, path): def add_challenge(db, path, value): c = db.cursor() - c.execute('REPLACE INTO challenges (q, value) VALUES(?, ?)', (path,value,)) + c.execute('INSERT INTO challenges (q, value) VALUES(?, ?)', (path,value,)) + c.execute("DELETE FROM challenges WHERE timestamp < strftime('%s', datetime('now','-2 day'))") db.commit() def main_query():