diff --git a/src/hostinfo/named.py b/src/hostinfo/named.py
index 46b4eb7d4cd0df709a813f73170236403cf0bc14..89ad26cdd830a9dc8bedbbb031a93a98832681d9 100755
--- a/src/hostinfo/named.py
+++ b/src/hostinfo/named.py
@@ -360,6 +360,12 @@ def generate_forward(tree, hosts, domains):
for c in tree._subnet_._cname_:
result[c.domain[1]].add_host(c.alias[0], c.ttl[0], 'CNAME', c.name[0])
pass
+
+ # Add _acme-challenge cname's
+ for domain, name, ttl, cname in acme_challenge_cname(tree):
+ result[domain].add_host('_acme-challenge.%s' % name, ttl, 'CNAME', cname)
+ pass
+
# Add mx hosts
for m in tree._host_._interface_._mailhost_:
# Force generation of domain file even if only mailhost present
@@ -505,4 +511,16 @@ def get_hosts(tree, with_alias=True):
pass
return result
-
+def acme_challenge_cname(tree):
+ for acme in tree._host_._interface_._acme_:
+ for ip in util.chain(acme._parent._ip_, acme._parent._ipv6_):
+ address = util.address(ip)
+ subnet = util.subnet(tree, address)
+ for name, ttl in util.chain([ (ip.name[0:], ip.ttl[0:]) ],
+ [ (a.name[0:], a.ttl[0:]) for a in ip._alias_ ]):
+ yield subnet.domain[0:], name, ttl, acme.challenge[0]
+ pass
+ pass
+ pass
+ pass
+