[roster-dns-management] r1165 committed - Adding zone soa auto-generation option to dnsmkzone

0 views
Skip to first unread message

roster-dns...@googlecode.com

unread,
Aug 15, 2013, 11:06:39 AM8/15/13
to roster-...@googlegroups.com
Revision: 1165
Author: J.S.P...@gmail.com
Date: Thu Aug 15 08:06:22 2013
Log: Adding zone soa auto-generation option to dnsmkzone
http://code.google.com/p/roster-dns-management/source/detail?r=1165

Modified:
/trunk/roster-core/roster_core/constants.py
/trunk/roster-core/roster_core/core.py
/trunk/roster-core/scripts/roster_database_bootstrap
/trunk/roster-user-tools/roster_user_tools/data_flags.py
/trunk/roster-user-tools/scripts/dnsmkzone
/trunk/test/core_regtest.py
/trunk/test/dnsmkzone_test.py
/trunk/test/end_to_end_test.py
/trunk/test/test_data/roster_example.conf
/wiki/CoreInstallation.wiki

=======================================
--- /trunk/roster-core/roster_core/constants.py Fri May 10 09:51:01 2013
+++ /trunk/roster-core/roster_core/constants.py Thu Aug 15 08:06:22 2013
@@ -97,8 +97,13 @@
'system_email': 'str',
'email_subject': 'str',
'max_threads': 'int',
- 'exporter_debug': 'str'}}
-
+ 'exporter_debug': 'str'},
+ 'zone_defaults': {'refresh_seconds': 'int',
+ 'expiry_seconds': 'int',
+ 'minimum_seconds': 'int',
+ 'retry_seconds': 'int',
+ 'ns_ttl': 'int',
+ 'soa_ttl': 'int'}}

# The SUPPORTED_METHODS hash contains a hash for every supported method.
# 'check' indicates whether the target zone/IP range should be checked.
@@ -123,6 +128,10 @@
'write': True,
'access_level': ACCESS_LEVELS['user']},

+ 'BootstrapZone':{'check': True,
+ 'write': True,
+ 'access_level': ACCESS_LEVELS['dns_admin']},
+
'RemoveRecord': {'check': True,
'write': True,
'access_level': ACCESS_LEVELS['user']},
=======================================
--- /trunk/roster-core/roster_core/core.py Fri Aug 9 10:20:39 2013
+++ /trunk/roster-core/roster_core/core.py Thu Aug 15 08:06:22 2013
@@ -75,6 +75,7 @@
self.user_instance = user.User(user_name, self.db_instance,
self.log_instance)
self.parent_server_instance = parent_server_instance
+ self.config_instance = config_instance

