This commit is contained in:
mwiegand 2021-11-06 09:23:25 +01:00
parent 7cbc8e1029
commit 28a2b53a9d
3 changed files with 15 additions and 2 deletions

View file

@ -28,7 +28,7 @@ def acme_records(metadata):
h({ h({
'name': f"_acme-challenge{'.' if name else ''}{name}", 'name': f"_acme-challenge{'.' if name else ''}{name}",
'type': 'CNAME', 'type': 'CNAME',
'value': metadata.get('bind/acme_hostname'), 'value': f"{name}.{zone}.{metadata.get('bind/acme_hostname')}.",
}) })
for name in { for name in {
record['name'] if record['name'] != '@' else '' record['name'] if record['name'] != '@' else ''
@ -55,7 +55,7 @@ def acme_zone(metadata):
return { return {
'bind': { 'bind': {
'zones': { 'zones': {
metadata.get('bind/hostname'): { metadata.get('bind/acme_hostname'): {
'keys': ['acme'], 'keys': ['acme'],
'records': set(), 'records': set(),
}, },

View file

@ -14,6 +14,8 @@ else:
slave_ips = [] slave_ips = []
directories[f'/var/lib/bind'] = { directories[f'/var/lib/bind'] = {
'owner': 'bind',
'group': 'bind',
'purge': True, 'purge': True,
'needed_by': [ 'needed_by': [
'svc_systemd:bind9', 'svc_systemd:bind9',
@ -129,6 +131,8 @@ def record_matches_view(record, records, view):
for view in views: for view in views:
directories[f"/var/lib/bind/{view['name']}"] = { directories[f"/var/lib/bind/{view['name']}"] = {
'owner': 'bind',
'group': 'bind',
'purge': True, 'purge': True,
'needed_by': [ 'needed_by': [
'svc_systemd:bind9', 'svc_systemd:bind9',
@ -148,6 +152,7 @@ for view in views:
] ]
files[f"/var/lib/bind/{view['name']}/db.{zone}"] = { files[f"/var/lib/bind/{view['name']}/db.{zone}"] = {
'owner': 'bind',
'group': 'bind', 'group': 'bind',
'source': 'db', 'source': 'db',
'content_type': 'mako', 'content_type': 'mako',

View file

@ -1 +1,9 @@
https://github.com/dehydrated-io/dehydrated/wiki/example-dns-01-nsupdate-script https://github.com/dehydrated-io/dehydrated/wiki/example-dns-01-nsupdate-script
```
printf "server 127.0.0.1
zone acme.resolver.name.
update add _acme-challenge.ckn.li.acme.resolver.name. 600 IN TXT "hello"
send
" | nsupdate -y hmac-sha512:acme:Y9BHl85l352BGZDXa/vg90hh2+5PYe4oJxpkq/oQvIODDkW8bAyQSFr0gKQQxjyIOyYlTjf0MGcdWFv46G/3Rg==
```