From 8671a80b7470b584af8bac89ed1bd56c9a493d56 Mon Sep 17 00:00:00 2001 From: Dylan Vos Date: Sat, 9 Nov 2024 14:10:01 +0100 Subject: [PATCH] #56 prototyped manual-auth-hook and different `preferred-challenges` support --- src/functions/__init__.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/functions/__init__.py b/src/functions/__init__.py index 1b3b1c0..56d8bdf 100644 --- a/src/functions/__init__.py +++ b/src/functions/__init__.py @@ -285,6 +285,8 @@ class Certbot: self.eab_hmac_key = self.set_eab_hmac_key(env["certbot"]["eab_hmac_key"]) self.freeze_issue = {} self.retry_count = env["certbot"]["retry_count"] + self.certbot_preferred_challenges = env["certbot"]["preferred_challenges"] or "http" + self.certbot_manual_auth_hook = env["certbot"]["manual_auth_hook"] or False @staticmethod def set_acme_server(acme_server): @@ -337,9 +339,7 @@ class Certbot: renew_certs.append(host_arg) certbot_certonly = ('/usr/bin/certbot certonly {acme_server}' - ' --standalone' - ' --preferred-challenges http' - ' --http-01-port 2080' + ' --preferred-challenges {challenge}' ' --agree-tos' ' --issuance-timeout 90' ' --no-eff-email' @@ -350,9 +350,18 @@ class Certbot: eab_hmac_key=self.eab_hmac_key, certs=' '.join(request_certs), email=self.email, + challenge=self.certbot_preferred_challenges, acme_server=self.acme_server) ) + if 'http' in self.certbot_preferred_challenges: + certbot_certonly += (' --http-01-port 2080' + ' --standalone' + ) + + if self.certbot_manual_auth_hook != False: + certbot_certonly += ' --manual --manual-auth-hook \'{hook}\''.format(hook=self.certbot_manual_auth_hook) + ret_reload = False return_code_issue = 0 return_code_renew = 0