def MakeUser(self, user_name, access_level):
"""Create a user.
@@ -3150,6 +3151,76 @@
type_list.append(zone_type['zone_type'])
return type_list

+ def BootstrapZone(self, zone_name, zone_type, zone_origin, view_name,
+ zone_bootstrap_dict, zone_options=None, make_any=True):
+ """Generates SOA and NS records for a zone.
+
+ Inputs:
+ zone_bootstrap_dict: dictionary containing between 0 and 2 keys
+ 'admin_email' and 'name_server' if either
+ of those keys are omitted, then their
corresponding
+ values are 'generated' by this method.
+ zone_name: string of zone name
+ zone_type: string of zone type
+ zone_origin: string of zone origin. ex dept.univiersity.edu.
+ zone_options: string of zone_options(defaults to empty string)
+ valid zone options can be found here:
+
http://www.bind9.net/manual/bind/9.3.2/Bv9ARM.ch06.html#zone_statement_grammar
+ view_name: string of view name(defaults to 'any')
+ see docstring of MakeViewAssignments as to why 'any' is
default
+ make_any: regardless of view name, make any as well(default to
True)
+ """
+ if( view_name == u'any' ):
+ raise errors.InvalidInputError('Cannot bootstrap a zone in the "any"
view.')
+
+ if( 'admin_email' in zone_bootstrap_dict and
+ zone_bootstrap_dict['admin_email'] is not None ):
+ admin_email = zone_bootstrap_dict['admin_email']
+ else:
+ admin_email = u'admin.%s' % zone_origin
+ if( 'name_server' in zone_bootstrap_dict and
+ zone_bootstrap_dict['name_server'] is not None ):
+ name_server = zone_bootstrap_dict['name_server']
+ else:
+ name_server = u'ns.%s' % zone_origin
+
+ ns_record_args_dict = self.GetEmptyRecordArgsDict(u'ns')
+ soa_record_args_dict = self.GetEmptyRecordArgsDict(u'soa')
+
+ ns_record_args_dict['name_server'] = name_server
+ soa_record_args_dict['name_server'] = name_server
+ soa_record_args_dict['admin_email'] = admin_email
+
+ soa_record_args_dict['refresh_seconds'] = (
+ self.config_instance.config_file[
+ 'zone_defaults']['refresh_seconds'])
+ soa_record_args_dict['expiry_seconds'] = (
+ self.config_instance.config_file[
+ 'zone_defaults']['expiry_seconds'])
+ soa_record_args_dict['minimum_seconds'] = (
+ self.config_instance.config_file[
+ 'zone_defaults']['minimum_seconds'])
+ soa_record_args_dict['retry_seconds'] = (
+ self.config_instance.config_file[
+ 'zone_defaults']['retry_seconds'])
+ soa_record_args_dict['serial_number'] = 1
+ ns_ttl = int(self.config_instance.config_file['zone_defaults'][
+ 'ns_ttl'])
+ soa_ttl = int(self.config_instance.config_file['zone_defaults'][
+ 'soa_ttl'])
+
+ self.MakeZone(zone_name, zone_type, zone_origin,
+ view_name=view_name, zone_options=zone_options, make_any=make_any)
+ self.MakeRecord(u'soa', u'@', zone_name, soa_record_args_dict,
+ view_name=view_name, ttl=soa_ttl)
+ self.MakeRecord(u'ns', u'@', zone_name, ns_record_args_dict,
+ view_name=view_name, ttl=ns_ttl)
+
+ soa_record_args_dict['ttl'] = soa_ttl
+ ns_record_args_dict['ttl'] = ns_ttl
+
+ return soa_record_args_dict, ns_record_args_dict
+
def MakeZoneType(self, zone_type):
"""Makes a new zone type.

=======================================
--- /trunk/roster-core/scripts/roster_database_bootstrap Fri May 10
09:51:01 2013
+++ /trunk/roster-core/scripts/roster_database_bootstrap Thu Aug 15
08:06:22 2013
@@ -166,6 +166,24 @@
default=False)
parser.add_option('--root-hint-file', action='store',
dest='root_hint_file',
help='Location of root hint file.', default=None)
+ parser.add_option('--zone-default-refresh-seconds', action='store',
+ dest='refresh_seconds', default=3600,
+ help='Refresh seconds to use during zone
bootstrapping.')
+ parser.add_option('--zone-default-expiry-seconds', action='store',
+ dest='expiry_seconds', default=1814400,
+ help='Expiry seconds to use during zone
bootstrapping.')
+ parser.add_option('--zone-default-minimum-seconds', action='store',
+ dest='minimum_seconds', default=86400,
+ help='Minimum seconds to use during zone
bootstrapping.')
+ parser.add_option('--zone-default-retry-seconds', action='store',
+ dest='retry_seconds', default=600,
+ help='Retry seconds to use during zone bootstrapping.')
+ parser.add_option('--zone-default-nameserver-ttl', action='store',
+ dest='ns_ttl', default=3600,
+ help='Nameserver TTL to use during zone
bootstrapping.')
+ parser.add_option('--zone-default-soa-ttl', action='store',
+ dest='soa_ttl', default=3600,
+ help='SOA TTL to use during zone bootstrapping.')
parser.add_option('--max-threads', action='store', dest='max_threads',
help='Maximum number of threads to run in parallel
during '
'dnsexportconfig execution.', default='10')
@@ -298,6 +316,14 @@
else:
config_parser.set('exporter', 'exporter_debug', 'off')

+ config_parser.add_section('zone_defaults')
+ config_parser.set('zone_defaults', 'refresh_seconds',
str(options.refresh_seconds))
+ config_parser.set('zone_defaults', 'retry_seconds',
str(options.retry_seconds))
+ config_parser.set('zone_defaults', 'minimum_seconds',
str(options.minimum_seconds))
+ config_parser.set('zone_defaults', 'expiry_seconds',
str(options.expiry_seconds))
+ config_parser.set('zone_defaults', 'ns_ttl', str(options.ns_ttl))
+ config_parser.set('zone_defaults', 'soa_ttl', str(options.soa_ttl))
+
config_parser.add_section('server')
config_parser.set('server', 'port', options.port)
config_parser.set('server', 'host', options.host)
=======================================
--- /trunk/roster-user-tools/roster_user_tools/data_flags.py Thu Jan 24
08:39:11 2013
+++ /trunk/roster-user-tools/roster_user_tools/data_flags.py Thu Aug 15
08:06:22 2013
@@ -260,7 +260,26 @@
'specify view name.',
default=True)
self.SetAllFlagRule('dont_make_any', required=False)
-
+ self.parser.add_option('--bootstrap-zone', action='store_true',
+ dest='bootstrap_zone',
+ help='Auto-generates SOA and NS records '
+ 'for the zone being created.', default=False)
+ self.SetAllFlagRule('bootstrap_zone', required=False)
+ self.parser.add_option('--bootstrap-admin-email', action='store',
+ dest='bootstrap_admin_email',
+ metavar='<admin-email>',
+ help='The admin email address to use in
creation '
+ 'of the bootstrapped SOA record. If none is '
+ 'provided, one will be auto-generated.',
+ default=None)
+ self.SetAllFlagRule('bootstrap_admin_email', required=False)
+ self.parser.add_option('--bootstrap-nameserver', action='store',
+ dest='bootstrap_nameserver',
metavar='<name-sever>',
+ help='The name server to use in creation of '
+ 'the bootstrapped NS and SOA record. If none
is '
+ 'provided, one will be auto-generated.',
+ default=None)
+ self.SetAllFlagRule('bootstrap_nameserver', required=False)

class View(core_flags.CoreFlags):
"""Command line view flags"""
=======================================
--- /trunk/roster-user-tools/scripts/dnsmkzone Mon Oct 29 05:36:47 2012
+++ /trunk/roster-user-tools/scripts/dnsmkzone Thu Aug 15 08:06:22 2013
@@ -137,20 +137,58 @@
options.zone_name, options.cidr_block))

elif( command == 'forward' ):
- roster_client_lib.RunFunction(
- u'MakeZone', options.username, credfile=options.credfile,
- credstring=options.credstring,
- args=[options.zone_name, options.type, options.origin],
- kwargs={u'view_name': options.view_name,
- u'zone_options': options.options,
- u'make_any': options.dont_make_any},
- server_name=options.server)
- if( not options.quiet ):
- print ('ADDED FORWARD ZONE: zone_name: %s zone_type: %s '
- 'zone_origin: %s zone_options: %s view_name: %s' % (
- options.zone_name, options.type,
- options.origin, options.options,
- options.view_name))
+ if( options.bootstrap_zone ):
+ zone_bootstrap_dict = {'name_server': options.bootstrap_nameserver,
+ 'admin_email': options.bootstrap_admin_email}
+ soa_dict, ns_dict = roster_client_lib.RunFunction(
+ u'BootstrapZone', options.username, credfile=options.credfile,
+ credstring=options.credstring,
+ args=[options.zone_name, options.type, options.origin,
+ options.view_name, zone_bootstrap_dict],
+ kwargs={u'zone_options': options.options,
+ u'make_any': options.dont_make_any},
+ server_name=options.server)['core_return']
+
+ soa_serial_number = roster_client_lib.RunFunction(
+ u'ListRecords', options.username, credfile=options.credfile,
+ credstring=options.credstring,
+ kwargs={'record_type': u'soa',
+ 'target': u'@',
+ 'zone_name': options.zone_name,
+ 'view_name': options.view_name},
+ server_name=options.server)['core_return'][0]['serial_number']
+ if( not options.quiet ):
+ print ('ADDED FORWARD ZONE: zone_name: %s zone_type: %s '
+ 'zone_origin: %s zone_options: %s view_name: %s' % (
+ options.zone_name, options.type,
+ options.origin, options.options,
+ options.view_name))
+ print ('ADDED SOA: @ zone_name: %s view_name: %s ttl: %s '
+ 'refresh_seconds: %s expiry_seconds: %s name_server: %s '
+ 'minimum_seconds: %s retry_seconds: %s serial_number: %s '
+ 'admin_email: %s') % (options.zone_name, options.view_name,
+ soa_dict['ttl'], soa_dict['refresh_seconds'],
+ soa_dict['expiry_seconds'], soa_dict['name_server'],
+ soa_dict['minimum_seconds'], soa_dict['retry_seconds'],
+ soa_serial_number, soa_dict['admin_email'])
+ print ('ADDED NS: @ zone_name: %s view_name: %s ttl: %s '
+ 'name_server: %s') % (options.zone_name, options.view_name,
+ ns_dict['ttl'], ns_dict['name_server'])
+ else:
+ roster_client_lib.RunFunction(
+ u'MakeZone', options.username, credfile=options.credfile,
+ credstring=options.credstring,
+ args=[options.zone_name, options.type, options.origin],
+ kwargs={u'view_name': options.view_name,
+ u'zone_options': options.options,
+ u'make_any': options.dont_make_any},
+ server_name=options.server)
+ if( not options.quiet ):
+ print ('ADDED FORWARD ZONE: zone_name: %s zone_type: %s '
+ 'zone_origin: %s zone_options: %s view_name: %s' % (
+ options.zone_name, options.type,
+ options.origin, options.options,
+ options.view_name))
else:
cli_common_lib.DnsError(
'Command %s exists, but codepath doesn\'t.' % command, 1)
=======================================
--- /trunk/test/core_regtest.py Fri Aug 9 10:20:39 2013
+++ /trunk/test/core_regtest.py Thu Aug 15 08:06:22 2013
@@ -970,6 +970,85 @@
u'test_duplicate', u'university.edu', {u'assignment_ip':
u'192.168.1.126'},
view_name=u'test_view', ttl=400)

