c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt#!/bin/sh
2a36d8ca40a933570347cac34542c2db580c4565Automatic Updater#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2011, 2012, 2016 Internet Systems Consortium, Inc. ("ISC")
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
2a36d8ca40a933570347cac34542c2db580c4565Automatic Updater
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt# $Id: setup.sh,v 1.4 2011/09/02 21:15:35 each Exp $
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Huntusage () {
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt echo "Usage: $0 [-s] <number of zones> [<records per zone>]"
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt echo " -s: use the same zone file all zones"
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt exit 1
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt}
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Huntif [ "$#" -lt 1 -o "$#" -gt 3 ]; then
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt usage
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Huntfi
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Huntsingle_file=""
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Huntif [ $1 = "-s" ]; then
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt single_file=yes
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt shift
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Huntfi
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Huntnzones=$1
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Huntshift
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Huntnrecords=5
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt[ "$#" -eq 1 ] && nrecords=$1
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt. ../system/conf.sh
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Huntcat << EOF
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Huntoptions {
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt directory "`pwd`";
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt listen-on { localhost; };
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt listen-on-v6 { localhost; };
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt port 5300;
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt allow-query { any; };
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt allow-transfer { localhost; };
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt allow-recursion { none; };
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt recursion no;
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt};
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Huntkey rndc_key {
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt secret "1234abcd8765";
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt algorithm hmac-md5;
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt};
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Huntcontrols {
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt inet 127.0.0.1 port 9953 allow { any; } keys { rndc_key; };
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt};
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Huntlogging {
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt channel basic {
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt file "`pwd`/named.log" versions 3 size 100m;
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt severity info;
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt print-time yes;
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt print-severity no;
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt print-category no;
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt };
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt category default {
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt basic;
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt };
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt};
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan HuntEOF
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt$PERL makenames.pl $nzones | while read zonename; do
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt if [ $single_file ]; then
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Hunt echo "zone $zonename { type master; file \"smallzone.db\"; };"
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt else
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt [ -d zones ] || mkdir zones
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt $PERL mkzonefile.pl $zonename $nrecords > zones/$zonename.db
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt echo "zone $zonename { type master; file \"zones/$zonename.db\"; };"
8a2ab2b9203120c3e2a883a5ee8c0b5d60c1808cEvan Hunt fi
c46ce2d79b4398a3db7c25b50c7ca3b292f0afa8Evan Huntdone