diff --git a/dynette.cron.py b/dynette.cron.py index 6a09ee8..7c35344 100755 --- a/dynette.cron.py +++ b/dynette.cron.py @@ -8,6 +8,7 @@ subs_urls = ['http://dyndns.yunohost.org'] # 127.0.0.1 if you install subscribe ns0 = 'ns0.yunohost.org' # Name servers ns1 = 'ns1.yunohost.org' rname = 'hostmaster@yunohost.org' # Responsible person (https://tools.ietf.org/html/rfc1035#section-3.3.13) +master_key= 'abcdef123456' allowed_operations = { '.' : ['A', 'AAAA', 'TXT', 'MX'], @@ -28,11 +29,18 @@ from urllib import urlopen lines = ['// Generated by Dynette CRON'] 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: 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'): db_lines = [ '$ORIGIN .', '$TTL 10 ; 10 seconds', @@ -57,6 +65,7 @@ for url in subs_urls: ' type master;', ' file "'+ zone_dir + domain +'.db"; ', ' update-policy {', + ' grant dynette. wildcard *.'+ domain +'. ANY;', ]) for entry in result: @@ -66,7 +75,8 @@ for url in subs_urls: lines.extend([ ' };', - '};', + '};' + '', ]) for entry in result: