Fix acme domain IP validation with cname
This commit is contained in:
@@ -188,20 +188,8 @@ class WOAcme:
|
|||||||
"""Check if a list of domains point to the server IP"""
|
"""Check if a list of domains point to the server IP"""
|
||||||
server_ip = requests.get('https://v4.wordops.eu/').text
|
server_ip = requests.get('https://v4.wordops.eu/').text
|
||||||
for domain in acme_domains:
|
for domain in acme_domains:
|
||||||
url = (
|
domain_ip = requests.get('http://v4.wordops.eu/dns/{0}/'
|
||||||
"https://cloudflare-dns.com/dns-query?name={0}&type=A"
|
.format(domain)).text
|
||||||
.format(domain))
|
|
||||||
headers = {
|
|
||||||
'accept': 'application/dns-json'
|
|
||||||
}
|
|
||||||
try:
|
|
||||||
response = requests.get(url, headers=headers).json()
|
|
||||||
domain_ip = response["Answer"][0]['data']
|
|
||||||
except requests.RequestException:
|
|
||||||
Log.error(
|
|
||||||
self, 'Resolving domain IP failed.\n'
|
|
||||||
'The domain {0} do not exist or a DNS record is missing'
|
|
||||||
.format(domain))
|
|
||||||
if(not domain_ip == server_ip):
|
if(not domain_ip == server_ip):
|
||||||
Log.warn(
|
Log.warn(
|
||||||
self, "{0}".format(domain) +
|
self, "{0}".format(domain) +
|
||||||
|
|||||||
Reference in New Issue
Block a user