Skip to content

Instantly share code, notes, and snippets.

@leeyc0
Last active March 27, 2023 13:43
Show Gist options
  • Save leeyc0/a8eaf0c50638d2cdb6707ad0377764d1 to your computer and use it in GitHub Desktop.
Save leeyc0/a8eaf0c50638d2cdb6707ad0377764d1 to your computer and use it in GitHub Desktop.
patch certbot_dns_ovh to follow CNAME
--- certbot_dns_ovh/_internal/dns_ovh.py.orig 2023-03-27 12:48:43.913613478 +0000
+++ certbot_dns_ovh/_internal/dns_ovh.py 2023-03-27 13:20:36.651115194 +0000
@@ -7,6 +7,8 @@
from lexicon.providers import ovh
from requests import HTTPError
+import dns.resolver
+
from certbot import errors
from certbot.plugins import dns_common
from certbot.plugins import dns_common_lexicon
@@ -29,6 +31,8 @@
def __init__(self, *args: Any, **kwargs: Any) -> None:
super().__init__(*args, **kwargs)
self.credentials: Optional[CredentialsConfiguration] = None
+ self.resolver = dns.resolver.Resolver(configure = False)
+ self.resolver.nameservers = ["8.8.8.8"]
@classmethod
def add_parser_arguments(cls, add: Callable[..., None],
@@ -54,12 +58,14 @@
.format(TOKEN_URL),
}
)
-
+
def _perform(self, domain: str, validation_name: str, validation: str) -> None:
- self._get_ovh_client().add_txt_record(domain, validation_name, validation)
+ validation_name = self.resolver.canonical_name(validation_name).to_text().rstrip(".")
+ self._get_ovh_client().add_txt_record(validation_name, validation_name, validation)
def _cleanup(self, domain: str, validation_name: str, validation: str) -> None:
- self._get_ovh_client().del_txt_record(domain, validation_name, validation)
+ validation_name = self.resolver.canonical_name(validation_name).to_text().rstrip(".")
+ self._get_ovh_client().del_txt_record(validation_name, validation_name, validation)
def _get_ovh_client(self) -> "_OVHLexiconClient":
if not self.credentials: # pragma: no cover
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment