[enh] Add dynette. key to Bind configuration.

This commit is contained in:
opi 2016-04-26 10:33:42 +02:00
parent 15776034c1
commit 87051e96e3

View file

@ -8,6 +8,7 @@ subs_urls = ['http://dyndns.yunohost.org'] # 127.0.0.1 if you install subscribe
ns0 = 'ns0.yunohost.org' # Name servers ns0 = 'ns0.yunohost.org' # Name servers
ns1 = 'ns1.yunohost.org' ns1 = 'ns1.yunohost.org'
rname = 'hostmaster@yunohost.org' # Responsible person (https://tools.ietf.org/html/rfc1035#section-3.3.13) rname = 'hostmaster@yunohost.org' # Responsible person (https://tools.ietf.org/html/rfc1035#section-3.3.13)
master_key= 'abcdef123456'
allowed_operations = { allowed_operations = {
'.' : ['A', 'AAAA', 'TXT', 'MX'], '.' : ['A', 'AAAA', 'TXT', 'MX'],
@ -28,8 +29,15 @@ from urllib import urlopen
lines = ['// Generated by Dynette CRON'] lines = ['// Generated by Dynette CRON']
for url in subs_urls: for url in subs_urls:
domains = json.loads(str(urlopen(url +'/domains').read()))
lines.extend([
'key dynette. {',
' algorithm hmac-md5;',
' secret "'+ master_key +'";',
'};',
])
domains = json.loads(str(urlopen(url +'/domains').read()))
for domain in domains: for domain in domains:
result = json.loads(str(urlopen(url +'/all/'+ domain).read())) result = json.loads(str(urlopen(url +'/all/'+ domain).read()))
if not os.path.exists(zone_dir + domain +'.db'): if not os.path.exists(zone_dir + domain +'.db'):
@ -57,6 +65,7 @@ for url in subs_urls:
' type master;', ' type master;',
' file "'+ zone_dir + domain +'.db"; ', ' file "'+ zone_dir + domain +'.db"; ',
' update-policy {', ' update-policy {',
' grant dynette. wildcard *.'+ domain +'. ANY;',
]) ])
for entry in result: for entry in result:
@ -66,7 +75,8 @@ for url in subs_urls:
lines.extend([ lines.extend([
' };', ' };',
'};', '};'
'',
]) ])
for entry in result: for entry in result: