1#!/bin/sh 2# 3# Copyright (C) 2011, 2012 Internet Systems Consortium, Inc. ("ISC") 4# 5# Permission to use, copy, modify, and/or distribute this software for any 6# purpose with or without fee is hereby granted, provided that the above 7# copyright notice and this permission notice appear in all copies. 8# 9# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 10# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 11# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 12# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 13# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 14# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 15# PERFORMANCE OF THIS SOFTWARE. 16 17# Id: setup.sh,v 1.4 2011/09/02 21:15:35 each Exp 18 19usage () { 20 echo "Usage: $0 [-s] <number of zones> [<records per zone>]" 21 echo " -s: use the same zone file all zones" 22 exit 1 23} 24 25if [ "$#" -lt 1 -o "$#" -gt 3 ]; then 26 usage 27fi 28 29single_file="" 30if [ $1 = "-s" ]; then 31 single_file=yes 32 shift 33fi 34 35nzones=$1 36shift 37 38nrecords=5 39[ "$#" -eq 1 ] && nrecords=$1 40 41. ../system/conf.sh 42 43cat << EOF 44options { 45 directory "`pwd`"; 46 listen-on { localhost; }; 47 listen-on-v6 { localhost; }; 48 port 5300; 49 allow-query { any; }; 50 allow-transfer { localhost; }; 51 allow-recursion { none; }; 52 recursion no; 53}; 54 55key rndc_key { 56 secret "1234abcd8765"; 57 algorithm hmac-md5; 58}; 59 60controls { 61 inet 127.0.0.1 port 9953 allow { any; } keys { rndc_key; }; 62}; 63 64logging { 65 channel basic { 66 file "`pwd`/named.log" versions 3 size 100m; 67 severity info; 68 print-time yes; 69 print-severity no; 70 print-category no; 71 }; 72 category default { 73 basic; 74 }; 75}; 76 77EOF 78 79$PERL makenames.pl $nzones | while read zonename; do 80 if [ $single_file ]; then 81 echo "zone $zonename { type master; file \"smallzone.db\"; };" 82 else 83 [ -d zones ] || mkdir zones 84 $PERL mkzonefile.pl $zonename $nrecords > zones/$zonename.db 85 echo "zone $zonename { type master; file \"zones/$zonename.db\"; };" 86 fi 87done 88