+ def testBootstrapZone(self):
+ for zone in self.core_instance.ListZones():
+ self.core_instance.RemoveZone(zone)
+
+ self.assertEqual(self.core_instance.ListZones(), {})
+ self.assertEqual(self.core_instance.ListRecords(), [])
+ self.core_instance.MakeView(u'test_view')
+
+ self.core_instance.BootstrapZone(u'zone1', u'master', u'zone1_origin.',
+ view_name=u'test_view', zone_bootstrap_dict={}, make_any=False)
+ self.core_instance.BootstrapZone(u'zone2', u'master', u'zone2_origin.',
+ view_name=u'test_view', zone_bootstrap_dict={'admin_email':
u'some_bro.'},
+ make_any=False)
+ self.core_instance.BootstrapZone(u'zone3', u'master', u'zone3_origin.',
+ view_name=u'test_view', zone_bootstrap_dict={'name_server':
u'some_name_server.'},
+ make_any=False)
+ self.core_instance.BootstrapZone(u'zone4', u'master', u'zone4_origin.',
+ view_name=u'test_view', zone_bootstrap_dict={
+ 'admin_email': u'some_admin.', 'name_server':
u'some_other_name_server.'},
+ make_any=False)
+
+ #Nothing interesting should happen here.
+ self.assertEqual(self.core_instance.ListZones(),
+ {u'zone3':
+ {u'test_view': {'zone_type': u'master', 'zone_options': u'',
+ 'zone_origin': u'zone3_origin.'}},
+ u'zone2':
+ {u'test_view': {'zone_type': u'master', 'zone_options': u'',
+ 'zone_origin': u'zone2_origin.'}},
+ u'zone1':
+ {u'test_view': {'zone_type': u'master', 'zone_options': u'',
+ 'zone_origin': u'zone1_origin.'}},
+ u'zone4':
+ {u'test_view': {'zone_type': u'master', 'zone_options': u'',
+ 'zone_origin': u'zone4_origin.'}}})
+
+ #Here is the magic...
+ self.assertEqual(sorted(self.core_instance.ListRecords(u'ns')),
+ sorted([{'target': u'@', u'name_server':
u'some_other_name_server.',
+ 'ttl': 3600, 'record_type': u'ns', 'view_name':
u'test_view',
+ 'last_user': u'sharrell', 'zone_name': u'zone4'},
+ {'target': u'@', u'name_server': u'ns.zone1_origin.',
+ 'ttl': 3600, 'record_type': u'ns', 'view_name':
u'test_view',
+ 'last_user': u'sharrell', 'zone_name': u'zone1'},
+ {'target': u'@', u'name_server': u'ns.zone2_origin.',
+ 'ttl': 3600, 'record_type': u'ns', 'view_name':
u'test_view',
+ 'last_user': u'sharrell', 'zone_name': u'zone2'},
+ {'target': u'@', u'name_server': u'some_name_server.',
+ 'ttl': 3600, 'record_type': u'ns', 'view_name':
u'test_view',
+ 'last_user': u'sharrell', 'zone_name': u'zone3'}]))
+ self.assertEqual(sorted(self.core_instance.ListRecords(u'soa')),
+ sorted([{u'serial_number': 3, u'refresh_seconds': 3600, 'target':
u'@',
+ u'name_server': u'ns.zone1_origin.', u'retry_seconds':
600,
+ 'ttl': 3600, u'minimum_seconds': 86400, 'record_type':
u'soa',
+ 'view_name': u'test_view', 'last_user': u'sharrell',
+ 'zone_name': u'zone1', u'admin_email':
u'admin.zone1_origin.',
+ u'expiry_seconds': 1814400},
+
+ {u'serial_number': 3, u'refresh_seconds': 3600, 'target':
u'@',
+ u'name_server': u'ns.zone2_origin.', u'retry_seconds':
600,
+ 'ttl': 3600, u'minimum_seconds': 86400, 'record_type':
u'soa',
+ 'view_name': u'test_view', 'last_user': u'sharrell',
+ 'zone_name': u'zone2', u'admin_email': u'some_bro.',
+ u'expiry_seconds': 1814400},
+
+ {u'serial_number': 3, u'refresh_seconds': 3600, 'target':
u'@',
+ u'name_server': u'some_name_server.', u'retry_seconds':
600,
+ 'ttl': 3600, u'minimum_seconds': 86400, 'record_type':
u'soa',
+ 'view_name': u'test_view', 'last_user': u'sharrell',
+ 'zone_name': u'zone3', u'admin_email':
u'admin.zone3_origin.',
+ u'expiry_seconds': 1814400},
+
+ {u'serial_number': 3, u'refresh_seconds': 3600, 'target':
u'@',
+ u'name_server': u'some_other_name_server.',
+ u'retry_seconds': 600, 'ttl': 3600, u'minimum_seconds':
86400,
+ 'record_type': u'soa', 'view_name': u'test_view',
+ 'last_user': u'sharrell', 'zone_name': u'zone4',
+ u'admin_email': u'some_admin.', u'expiry_seconds':
1814400}]))
+
def testSOA(self):
self.core_instance.MakeView(u'test_view')
self.core_instance.MakeZone(u'university.edu', u'master',
=======================================
--- /trunk/test/dnsmkzone_test.py Mon Oct 29 05:36:47 2012
+++ /trunk/test/dnsmkzone_test.py Thu Aug 15 08:06:22 2013
@@ -157,6 +157,62 @@
'zone_options: None view_name: test_view\n')
output.close()

