diff options
Diffstat (limited to 'dns_wizard/scripts')
-rw-r--r-- | dns_wizard/scripts/127.0.0.rev.default | 17 | ||||
-rwxr-xr-x | dns_wizard/scripts/check_ext_dns.sh | 82 | ||||
-rwxr-xr-x | dns_wizard/scripts/do_it_dns.sh | 177 | ||||
-rw-r--r-- | dns_wizard/scripts/domain.db.default | 31 | ||||
-rw-r--r-- | dns_wizard/scripts/host.conf.default | 2 | ||||
-rw-r--r-- | dns_wizard/scripts/ipnet.rev.default | 30 | ||||
-rw-r--r-- | dns_wizard/scripts/named.conf.default | 54 | ||||
-rw-r--r-- | dns_wizard/scripts/root.hints.default | 44 |
8 files changed, 437 insertions, 0 deletions
diff --git a/dns_wizard/scripts/127.0.0.rev.default b/dns_wizard/scripts/127.0.0.rev.default new file mode 100644 index 00000000..97bf97bb --- /dev/null +++ b/dns_wizard/scripts/127.0.0.rev.default @@ -0,0 +1,17 @@ +; default file for 127.0.0.rev (to be used by bind8) +; +; setting a local DNS server for a local Class C network +; with an external DNS referee for non locally resolved address +; +; Don't forget to upgrade the Serial number after a change +; +@ IN SOA localhost. root.localhost. ( + 1999070401 ; Serial + 28800 ; Refresh + 14400 ; Retry + 3600000 ; Expire + 86400 ) ; Minimum + IN NS 127.0.0.1 + IN NS __hname__. + + 1 IN PTR localhost. diff --git a/dns_wizard/scripts/check_ext_dns.sh b/dns_wizard/scripts/check_ext_dns.sh new file mode 100755 index 00000000..e62c55b7 --- /dev/null +++ b/dns_wizard/scripts/check_ext_dns.sh @@ -0,0 +1,82 @@ +#!/bin/bash +# +# Wizard +# +# Copyright (C) 2000 Mandrakesoft. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# See file LICENSE for further informations on licensing terms. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# Authors: Jerome Dumonteil, Maurizio De Cecco, Enzo Maggi +# icons: Helene Durosini <ln@mandrakesoft.com> +# <corporate@mandrakesoft.com> http://www.mandrakesoft.com + +# script for wizard external dns configuration +# +# checking if the provided network address is correct + +# ip is tested as ip=a.b.c.d + +if [ -n "${wiz_ext_dns1}" ]; then + +a=${wiz_ext_dns1%%.*} +b=`echo ${wiz_ext_dns1}|sed -n -e 's/^[0-9]\{1,3\}\.\([0-9]\{1,3\}\)\..*$/\1/p'` +c=`echo ${wiz_ext_dns1}|sed -n -e 's/^[0-9]\{1,3\}\.[0-9]\{1,3\}\.\([0-9]\{1,3\}\)\..*$/\1/p'` +d=${wiz_ext_dns1##*.} + +echo_debug "ip1 -$a-$b-$c-$d-" + +if [ -z "$a" -o -z "$b" -o -z "$c" -o -z "$d" ]; then + echo_debug "incomplete ip" + exit 1 +fi + +if [ $a -gt 255 -o $b -gt 255 -o $c -gt 255 -o $d -gt 255 ]; then + echo_debug "not a network ip" + exit 1 +fi + +fi + + +if [ -n "${wiz_ext_dns2}" ]; then + +a=${wiz_ext_dns2%%.*} +b=`echo ${wiz_ext_dns2}|sed -n -e 's/^[0-9]\{1,3\}\.\([0-9]\{1,3\}\)\..*$/\1/p'` +c=`echo ${wiz_ext_dns2}|sed -n -e 's/^[0-9]\{1,3\}\.[0-9]\{1,3\}\.\([0-9]\{1,3\}\)\..*$/\1/p'` +d=${wiz_ext_dns2##*.} + +echo_debug "ip2 -$a-$b-$c-$d-" + +if [ -z "$a" -o -z "$b" -o -z "$c" -o -z "$d" ]; then + echo_debug "incomplete ip" + exit 1 +fi + +if [ $a -gt 255 -o $b -gt 255 -o $c -gt 255 -o $d -gt 255 ]; then + echo_debug "not a network ip" + exit 1 +fi + +fi + +if [ -z "${wiz_ext_dns1}" -a -z "${wiz_ext_dns2}" ]; then + echo_debug "warning, no DNS address" + exit 2 +fi + + +# all seems to be ok +exit 10 diff --git a/dns_wizard/scripts/do_it_dns.sh b/dns_wizard/scripts/do_it_dns.sh new file mode 100755 index 00000000..84807609 --- /dev/null +++ b/dns_wizard/scripts/do_it_dns.sh @@ -0,0 +1,177 @@ +#!/bin/bash +# +# Wizard +# +# Copyright (C) 2000 Mandrakesoft. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# See file LICENSE for further informations on licensing terms. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# Authors: Jerome Dumonteil, Maurizio De Cecco, Enzo Maggi +# icons: Helene Durosini <ln@mandrakesoft.com> +# <corporate@mandrakesoft.com> http://www.mandrakesoft.com + +# script for wizard dns configuration +# +# install default dns configuration for server +# assuming all dependencies are ok + +wiz_ip_net=`get_var wiz_ip_net` +wiz_ip_server=`get_var wiz_ip_server` +wiz_domain_name=`get_var wiz_domain_name` +wiz_host_name=`get_var wiz_host_name` +s_trunc=${wiz_ip_net%.*} +ds=${wiz_ip_server##*.} +host=${wiz_host_name%%.*} + + +# change serial number +# $1 : file +up_serial(){ +TMPFILE=`mktemp /tmp/temp.XXXXXX` || exit 1 +cat $1 > ${TMPFILE} +serial_nbm=$(date "+%Y%m%d00") +serial_f=`sed -ne "s/^\([[:space:]]*\)\([0-9]*\)\([[:space:]]*;[[:space:]]*Serial.*$\)/\2/p" ${TMPFILE}` +serial_f=$((${serial_f}+1)) +if [ ${serial_f} -le ${serial_nbm} ]; then + serial_f=${serial_nbm} +fi + +cat ${TMPFILE}\ +|sed -e "s/^\([[:space:]]*\)\([0-9]*\)\([[:space:]]*;[[:space:]]*Serial.*$\)/\1${serial_f}\3/"\ +> $1 +rm -f ${TMPFILE} +} + + + + + + + +# host.conf +bck_file /etc/host.conf +cat ${CWD}/scripts/host.conf.default > /etc/host.conf + +# named.conf +file=/etc/named.conf +bck_file ${file} + +echo_debug "now putting ${file} configuration" + +reversenet=`echo ${wiz_ip_net}|sed -e 's/^\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.[0-9]*$/\3\.\2\.\1/'` +echo_debug "reversenet : ${reversenet}" + +cat ${CWD}/scripts/named.conf.default > /var/tmp/named.conf.default + +if [ -z "${wiz_ext_dns1}" ]; then + TMPFILE=`mktemp /tmp/temp.XXXXXX` || exit 1 + cat /var/tmp/named.conf.default > ${TMPFILE} + cat ${TMPFILE}|sed -e "s/^.*__ISPNS1__.*$/\/\/&/" >/var/tmp/named.conf.default + rm -f ${TMPFILE} +fi +if [ -z "${wiz_ext_dns2}" ]; then + TMPFILE=`mktemp /tmp/temp.XXXXXX` || exit 1 + cat /var/tmp/named.conf.default > ${TMPFILE} + cat ${TMPFILE}|sed -e "s/^.*__ISPNS2__.*$/\/\/&/" >/var/tmp/named.conf.default + rm -f ${TMPFILE} +fi + +cat /var/tmp/named.conf.default \ +|sed "s|__ISPNS1__|${wiz_ext_dns1}|g" \ +|sed "s|__ISPNS2__|${wiz_ext_dns2}|g" \ +|sed "s|__dname__|${wiz_domain_name}|g" \ +|sed "s|__revnet__|${reversenet}|g" \ +|sed "s|__net__|${s_trunc}|g" \ +> ${file} + +# Bug fix for bind 9: +touch /etc/rndc.key + +# root.hints +file=/var/named/root.hints +bck_file ${file} + +cat ${CWD}/scripts/root.hints.default > ${file} + +# 127.0.0.rev +file=/var/named/127.0.0.rev +bck_file ${file} + +cat ${CWD}/scripts/127.0.0.rev.default \ +|sed "s|__hname__|${wiz_host_name}|g" \ +> ${file} + +up_serial ${file} + +# ipnet.rev + +file=/var/named/${s_trunc}.rev +echo_debug "config about ${file}" +bck_file ${file} + +cat ${CWD}/scripts/ipnet.rev.default > /var/tmp/ipnet.rev.default + +cat /var/tmp/ipnet.rev.default \ +|sed "s|__dname__|${wiz_domain_name}|g" \ +|sed "s|__hname__|${wiz_host_name}|g" \ +|sed "s|__revnet__|${reversenet}|g" \ +|sed "s|__nb__|${ds}|g" \ +> ${file} + +up_serial ${file} + +# domain.db +file=/var/named/${wiz_domain_name}.db +bck_file ${file} +echo_debug "config ${file}" + +cat ${CWD}/scripts/domain.db.default > /var/tmp/domain.db.default + +cat /var/tmp/domain.db.default \ +|sed "s|__dname__|${wiz_domain_name}|g" \ +|sed "s|__hname__|${wiz_host_name}|g" \ +|sed "s|__ip__|${wiz_ip_server}|g" \ +|sed "s|__host__|${host}|g" \ +> ${file} + +up_serial ${file} + +# resolv.conf +file=/etc/resolv.conf +bck_file ${file} +echo_debug "config ${file}" + +echo -e "\ +domain ${wiz_domain_name}\n\ +nameserver ${wiz_ip_server}\n\ +" > ${file} + + + + +# restarting bind +/sbin/chkconfig --level 235 named on +/etc/rc.d/init.d/named restart + + +file=/etc/sysconfig/mdk_serv +wiz_caching_dns="1" +chg_val ${file} wiz_caching_dns ${wiz_caching_dns} s +# all is ok +exit 10 + + + diff --git a/dns_wizard/scripts/domain.db.default b/dns_wizard/scripts/domain.db.default new file mode 100644 index 00000000..3624df67 --- /dev/null +++ b/dns_wizard/scripts/domain.db.default @@ -0,0 +1,31 @@ +$ORIGIN . +$TTL 86400 ; 1 day +__dname__ IN SOA __dname__. root.__dname__. ( + 20000101 ; Serial number + 3600 ; 1 hour refresh + 300 ; 5 minutes retry + 172800 ; 2 days expiry + 43200 ) ; 12 hours minimum + +; List the name servers in use. Unresolved (entries in other zones) +; will go to our ISP's name server isp.domain.name.com + IN NS __hname__. + + + IN MX 10 __hname__. + +$ORIGIN __dname__. +$TTL 86400 ; 1 day + +__host__ IN A __ip__ + +localhost IN A 127.0.0.1 + + ; Alias (canonical) names +ftp IN CNAME __hname__. +www IN CNAME __hname__. +mail IN CNAME __hname__. + + ; List of machine names & addresses +;box2 IN A 192.168.0.2 ; comment +;box3 IN A 192.168.0.3 ; comment diff --git a/dns_wizard/scripts/host.conf.default b/dns_wizard/scripts/host.conf.default new file mode 100644 index 00000000..1a8c1e15 --- /dev/null +++ b/dns_wizard/scripts/host.conf.default @@ -0,0 +1,2 @@ +order hosts,bind +multi on diff --git a/dns_wizard/scripts/ipnet.rev.default b/dns_wizard/scripts/ipnet.rev.default new file mode 100644 index 00000000..6d93cba0 --- /dev/null +++ b/dns_wizard/scripts/ipnet.rev.default @@ -0,0 +1,30 @@ +$ORIGIN . +$TTL 86400 ; 1 day +; default file for 192.168.0.rev (to be used by bind8) +; +; setting a local DNS server for a local Class C network +; with an external DNS referee for non locally resolved address +; +; replace the __xxx__ values by the real ones +; +; Don't forget to upgrade the Serial number after a change +; +__revnet__.in-addr.arpa IN SOA __dname__. root.__dname__. ( + 1999070401 ; Serial + 28800 ; Refresh + 14400 ; Retry + 3600000 ; Expire + 86400 ) ; Minimum + IN NS __hname__. + +$ORIGIN __revnet__.in-addr.arpa. +$TTL 3600 ; 1 hour + +__nb__ IN PTR __hname__. + + +;1 IN PTR box1. +;2 IN PTR box2. + +; 254 IN PTR box254. + diff --git a/dns_wizard/scripts/named.conf.default b/dns_wizard/scripts/named.conf.default new file mode 100644 index 00000000..4c2dd2c5 --- /dev/null +++ b/dns_wizard/scripts/named.conf.default @@ -0,0 +1,54 @@ +options { + // DNS tables are located in the /var/named directory + directory "/var/named"; + pid-file "/var/run/named/named.pid"; + + // Forward any unresolved requests to our ISP's name server + forwarders { + __ISPNS1__; + __ISPNS2__; + }; + /* + * If there is a firewall between you and nameservers you want + * to talk to, you might need to uncomment the query-source + * directive below. Previous versions of BIND always asked + * questions using port 53, but BIND 8.1 uses an unprivileged + * port by default. + */ + // query-source address * port 53; + }; + + + zone "." { + type hint; + file "root.hints"; + }; + // All our DNS information is stored in /var/named/domain.name.db + + zone "__dname__" { + type master; + file "__dname__.db"; + // some security + allow-transfer { 127.0.0.1; }; + }; + + + + zone "0.0.127.in-addr.arpa" { + notify no; + type master; + file "127.0.0.rev"; + allow-transfer { 127.0.0.1; }; + }; + + + zone "__revnet__.in-addr.arpa" { + notify no; + type master; + file "__net__.rev"; + allow-transfer { 127.0.0.1; }; + }; + + + + diff --git a/dns_wizard/scripts/root.hints.default b/dns_wizard/scripts/root.hints.default new file mode 100644 index 00000000..a97a5e89 --- /dev/null +++ b/dns_wizard/scripts/root.hints.default @@ -0,0 +1,44 @@ + +; <<>> DiG 8.2 <<>> +;; res options: init recurs defnam dnsrch +;; got answer: +;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 4 +;; flags: qr rd ra; QUERY: 1, ANSWER: 13, AUTHORITY: 0, ADDITIONAL: 13 +;; QUERY SECTION: +;; ., type = NS, class = IN + +;; ANSWER SECTION: +. 2d11h37m30s IN NS I.ROOT-SERVERS.NET. +. 2d11h37m30s IN NS E.ROOT-SERVERS.NET. +. 2d11h37m30s IN NS D.ROOT-SERVERS.NET. +. 2d11h37m30s IN NS A.ROOT-SERVERS.NET. +. 2d11h37m30s IN NS H.ROOT-SERVERS.NET. +. 2d11h37m30s IN NS C.ROOT-SERVERS.NET. +. 2d11h37m30s IN NS G.ROOT-SERVERS.NET. +. 2d11h37m30s IN NS F.ROOT-SERVERS.NET. +. 2d11h37m30s IN NS B.ROOT-SERVERS.NET. +. 2d11h37m30s IN NS J.ROOT-SERVERS.NET. +. 2d11h37m30s IN NS K.ROOT-SERVERS.NET. +. 2d11h37m30s IN NS L.ROOT-SERVERS.NET. +. 2d11h37m30s IN NS M.ROOT-SERVERS.NET. + +;; ADDITIONAL SECTION: +I.ROOT-SERVERS.NET. 3d11h37m30s IN A 192.36.148.17 +E.ROOT-SERVERS.NET. 3d11h37m30s IN A 192.203.230.10 +D.ROOT-SERVERS.NET. 3d11h37m30s IN A 128.8.10.90 +A.ROOT-SERVERS.NET. 3d11h37m30s IN A 198.41.0.4 +H.ROOT-SERVERS.NET. 3d11h37m30s IN A 128.63.2.53 +C.ROOT-SERVERS.NET. 3d11h37m30s IN A 192.33.4.12 +G.ROOT-SERVERS.NET. 3d11h37m30s IN A 192.112.36.4 +F.ROOT-SERVERS.NET. 3d11h37m30s IN A 192.5.5.241 +B.ROOT-SERVERS.NET. 3d11h37m30s IN A 128.9.0.107 +J.ROOT-SERVERS.NET. 3d11h37m30s IN A 198.41.0.10 +K.ROOT-SERVERS.NET. 3d11h37m30s IN A 193.0.14.129 +L.ROOT-SERVERS.NET. 3d11h37m30s IN A 198.32.64.12 +M.ROOT-SERVERS.NET. 3d11h37m30s IN A 202.12.27.33 + +;; Total query time: 7 msec +;; FROM: keima.mandrakesoft.com to SERVER: default -- 192.168.1.11 +;; WHEN: Fri Mar 24 21:01:57 2000 +;; MSG SIZE sent: 17 rcvd: 436 + |