diff --git a/wo/core/acme.py b/wo/core/acme.py index 7fbfa06..2605468 100644 --- a/wo/core/acme.py +++ b/wo/core/acme.py @@ -9,6 +9,7 @@ from wo.core.logging import Log from wo.core.shellexec import WOShellExec, CommandExecutionError from wo.core.variables import WOVar from wo.core.template import WOTemplate +from wo.core.checkfqdn import WOFqdn class WOAcme: @@ -181,10 +182,10 @@ class WOAcme: def check_dns(self, acme_domains): """Check if a list of domains point to the server IP""" - server_ip = requests.get('https://v4.wordops.eu/').text + server_ip = WOFqdn.get_server_ip(self) for domain in acme_domains: - domain_ip = requests.get('http://v4.wordops.eu/dns/{0}/' - .format(domain)).text + domain_ip = WOFqdn.get_domain_ip(self, domain) + if (not domain_ip == server_ip): Log.warn( self, "{0}".format(domain) + diff --git a/wo/core/checkfqdn.py b/wo/core/checkfqdn.py index d154e50..d089cd7 100644 --- a/wo/core/checkfqdn.py +++ b/wo/core/checkfqdn.py @@ -51,3 +51,14 @@ class WOFqdn: except requests.exceptions.RequestException as e: print("Error occurred during request:", e) return None + + def get_domain_ip(self, wo_domain): + """Get the server externet IP""" + try: + y = requests.get('http://v4.wordops.eu/dns/{0}/'.format(wo_domain)) + domain_ip = (y.text).strip() + + return domain_ip + except requests.exceptions.RequestException as e: + print("Error occurred during request:", e) + return None