+ def testMakeZoneWithBootstrap(self):
+ self.core_instance.MakeView(u'test_view')
+ output = os.popen('python %s forward -v test_view -z test_zone1
--origin '
+ 'dept1.univiersity.edu. --type master
--dont-make-any '
+ '-s %s -u %s -p %s --config-file %s
--bootstrap-zone' % (
+ EXEC, self.server_name, USERNAME,
+ PASSWORD, USER_CONFIG))
+ self.assertEqual(output.read(),
+ 'ADDED FORWARD ZONE: zone_name: test_zone1 zone_type: master '
+ 'zone_origin: dept1.univiersity.edu. zone_options: None '
+ 'view_name: test_view\n'
+ 'ADDED SOA: @ zone_name: test_zone1 view_name: test_view ttl:
3600 '
+ 'refresh_seconds: 3600 expiry_seconds: 1814400 '
+ 'name_server: ns.dept1.univiersity.edu. minimum_seconds: 86400 '
+ 'retry_seconds: 600 serial_number: 3 '
+ 'admin_email: admin.dept1.univiersity.edu.\n'
+ 'ADDED NS: @ zone_name: test_zone1 view_name: test_view ttl: 3600 '
+ 'name_server: ns.dept1.univiersity.edu.\n')
+ output.close()
+ output = os.popen('python %s forward -v test_view -z test_zone2
--origin '
+ 'dept2.univiersity.edu. --type master
--dont-make-any '
+ '-s %s -u %s -p %s --config-file %s
--bootstrap-zone '
+ '--bootstrap-nameserver=broserver.' % (
+ EXEC, self.server_name, USERNAME,
+ PASSWORD, USER_CONFIG))
+ self.assertEqual(output.read(),
+ 'ADDED FORWARD ZONE: zone_name: test_zone2 zone_type: master '
+ 'zone_origin: dept2.univiersity.edu. zone_options: None '
+ 'view_name: test_view\n'
+ 'ADDED SOA: @ zone_name: test_zone2 view_name: test_view ttl:
3600 '
+ 'refresh_seconds: 3600 expiry_seconds: 1814400 '
+ 'name_server: broserver. minimum_seconds: 86400 '
+ 'retry_seconds: 600 serial_number: 3 '
+ 'admin_email: admin.dept2.univiersity.edu.\n'
+ 'ADDED NS: @ zone_name: test_zone2 view_name: test_view ttl: 3600 '
+ 'name_server: broserver.\n')
+ output.close()
+ output = os.popen('python %s forward -v test_view -z test_zone3
--origin '
+ 'dept3.univiersity.edu. --type master
--dont-make-any '
+ '-s %s -u %s -p %s --config-file %s
--bootstrap-zone '
+ '--bootstrap-admin-email=bromail.' % (
+ EXEC, self.server_name, USERNAME,
+ PASSWORD, USER_CONFIG))
+ self.assertEqual(output.read(),
+ 'ADDED FORWARD ZONE: zone_name: test_zone3 zone_type: master '
+ 'zone_origin: dept3.univiersity.edu. zone_options: None '
+ 'view_name: test_view\n'
+ 'ADDED SOA: @ zone_name: test_zone3 view_name: test_view ttl:
3600 '
+ 'refresh_seconds: 3600 expiry_seconds: 1814400 '
+ 'name_server: ns.dept3.univiersity.edu. minimum_seconds: 86400 '
+ 'retry_seconds: 600 serial_number: 3 '
+ 'admin_email: bromail.\n'
+ 'ADDED NS: @ zone_name: test_zone3 view_name: test_view ttl: 3600 '
+ 'name_server: ns.dept3.univiersity.edu.\n')
+ output.close()
+
def testMakeZoneWithView(self):
self.core_instance.MakeView(u'test_view')
output = os.popen('python %s forward -v test_view -z test_zone
--origin '
=======================================
--- /trunk/test/end_to_end_test.py Wed Jul 10 11:35:06 2013
+++ /trunk/test/end_to_end_test.py Thu Aug 15 08:06:22 2013
@@ -184,18 +184,23 @@
## --ssl-key <key-file> --root-config-dir <root_dir>
## --backup-dir <backup-dir> -i <init-file> --server-log-file
<log-file>
## --run-as <uuid> --force --root-hint-file test_data/named.ca
+ ## --zone-default-retry-seconds=30 --zone-default-refresh-seconds=30
+ ## --zone-default-minimum-seconds=30 --zone-default-expiry-seconds=30
+ ## --zone-default-nameserver-ttl=1234
command_string = (
'python ../roster-core/scripts/roster_database_bootstrap '
'-c %s -u %s -U %s -p %s '
'-d %s -n %s '
'--ssl-cert %s --ssl-key %s '
'--root-config-dir %s --backup-dir %s -i %s/init
--server-log-file %s '
- '--run-as %s --force --root-hint-file test_data/named.ca' % (
+ '--run-as %s --force --root-hint-file test_data/named.ca '
+ '--zone-default-retry-seconds=30
--zone-default-refresh-seconds=30 '
+ '--zone-default-minimum-seconds=30
--zone-default-expiry-seconds=30'% (
self.userconfig, self.login, USERNAME, self.password,
self.database, self.server,
self.cert, self.key,
- self.root_config_dir, self.backup_dir,
- #self.backup_dir,
+ self.root_config_dir,
+ self.backup_dir,
TESTDIR,
self.logfile,
os.getuid()))
@@ -1322,16 +1327,25 @@
command.close()
## User tool: dnsmkzone
## dnsmkzone forward -z test_zone -v test_view -t master --origin
university.edu.
+ ## --bootstrap-zone --bootstrap-admin-email=university.edu.
+ ## --bootstrap-nameserver=ns.university.edu.
command_string = (
'python ../roster-user-tools/scripts/dnsmkzone '
'forward -z test_zone -v test_view -t master --origin
university.edu. '
- '-u %s -p %s -s %s --config-file %s ' % (
+ '--bootstrap-zone --bootstrap-admin-email=university.edu. '
+ '--bootstrap-nameserver=ns.university.edu. '
+ '-u %s -p %s -s %s --config-file %s' % (
USERNAME, PASSWORD, self.server_name, self.toolsconfig))
command = os.popen(command_string)
self.assertEqual(command.read(),
'ADDED FORWARD ZONE: zone_name: test_zone zone_type: master '
- 'zone_origin: university.edu. zone_options: None '
- 'view_name: test_view\n')
+ 'zone_origin: university.edu. zone_options: None view_name:
test_view\n'
+ 'ADDED SOA: @ zone_name: test_zone view_name: test_view ttl: 3600 '
+ 'refresh_seconds: 30 expiry_seconds: 30 '
+ 'name_server: ns.university.edu. minimum_seconds: 30 '
+ 'retry_seconds: 30 serial_number: 3 admin_email: university.edu.\n'
+ 'ADDED NS: @ zone_name: test_zone view_name: test_view ttl: 3600 '
+ 'name_server: ns.university.edu.\n')
## User tool: dnsmkzone
## dnsmkzone forward -z test_slave_zone -v test_view -t slave
command_string = (
@@ -1346,6 +1360,19 @@
'slave zone_origin: slave.university.edu. '
'zone_options: masters { 192.168.0.1; }; view_name: test_view\n')
command.close()
+ ## User tool: dnsrmrecord
+ ## dnsrmrecord ns --name-server ns.university.edu. -z test_zone -t @
-v test_view
+ command_string = (
+ 'python ../roster-user-tools/scripts/dnsrmrecord '
+ 'ns --name-server ns.university.edu. -z test_zone -t @ -v
test_view '
+ '-u %s -p %s -s %s --config-file %s' % (
+ USERNAME, PASSWORD, self.server_name, self.toolsconfig))
+ command = os.popen(command_string)
+ output = command.read()
+ command.close()
+ self.assertEqual(output,
+ 'REMOVED NS: @ zone_name: test_zone view_name: test_view ttl:
3600\n'
+ ' name_server: ns.university.edu.\n')
## User tool: dnsmkzone
## dnsmkzone forward -z test_zone2 -v test_view2 -t master --origin
1.168.192.in-addr.arpa.
command_string = (
@@ -1940,28 +1967,6 @@
for i in output:
self.assertFalse('test_user' in i)
command.close()
-
- ## User tool: dnsmkrecord
- ## dnsmkrecord soa --admin-email="university.edu."
--name-server="ns.university.edu."
- ## --serial-number=123456 --refresh-seconds=30 --retry-seconds=30
- ## --minimum-seconds=30 --expiry-seconds=30 -t @ -v test_view -z
test_zone
- command_string = (
- 'python ../roster-user-tools/scripts/dnsmkrecord '
- 'soa --admin-email="university.edu." '
- '--name-server="ns.university.edu." '
- '--serial-number=111 --refresh-seconds=30 '
- '--retry-seconds=30 --minimum-seconds=30 '
- '--expiry-seconds=30 '
- '-t @ -v test_view -z test_zone '
- '-u %s -p %s -s %s --config-file %s ' % (
- USERNAME, PASSWORD, self.server_name, self.toolsconfig))
- command = os.popen(command_string)
- self.assertEqual(command.read(),
- 'ADDED SOA: @ zone_name: test_zone view_name: test_view ttl:
3600\n '
- 'refresh_seconds: 30 expiry_seconds: 30 name_server:
ns.university.edu. '
- 'minimum_seconds: 30 retry_seconds: 30 serial_number: 111 '
- 'admin_email: university.edu.\n')
- command.close()
## User tool: dnsmkrecord
## dnsmkrecord soa --admin-email="university.edu."
--name-server="ns.university.edu."
## --serial-number=123456 --refresh-seconds=30 --retry-seconds=30
=======================================
--- /trunk/test/test_data/roster_example.conf Thu May 30 12:54:01 2013
+++ /trunk/test/test_data/roster_example.conf Thu Aug 15 08:06:22 2013
@@ -67,5 +67,14 @@
root_hint_file = test_data/named.ca
max_threads = 10

+#Defaults for zone bootstraping
+[zone_defaults]
+refresh_seconds = 3600
+expiry_seconds = 1814400
+minimum_seconds = 86400
+retry_seconds = 600
+ns_ttl = 3600
+soa_ttl = 3600
+
##### AUTHDEVELOPER CONFIG #####
[auth_developer]
=======================================
--- /wiki/CoreInstallation.wiki Mon Oct 1 09:57:37 2012
+++ /wiki/CoreInstallation.wiki Thu Aug 15 08:06:22 2013
@@ -1,4 +1,4 @@
-== Roster Core Setup ==
+== Roster Core Setup ==
Installation of Roster User Tools is as follows:

From pypi:
@@ -128,6 +128,18 @@
Directory where named files will live.
--server-port=PORT Port server will start with.
--server-host=HOST Host server will start with.
+ --zone-default-refresh-seconds=REFRESH_SECONDS
+ Refresh seconds to use during zone bootstrapping.
+ --zone-default-expiry-seconds=EXPIRY_SECONDS
+ Expiry seconds to use during zone bootstrapping.
+ --zone-default-minimum-seconds=MINIMUM_SECONDS
+ Minimum seconds to use during zone bootstrapping.
+ --zone-default-retry-seconds=RETRY_SECONDS
+ Retry seconds to use during zone bootstrapping.
+ --zone-default-nameserver-ttl=NS_TTL
+ Nameserver TTL to use during zone bootstrapping.
+ --zone-default-soa-ttl=SOA_TTL
+ SOA TTL to use during zone bootstrapping.
}}}
=== Config File ===
The Roster config file generated is used to store information you do not
want to supply on the command line.
@@ -182,6 +194,16 @@
server_killswitch = off


+#Defaults for zone bootstraping
+[zone_defaults]
+refresh_seconds = 3600
+expiry_seconds = 1814400
+minimum_seconds = 86400
+retry_seconds = 600
+ns_ttl = 3600
+soa_ttl = 3600
+
+
##### CREDENTIAL CONFIG #####
[credentials]
# Credential expiry time in seconds
@@ -189,12 +211,14 @@
# Authentication method
authentication_method = fakeldap

+
##### EXPORTER CONFIG #####
[exporter]
root_config_dir = root_config_dir
backup_dir = test_data/backup_dir
named_dir = /etc/named

+
##### AUTH_PAM CONFIG #####
[auth_pam]
}}}
Reply all
Reply to author
Forward
0 new messages