diff --git a/rndc.conf b/rndc.conf new file mode 100644 index 0000000..ad31f18 --- /dev/null +++ b/rndc.conf @@ -0,0 +1,7 @@ +include "rndc.key"; + +options { + default-key "rndc-key"; + default-server 127.0.0.1; + default-port 953; +}; diff --git a/script/settings.py b/script/settings.py index 204ce47..8d35916 100755 --- a/script/settings.py +++ b/script/settings.py @@ -47,7 +47,7 @@ zones_path = os.path.join(named_path, 'zones') -system = platform.dist()[0] +system = platform.freedesktop_os_release()['VENDOR_NAME'] if system == 'centos': user = 'named' sysconf = '/etc/sysconfig/named' diff --git a/script/setup.py b/script/setup.py index 2845f38..13bb7d0 100755 --- a/script/setup.py +++ b/script/setup.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 #-*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 diff --git a/script/syndns.py b/script/syndns.py index f4a640a..b9f24f1 100755 --- a/script/syndns.py +++ b/script/syndns.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 #-*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 @@ -100,9 +100,9 @@ def reload_slave(slave_ip, system): sys.exit(-1) # reload slave dns - rndc_conf = '%s/rndc.key' % settings.named_path + rndc_conf = '%s/rndc.conf' % settings.named_path code = subprocess.call('/usr/bin/ssh %s@%s ' - '/usr/sbin/rndc -k %s -s localhost reload' % + '/usr/sbin/rndc -c %s -s localhost reload' % (user, slave_ip, rndc_conf), shell=True) if code: sys.stderr.write('reload slave name server %s failed\n' % slave_ip) @@ -138,8 +138,8 @@ def main(): settings.master_ip) for z in zones])) # reload master dns - rndc_conf = '%s/rndc.key' % settings.named_path - code = subprocess.call('/usr/sbin/rndc -k %s -s localhost reload' % + rndc_conf = '%s/rndc.conf' % settings.named_path + code = subprocess.call('/usr/sbin/rndc -c %s -s localhost reload' % rndc_conf, shell=True) if code: sys.stderr.write('reload master name server failed\n')