------BEGIN PGP SIGNED MESSAGE-----
-Hash: SHA512
-
AUX 1.05-errno.patch 238 RMD160 b479d8c16dd8fe7206cba19125dd8866c2584301 SHA1 f23206f3ffc1a8aa6768fdb2ef588012c17eaa79 SHA256 40e01efac08e95bf87b46e2d86378b0a60c234c64080b7f42039178ac6de61af
AUX CVE2008-4392_0001-dnscache-merge-similar-outgoing-queries-ipv6.patch 10049 RMD160 9154f495cfc5eebcb6617b8fa65ee0bea0cbbf80 SHA1 0461b199c048c6b94b659280d04a4f537cdb9c04 SHA256 56c7db6c5bed3200e1f6e4995018c96158085f2f7169c7b148c7c034ddff8111
AUX CVE2008-4392_0001-dnscache-merge-similar-outgoing-queries.patch 9914 RMD160 c416dd6575819cfd40ef0d306ccb14d34a5afc90 SHA1 8dd3ce7758d3a97cafbe6a60ea83f48e916f496d SHA256 b5e030e96ed98d96d36c39e3466e04d98d39c5f1c7e94254ea3da5e99381eed6
AUX CVE2008-4392_0002-dnscache-cache-soa-records-ipv6.patch 3043 RMD160 71ec5a52edc8ba574214f1b05b38d8b9ee313b98 SHA1 c0190b0696f655822e46162489714e9b09b9e831 SHA256 0e6312ab8408d98bc3e6d1b1cddc36f51a5cd092db14bd3f84a8f47d08070c27
AUX CVE2008-4392_0002-dnscache-cache-soa-records.patch 2944 RMD160 0b58e57bc11b36113c5fef73a64c869895f83889 SHA1 ac9b6a62c62588205cc4dc71da4e0ad6630f9635 SHA256 1cd7b848305646d3015d8f2817acdced65894b8ab6e9dacb02077acebc50841b
AUX CVE2009-0858_0001-check-response-domain-name-length.patch 366 RMD160 c9a7ca8ab3e0359cd55caa0fd14ce3878d98c26c SHA1 c64bd006d5ff7ea416d6baeff062b94eebcb8c8d SHA256 8ca8bd81fa6fb17576f11de9e97a582f0c30d7f5c6e797defa41a98d33770e33
-AUX djbdns-setup 11152 RMD160 6de107a57748468996c2d7b5ed00641abf51d67e SHA1 dc9b478709699ce66b64f82f0f1fd1749af2f58a SHA256 f9cac2b3050ce0869afdb1f27af9690fd5fb4817acad1144d8b879233d979713
-AUX djbdns-setup-r17 10881 RMD160 eabdbfd226d6ee4172e55a62beed77bb68aa222c SHA1 f056a51a5f511c54b98536c238eff8c1fecb5755 SHA256 33c64d8341ea868e124e7fe0da6a8f9ba6fc799a79584e002a82c572921ed5e4
+AUX djbdns-setup 10881 RMD160 eabdbfd226d6ee4172e55a62beed77bb68aa222c SHA1 f056a51a5f511c54b98536c238eff8c1fecb5755 SHA256 33c64d8341ea868e124e7fe0da6a8f9ba6fc799a79584e002a82c572921ed5e4
AUX dnscache-setup 6007 RMD160 d5a29943ac29d84a8c83308a497721010ab017bc SHA1 764e3dbecca295c307589c3141fc24c3ff0bc5a5 SHA256 5a69f71468172e9e9636f1cb22e08718a084daa0f31953aae604539d66a2603e
AUX dnsroots.patch 349 RMD160 c3be22070645e27a8c16e9f1dd268963b749c5f7 SHA1 f09404a752062956319b4ebb6d381588df467eba SHA256 99e8ef90a20f66fedf903aa13e3f5360010cf11c27c59dc53b967f02ffe06114
AUX dnstracesort.patch 327 RMD160 aaa564aa9cb0dcad4ebb64121c82bf50fda64254 SHA1 cf8b7825d826bfd3f3314c848a8843c2a5a70ae3 SHA256 f1d83e1365f68571fa4e007d5219720f8d65eb3730040a087fceb0ce2d8806bf
AUX tinydns-setup 3206 RMD160 16679596e3902c8eda4c9605b0fef6e778cdee63 SHA1 e222c22f924882a3b2d496f7d8fbdf61eb4eb0e8 SHA256 73c0610f15e9bbec1998d10eafe4222277eb8cbaf0c58e802f998e9f7b25bbea
DIST djbdns-1.05-test23.diff.bz2 18480 RMD160 33037f2a41abb49c305f3efec4402c6965c8b8b8 SHA1 34251597d211ff00791cb6546e8ef60d75ce5477 SHA256 e702f47b4a4c77fe5cec474a8219a072cfaaee07282650b7e0dd322ed82e8f33
DIST djbdns-1.05.tar.gz 85648 RMD160 a832cbfd93e4ccec6a565492a4ee0b3c1b4b68ed SHA1 2efdb3a039d0c548f40936aa9cb30829e0ce8c3d SHA256 3ccd826a02f3cde39be088e1fc6aed9fd57756b8f970de5dc99fcd2d92536b48
-EBUILD djbdns-1.05-r23.ebuild 3684 RMD160 74a29155bc31f39a9b16d39c6711b585bef06601 SHA1 f5b2e17144d3c03a2845c9bc69eb6c1e5b8f830d SHA256 fe946870ccc68646c51783d040f5f985660764b53f71ab320df46f12a5c48cae
-EBUILD djbdns-1.05-r24.ebuild 3899 RMD160 45d28e6b4579720b3d4f8b774caa3c098c820a91 SHA1 797e4858ce8513ff23be7846c23245427959d90f SHA256 f73acefc7285e65b7a3ea7e030515f41751d0fdaa143c5a5bbd958a8634307d5
-EBUILD djbdns-1.05-r25.ebuild 3972 RMD160 d382f956ac7e6bcb97b8e48271ec99a789636304 SHA1 715830d816b4e3e035d866d0664ea9f0c4fa2f59 SHA256 d8b260b9a8f33ed6dd2094a6b5114ec117234bcc3d2b8534e1744a5b120ef1c9
+EBUILD djbdns-1.05-r23.ebuild 3687 RMD160 3414104bffb0ecafa5a635d7156ad3c66e46cf94 SHA1 a5a1c6eba70e1d550677e28ab6bff19dabf34548 SHA256 7f5a20b42e6dd454f50c991e9bc85c9854aab4b2f5e2658814c45eb8068c3c1f
+EBUILD djbdns-1.05-r24.ebuild 3881 RMD160 5b73d868daccd4bb7fb402379c4933bc156e5641 SHA1 d2fb4324dda3f4837761078981b8a36025a92631 SHA256 d1a75c48c12e2248a6f6551ee5959fa94740367dce576cf70a8067f55da40e95
+EBUILD djbdns-1.05-r25.ebuild 3954 RMD160 b3372e16d8463d8a02c26e3956ca351fde7a09e2 SHA1 fbfd992bf8ffff5195e27d9e5bf7098d578d78b0 SHA256 7823fd811dfe2857bfe446f2f2f8a3f475b90c15d4f3ad7f6e22a22f55f0b113
MISC ChangeLog 19981 RMD160 ef6f16a950a902d407594287f2affa4825512902 SHA1 dd9dbbae90cdb40ed51aab9080248a7c0c56d7e0 SHA256 31a600b30a3981802c840c94edc6ece23baa98e12832006f07786f2fd82c14cf
MISC metadata.xml 409 RMD160 7b69b690876c3e5f44ca61381a7d757b64907978 SHA1 bb4b744ec4c5ae17e26ae313b206a1bfdb2be3db SHA256 50dabe586f27b034bb8b11d38ea34ed030dcaa73221d1498859fabb914f651f0
------BEGIN PGP SIGNATURE-----
-Version: GnuPG v2.0.18 (GNU/Linux)
-
-iQIcBAEBCgAGBQJPUVBAAAoJEPqDWhW0r/LCgOkP/1/4bfRBzGx3+eolUmd0fqZK
-IDBqgQKaS9iuOptDaO2DqKx5ZqcAio8d5pCGH0DYLH7NnCu9t6RO9fbMozKKiEmb
-uXnrptC+gAXAAEklIVQQ5EZ48oftPClkwC/C/wP0zjI2H+VMhLHKGpj/waQFkt8+
-WXgjXiWy+6AXCAm9hgG8hvh4b7GG5j2uGGBGuu1qVlXnLMhuX+ASbbEjiDWW1DOD
-Iki2lU5t7xOPszpFBtG0dEsFko29gZPJXqizy23c+irXw5Kn3YWUQEeTh/4De0YR
-SW03egQOZCyr00xWgpxgNLMW0aKi6uwn9R2v5K2Fr4erGgVDf0wBrqhHAcEkKBCb
-y4LpGgb5m9763pjLa5rBLZnyhD8aygnJQc8rAlf9srHGk4TKobmGbTiQJueF5AKB
-NyHGsSZ5oG1qhU4/mZ0ruel8o+nQJmh7PkKaSWPmORFxyMHTtNYnzTAy9hBY5r75
-S+XfjwsexCVettE080L7r6MTKUzNrASqyWUj42aYXRPHLJUDsYK/HiEnOne6HSIq
-LJD5GA1YM/yKBPs70KDOC+yLiCPn2eKIpQzJXg1QSPTeN/yIZUqO4jWPLT1xsUN4
-xGTSmUo4jVg3+bP4up5RsXglvAue/PfdnJdQ2TiU2oPIR5zwq40I6lRrTR4vWFK7
-k0pmzRNA/GrPG2MdNLLV
-=inkE
------END PGP SIGNATURE-----
#
# djbdns-setup
#
-# Copyright (C) 2004 Kalin Kozhuharov <kalin@ThinRope.net>
+# Copyright (C) 2004-2006 Kalin KOZHUHAROV <kalin@thinrope.net>
+# The latest version of this script can be accessed at:
+# rsync://rsync.tar.bz/gentoo-portage-pkalin/net-dns/djbdns/files/djbdns-setup
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# http://www.gnu.org/copyleft/gpl.html
#
-. /sbin/functions.sh
-# void ewarn(char* message)
-#
-# show a warning message and do NOT log it
+# {{{ Rip off the ewarn code from /sbin/functions.sh
+WARN=$'\e[33;01m'
+NORMAL=$'\e[0m'
ewarn() {
- if [ "${RC_QUIET_STDOUT}" = "yes" ]
- then
- echo " ${*}"
- else
- echo -e " ${WARN}*${NORMAL} ${*}"
- fi
-
+ echo -e " ${WARN}*${NORMAL} $*"
return 0
}
+# }}}
+# {{{ global vars
S_SEPARATOR="--------------------------------------------------------------------------------"
D_SEPARATOR="================================================================================"
tinydns=1
axfrdns=2
+# global vars }}}
+
+# {{{ functions
check_group_users()
{
- echo ": Checking for required group (${REQ_GROUP}) :"
- grep ${REQ_GROUP} /etc/group &> /dev/null
- if [ $? -ne 0 ]
- then
+ echo ": Checking for required group (${REQ_GROUP}) :"
+ grep ${REQ_GROUP} /etc/group &> /dev/null
+ if [ $? -ne 0 ]
+ then
ebegin "Adding group ${REQ_GROUP}"
/usr/sbin/groupadd ${REQ_GROUP} &>/dev/null && eend 0 || eend 1
- fi
+ fi
- echo ": Checking for required users (${REQ_USERS}) :"
- for user in ${REQ_USERS};
- do
+ echo ": Checking for required users (${REQ_USERS}) :"
+ for user in ${REQ_USERS};
+ do
grep ${user} /etc/passwd &> /dev/null
if [ $? -ne 0 ]
then
- ebegin "Adding user ${user}"
- /usr/sbin/useradd -d /dev/null -s /bin/false -g ${REQ_GROUP} ${user} &>/dev/null && eend 0 || eend 1
+ ebegin "Adding user ${user}"
+ /usr/sbin/useradd -d /dev/null -s /bin/false -g ${REQ_GROUP} ${user} &>/dev/null && eend 0 || eend 1
fi
- done
- return 0
+ done
+ return 0
}
start_services()
{
- local services="$1"
-
- echo "${SEPARATOR}"
- echo ": Start services :"
- echo
- echo " Your services (${services// /, }) are ready for startup!"
- echo
- ewarn " The following requires daemontools to be running!"
- local answer=""
- read -p " Would you like ${services// /, } to be started and supervised by daemontools now? [Y|n]> " answer
- if [ "${answer}" == "Y" ] || [ "${answer}" == "" ]
- then
+ local services="$1"
+
+ echo "${SEPARATOR}"
+ echo ": Start services :"
+ echo
+ echo " Your services (${services// /, }) are ready for startup!"
+ echo
+ ewarn " The following requires daemontools to be running!"
+ local answer=""
+ read -p " Would you like ${services// /, } to be started and supervised by daemontools now? [Y|n]> " answer
+ if [ "${answer}" == "Y" ] || [ "${answer}" == "" ]
+ then
ebegin "Checking if daemontools are running"
ps -A |grep svscanboot &>/dev/null && eend 0 || eend 1
local fixedroot_path=`echo ${mypath} | sed -e 's#^/#../#'`
for service in ${services};
do
- for ip in ${IPs[${service}]};
- do
+ for ip in ${IPs[${service}]};
+ do
ln -sf ${fixedroot_path}/${service}/${ip} /service/${service}_${ip}
- done
+ done
done
eend 0
echo
for service in ${services};
do
- for ip in ${IPs[${service}]};
- do
+ for ip in ${IPs[${service}]};
+ do
svstat /service/${service}_${ip} /service/${service}_${ip}/log
- done
+ done
done
- fi
- return 0
+ fi
+ return 0
}
tinydns_setup()
{
- return 0
+ return 0
}
axfrdns_setup()
echo
TCPRULES_DIR="${mypath}/axfrdns/${myip}/control"
echo " axfrdns is accessed by your secondary servers and when response cannot fit UDP packet"
- echo " You have to specify their which IP addresses are allowed to access it"
+ echo " You have to specify which IP addresses are allowed to access it"
echo " in ${TCPRULES_DIR}/tcp.axfrdns"
echo
echo " Example:"
sed -i -e "s#-x tcp.cdb#-x control/tcp.axfrdns.cdb#g" ${mypath}/axfrdns/${myip}/run
if [ -e ${TCPRULES_DIR}/tcp.axfrdns ]
then
- ewarn "${TCPRULES_DIR}/tcp.axfrdns exists."
- read -p " Do you want it cleared? [Y|n]: " answer
- if [ "${answer}" == "Y" ] || [ "${answer}" == "" ]
- then
+ ewarn "${TCPRULES_DIR}/tcp.axfrdns exists."
+ read -p " Do you want it cleared? [y|N]: " answer
+ if [ "${answer}" == "y" ]
+ then
echo '# sample line: 1.2.3.4:allow,AXFR="heaven.af.mil/3.2.1.in-addr.arpa"' > ${TCPRULES_DIR}/tcp.axfrdns
- fi
+ fi
fi
read -p " IP to allow (press Enter to end)> " ipallow
while [ "$ipallow" != "" ]
do
- echo "${ipallow}:allow" >> ${TCPRULES_DIR}/tcp.axfrdns
- read -p " IP to allow (press Enter to end)> " ipallow
+ echo "${ipallow}:allow" >> ${TCPRULES_DIR}/tcp.axfrdns
+ read -p " IP to allow (press Enter to end)> " ipallow
done
echo ":deny" >> ${TCPRULES_DIR}/tcp.axfrdns
- echo " Here is the tcprules file created so far:"
+ echo " Here are the tcprules created so far:"
echo
cat ${TCPRULES_DIR}/tcp.axfrdns
echo
read -p " Would you like ${TCPRULES_DIR}/tcp.axfrdns.cdb updated? [Y|n]: " answer
if [ "${answer}" == "Y" ] || [ "${answer}" == "" ]
then
- ebegin "Updating ${TCPRULES_DIR}/tcp.axfrdns.cdb"
- bash -c "cd ${TCPRULES_DIR} && make" && eend 0 || eend 1
+ ebegin "Updating ${TCPRULES_DIR}/tcp.axfrdns.cdb"
+ bash -c "cd ${TCPRULES_DIR} && make" && eend 0 || eend 1
fi
return 0
}
{
echo ": Configure forwarding :"
echo
- echo " dnscache can be configured to forward queries to another DNS cache"
- echo " (such as the one your ISP provides) rather than perform the lookups itself."
+ echo " dnscache can be configured to forward queries to another"
+ echo " DNS cache (such as the one your ISP provides) rather than"
+ echo " performing the lookups itself."
echo
- echo " To enable this forwarding-only mode (a good idea most of the time),"
+ echo " To enable this forwarding-only mode (usually a good idea),"
echo " provide the IPs of the caches to forward to."
echo " To have dnscache perform the lookups itself, just press Enter."
echo
echo
if [ "$myforward" != "" ]
then
- echo $myforward > ${mypath}/dnscache/${myip}/root/servers/\@
- echo -n "1" > ${mypath}/dnscache/${myip}/env/FORWARDONLY
+ echo $myforward > ${mypath}/dnscache/${myip}/root/servers/\@
+ echo -n "1" > ${mypath}/dnscache/${myip}/env/FORWARDONLY
- read -p " forward-to IP (press Enter to end)> " myforward
- while [ "$myforward" != "" ]
- do
+ read -p " forward-to IP (press Enter to end)> " myforward
+ while [ "$myforward" != "" ]
+ do
echo $myforward >> ${mypath}/dnscache/${myip}/root/servers/\@
read -p " forward-to IP (press Enter to end)> " myforward
- done
+ done
- echo
- echo " Currently all queries will be forwarded to:"
- echo
- cat ${mypath}/dnscache/${myip}/root/servers/\@
- echo
+ echo
+ echo " Currently all queries will be forwarded to:"
+ echo
+ cat ${mypath}/dnscache/${myip}/root/servers/\@
+ echo
fi
echo "${SEPARATOR}"
echo ": Configuring clients :"
echo
- echo " By default dnscache allows only localhost (127.0.0.1) to access it."
- echo " You have to specify the IP addresses of the clients that shall be allowed to use it."
+ echo " By default dnscache allows only localhost (127.0.0.1) to"
+ echo " access it. You have to specify the IP addresses of the"
+ echo " clients that shall be allowed to use it."
echo
echo " Example:"
- echo " 1.2.3.4 would allow only the host 1.2.3.4"
- echo " 1.2.3 would allow all hosts 1.2.3.x (like 1.2.3.4, 1.2.3.100, etc.)"
+ echo " 1.2.3.4 would allow only one host: 1.2.3.4"
+ echo " 1.2.3 would allow all hosts 1.2.3.0/24 (e.g. 1.2.3.4, 1.2.3.100, etc.)"
echo
- echo " Press Enter if you do not want to allow external clients!"
+ echo " Press Enter if you do NOT want to allow external clients!"
echo
read -p " Allowed IP> " myclientip
while [ "$myclientip" != "" ]
do
- touch ${mypath}/dnscache/${myip}/root/ip/${myclientip}
- read -p " Allowed IP (press Enter to end)> " myclientip
+ touch ${mypath}/dnscache/${myip}/root/ip/${myclientip}
+ read -p " Allowed IP (press Enter to end)> " myclientip
done
echo
common_setup()
{
- local service_human="$1"
- local service_machine="$2"
- local services="$3"
+ local service_human="$1"
+ local service_machine="$2"
+ local services="$3"
- echo ": ${service_human} setup :"
- echo
+ echo ": ${service_human} setup :"
+ echo
- for service in ${services};
- do
+ for service in ${services};
+ do
if [ ! -e ${mypath}/${service} ]
then
- ebegin "Creating ${mypath}/${service}"
- mkdir -p $mypath/${service} && eend 0 || eend 1
+ ebegin "Creating ${mypath}/${service}"
+ mkdir -p $mypath/${service} && eend 0 || eend 1
fi
- done
-
- echo "${SEPARATOR}"
- echo ": IP address to bind to :"
- echo
- echo " Specify an address to which the ${service_human} should bind."
- echo " Currently accessible IPs:"
- local addrs=`ifconfig -a | grep "inet addr" | cut -f2 -d":" | cut -f1 -d" "`
- echo " "$addrs
- echo
-
- while [ "${myip}" == "" ]
- do
+ done
+
+ echo "${SEPARATOR}"
+ echo ": IP address to bind to :"
+ echo
+ echo " Specify an address to which the ${service_human} should bind."
+ echo " Currently accessible IPs:"
+ local addrs=`ifconfig -a | grep "inet addr" | cut -f2 -d":" | cut -f1 -d" "`
+ echo " "$addrs
+ echo
+
+ while [ "${myip}" == "" ]
+ do
read -p " IP to bind to> " myip
- done
- echo
+ done
+ echo
- for service in ${services};
- do
+ for service in ${services};
+ do
IPs[${service}]="${IPs[${service}]} ${myip}"
- done
+ done
- local dnscache_INSTALL="/usr/bin/dnscache-conf dnscache dnslog ${mypath}/dnscache/${myip} $myip"
- local tinydns_INSTALL="/usr/bin/tinydns-conf tinydns dnslog ${mypath}/tinydns/${myip} $myip"
- local axfrdns_INSTALL="\
+ local dnscache_INSTALL="/usr/bin/dnscache-conf dnscache dnslog ${mypath}/dnscache/${myip} $myip"
+ local tinydns_INSTALL="/usr/bin/tinydns-conf tinydns dnslog ${mypath}/tinydns/${myip} $myip"
+ local axfrdns_INSTALL="\
/usr/bin/axfrdns-conf tinydns dnslog ${mypath}/axfrdns/${myip} ${mypath}/tinydns/${myip} $myip &&\
mkdir -p ${mypath}/axfrdns/${myip}/control &&\
echo -e \"tcp.axfrdns.cdb:\ttcp.axfrdns\n\ttcprules tcp.axfrdns.cdb .tcp.axfrdns.cdb.tmp < tcp.axfrdns\" > ${mypath}/axfrdns/${myip}/control/Makefile &&\
rm -f ${mypath}/axfrdns/${myip}/tcp ${mypath}/axfrdns/${myip}/Makefile"
- for service in ${services};
- do
+ for service in ${services};
+ do
if [ ! -e ${mypath}/${service}/${myip} ]
then
- ebegin "Setting up ${service} in ${mypath}/${service}/${myip}"
- eval command=\$${service}_INSTALL
- /bin/bash -c "${command}" && eend 0 || eend 1
+ ebegin "Setting up ${service} in ${mypath}/${service}/${myip}"
+ eval command=\$${service}_INSTALL
+ /bin/bash -c "${command}" && eend 0 || eend 1
else
- ewarn "${service} directory ${mypath}/${service}/${myip} exists, nothing done."
+ ewarn "${service} directory ${mypath}/${service}/${myip} exists, nothing done."
fi
- done
+ done
}
+# functions }}}
-
-
-
+# {{{ main script
if [ `id -u` -ne 0 ]
then
- eerror "${0}: You must be root."
+ ewarn "You must be root to run this script, sorry."
exit 1
else
- echo "${D_SEPARATOR}"
- echo ": DJB DNS setup :"
- echo
- echo " This script will help you setup the following:"
- echo
- echo " DNS server(s): to publish addresses of Internet hosts"
- echo
- echo " DNS cache(s) : to find addresses of Internet hosts"
- echo
- echo " For further information see:"
- echo " http://cr.yp.to/djbdns/blurb/overview.html"
- echo
- ewarn "If you have already setup your services,"
- ewarn "either exit now, or setup in different directories."
- echo
-
- answer=""
- read -p " Would you like to continue with setup? [Y|n]> " answer
- if [ "${answer}" == "n" ] || [ "${answer}" == "N" ]
- then
+ echo "${D_SEPARATOR}"
+ echo ": DJB DNS setup :"
+ echo
+ echo " This script will help you setup the following:"
+ echo
+ echo " DNS server(s): to publish addresses of Internet hosts"
+ echo
+ echo " DNS cache(s) : to find addresses of Internet hosts"
+ echo
+ echo " For further information see:"
+ echo " http://cr.yp.to/djbdns/blurb/overview.html"
+ echo
+ ewarn "If you have already setup your services,"
+ ewarn "either exit now, or setup in different directories."
+ echo
+
+ answer=""
+ read -p " Would you like to continue with setup? [Y|n]> " answer
+ if [ "${answer}" == "n" ] || [ "${answer}" == "N" ]
+ then
ewarn "Aborting setup"
exit 1
- fi
-
- echo "${D_SEPARATOR}"
- echo ": Choose install location :"
- echo
- default_path="/var"
- echo " The default (${default_path}) will install them"
- echo " in ${default_path}/\${service}/\${IP_ADDRESS}"
- echo
- echo " For example:"
- echo " /var/tinydns /1.2.3.4"
- echo " /192.168.33.1"
- echo " /axfrdns /1.2.3.4"
- echo " /192.168.33.1"
- echo " /dnscache/127.0.0.1"
- echo
- ewarn "Do NOT enter trailing slash"
- echo " Where do you want services installed?"
- read -p "[${default_path}] > " mypath
- echo
-
- if [ "${mypath}" == "" ]
- then
+ fi
+
+ echo "${D_SEPARATOR}"
+ echo ": Choose install location :"
+ echo
+ default_path="/var"
+ echo " The default (${default_path}) will install them"
+ echo " in ${default_path}/\${service}/\${IP_ADDRESS}"
+ echo
+ echo " For example:"
+ echo " /var/tinydns /1.2.3.4"
+ echo " /192.168.33.1"
+ echo " /axfrdns /1.2.3.4"
+ echo " /192.168.33.1"
+ echo " /dnscache/127.0.0.1"
+ echo
+ ewarn "Do NOT enter trailing slash"
+ echo " Where do you want services installed?"
+ read -p "[${default_path}] > " mypath
+ echo
+
+ if [ "${mypath}" == "" ]
+ then
mypath=${default_path}
- fi
+ fi
- echo "${D_SEPARATOR}"
- check_group_users
+ echo "${D_SEPARATOR}"
+ check_group_users
- answer=""
- another=""
- until [ "$answer" == "n" ]
- do
+ answer=""
+ another=""
+ until [ "$answer" == "n" ]
+ do
echo "${D_SEPARATOR}"
answer=""
read -p " Would you like to setup ${another}dnscache? [Y|n]> " answer
if [ "${answer}" == "Y" ] || [ "${answer}" == "" ]
then
- myip=""
- echo "${S_SEPARATOR}"
- common_setup "DNS cache" "dnscache" "dnscache"
- if [ $? == 0 ]
- then
+ myip=""
+ echo "${S_SEPARATOR}"
+ common_setup "DNS cache" "dnscache" "dnscache"
+ if [ $? == 0 ]
+ then
dnscache_setup
- else
+ else
ewarn "Skipping dnscache specific setup."
- fi
+ fi
fi
another="another "
- done
+ done
- answer=""
- another=""
- until [ "$answer" == "n" ]
- do
+ answer=""
+ another=""
+ until [ "$answer" == "n" ]
+ do
echo "${D_SEPARATOR}"
answer=""
read -p " Would you like to setup ${another}DNS server? [Y|n]> " answer
if [ "${answer}" == "Y" ] || [ "${answer}" == "" ]
then
- myip=""
- echo "${S_SEPARATOR}"
- common_setup "DNS server" "{tinydns,afxrdns}" "tinydns axfrdns"
- if [ $? == 0 ]
- then
+ myip=""
+ echo "${S_SEPARATOR}"
+ common_setup "DNS server" "{tinydns,afxrdns}" "tinydns axfrdns"
+ if [ $? == 0 ]
+ then
tinydns_setup
axfrdns_setup
- else
+ else
ewarn "Skipping tinydns and axfrdns specific setup."
- fi
+ fi
fi
another="another "
- done
+ done
- echo "${D_SEPARATOR}"
+ echo "${D_SEPARATOR}"
- start_services "tinydns axfrdns dnscache"
-
- echo "${D_SEPARATOR}"
+ start_services "tinydns axfrdns dnscache"
+
+ echo "${D_SEPARATOR}"
fi
+# main script }}}
+# vim: set ts=4 fenc=utf-8 foldmethod=marker:
+++ /dev/null
-#!/bin/bash
-#
-# djbdns-setup
-#
-# Copyright (C) 2004-2006 Kalin KOZHUHAROV <kalin@thinrope.net>
-# The latest version of this script can be accessed at:
-# rsync://rsync.tar.bz/gentoo-portage-pkalin/net-dns/djbdns/files/djbdns-setup
-#
-# 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.
-
-# 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.
-# http://www.gnu.org/copyleft/gpl.html
-#
-
-# {{{ Rip off the ewarn code from /sbin/functions.sh
-WARN=$'\e[33;01m'
-NORMAL=$'\e[0m'
-ewarn() {
- echo -e " ${WARN}*${NORMAL} $*"
- return 0
-}
-# }}}
-
-# {{{ global vars
-S_SEPARATOR="--------------------------------------------------------------------------------"
-D_SEPARATOR="================================================================================"
-
-REQ_GROUP="nofiles"
-REQ_USERS="tinydns dnscache dnslog"
-
-IPs[0]=""
-IPs[1]=""
-IPs[2]=""
-dnscache=0
-tinydns=1
-axfrdns=2
-
-# global vars }}}
-
-# {{{ functions
-check_group_users()
-{
- echo ": Checking for required group (${REQ_GROUP}) :"
- grep ${REQ_GROUP} /etc/group &> /dev/null
- if [ $? -ne 0 ]
- then
- ebegin "Adding group ${REQ_GROUP}"
- /usr/sbin/groupadd ${REQ_GROUP} &>/dev/null && eend 0 || eend 1
- fi
-
- echo ": Checking for required users (${REQ_USERS}) :"
- for user in ${REQ_USERS};
- do
- grep ${user} /etc/passwd &> /dev/null
- if [ $? -ne 0 ]
- then
- ebegin "Adding user ${user}"
- /usr/sbin/useradd -d /dev/null -s /bin/false -g ${REQ_GROUP} ${user} &>/dev/null && eend 0 || eend 1
- fi
- done
- return 0
-}
-
-start_services()
-{
- local services="$1"
-
- echo "${SEPARATOR}"
- echo ": Start services :"
- echo
- echo " Your services (${services// /, }) are ready for startup!"
- echo
- ewarn " The following requires daemontools to be running!"
- local answer=""
- read -p " Would you like ${services// /, } to be started and supervised by daemontools now? [Y|n]> " answer
- if [ "${answer}" == "Y" ] || [ "${answer}" == "" ]
- then
-
- ebegin "Checking if daemontools are running"
- ps -A |grep svscanboot &>/dev/null && eend 0 || eend 1
-
- ebegin "Linking services in /service"
- # Don't make symbolic links to / !
- # use ../ instead as it gives trouble in chrooted environments
- local fixedroot_path=`echo ${mypath} | sed -e 's#^/#../#'`
- for service in ${services};
- do
- for ip in ${IPs[${service}]};
- do
- ln -sf ${fixedroot_path}/${service}/${ip} /service/${service}_${ip}
- done
- done
-
- eend 0
-
- echo
- ls -l --color=auto /service/
- echo
- ebegin "Waiting 5 seconds for services to start"
- sleep 5 && eend 0
-
- echo "${SEPARATOR}"
- echo ": Check services status :"
- echo
- for service in ${services};
- do
- for ip in ${IPs[${service}]};
- do
- svstat /service/${service}_${ip} /service/${service}_${ip}/log
- done
- done
- fi
- return 0
-}
-
-tinydns_setup()
-{
- return 0
-}
-
-axfrdns_setup()
-{
- echo "${S_SEPARATOR}"
- echo ": Grant access to axfrdns :"
- echo
- TCPRULES_DIR="${mypath}/axfrdns/${myip}/control"
- echo " axfrdns is accessed by your secondary servers and when response cannot fit UDP packet"
- echo " You have to specify which IP addresses are allowed to access it"
- echo " in ${TCPRULES_DIR}/tcp.axfrdns"
- echo
- echo " Example:"
- echo " 1.2.3.4 would allow the host 1.2.3.4"
- echo " 1.2.3. would allow ALL hosts 1.2.3.x (like 1.2.3.4, 1.2.3.100, etc.)"
- ewarn "Do NOT forget the trailing dot!"
- echo
- echo " Press Enter if you do not want to allow any access now."
- echo
-
- sed -i -e "s#-x tcp.cdb#-x control/tcp.axfrdns.cdb#g" ${mypath}/axfrdns/${myip}/run
- if [ -e ${TCPRULES_DIR}/tcp.axfrdns ]
- then
- ewarn "${TCPRULES_DIR}/tcp.axfrdns exists."
- read -p " Do you want it cleared? [y|N]: " answer
- if [ "${answer}" == "y" ]
- then
- echo '# sample line: 1.2.3.4:allow,AXFR="heaven.af.mil/3.2.1.in-addr.arpa"' > ${TCPRULES_DIR}/tcp.axfrdns
- fi
- fi
-
- read -p " IP to allow (press Enter to end)> " ipallow
-
- while [ "$ipallow" != "" ]
- do
- echo "${ipallow}:allow" >> ${TCPRULES_DIR}/tcp.axfrdns
- read -p " IP to allow (press Enter to end)> " ipallow
- done
- echo ":deny" >> ${TCPRULES_DIR}/tcp.axfrdns
-
- echo " Here are the tcprules created so far:"
- echo
- cat ${TCPRULES_DIR}/tcp.axfrdns
- echo
- local answer=""
- read -p " Would you like ${TCPRULES_DIR}/tcp.axfrdns.cdb updated? [Y|n]: " answer
- if [ "${answer}" == "Y" ] || [ "${answer}" == "" ]
- then
- ebegin "Updating ${TCPRULES_DIR}/tcp.axfrdns.cdb"
- bash -c "cd ${TCPRULES_DIR} && make" && eend 0 || eend 1
- fi
- return 0
-}
-
-dnscache_setup()
-{
- echo ": Configure forwarding :"
- echo
- echo " dnscache can be configured to forward queries to another"
- echo " DNS cache (such as the one your ISP provides) rather than"
- echo " performing the lookups itself."
- echo
- echo " To enable this forwarding-only mode (usually a good idea),"
- echo " provide the IPs of the caches to forward to."
- echo " To have dnscache perform the lookups itself, just press Enter."
- echo
- read -p " forward-to IP> " myforward
- echo
- if [ "$myforward" != "" ]
- then
- echo $myforward > ${mypath}/dnscache/${myip}/root/servers/\@
- echo -n "1" > ${mypath}/dnscache/${myip}/env/FORWARDONLY
-
- read -p " forward-to IP (press Enter to end)> " myforward
- while [ "$myforward" != "" ]
- do
- echo $myforward >> ${mypath}/dnscache/${myip}/root/servers/\@
- read -p " forward-to IP (press Enter to end)> " myforward
- done
-
- echo
- echo " Currently all queries will be forwarded to:"
- echo
- cat ${mypath}/dnscache/${myip}/root/servers/\@
- echo
- fi
-
- echo "${SEPARATOR}"
- echo ": Configuring clients :"
- echo
- echo " By default dnscache allows only localhost (127.0.0.1) to"
- echo " access it. You have to specify the IP addresses of the"
- echo " clients that shall be allowed to use it."
- echo
- echo " Example:"
- echo " 1.2.3.4 would allow only one host: 1.2.3.4"
- echo " 1.2.3 would allow all hosts 1.2.3.0/24 (e.g. 1.2.3.4, 1.2.3.100, etc.)"
- echo
- echo " Press Enter if you do NOT want to allow external clients!"
- echo
-
- read -p " Allowed IP> " myclientip
-
- while [ "$myclientip" != "" ]
- do
- touch ${mypath}/dnscache/${myip}/root/ip/${myclientip}
- read -p " Allowed IP (press Enter to end)> " myclientip
- done
-
- echo
- echo " All queries from the hosts below will be answered:"
- echo
- ls -1 ${mypath}/dnscache/${myip}/root/ip
- echo
-
- #TODO
- #configure cachsize - $mypath/env/CACHESIZE
-
- #TODO
- #configure datalimit - $mypath/env/DATALIMIT
- return 0
-}
-
-common_setup()
-{
- local service_human="$1"
- local service_machine="$2"
- local services="$3"
-
- echo ": ${service_human} setup :"
- echo
-
- for service in ${services};
- do
- if [ ! -e ${mypath}/${service} ]
- then
- ebegin "Creating ${mypath}/${service}"
- mkdir -p $mypath/${service} && eend 0 || eend 1
- fi
- done
-
- echo "${SEPARATOR}"
- echo ": IP address to bind to :"
- echo
- echo " Specify an address to which the ${service_human} should bind."
- echo " Currently accessible IPs:"
- local addrs=`ifconfig -a | grep "inet addr" | cut -f2 -d":" | cut -f1 -d" "`
- echo " "$addrs
- echo
-
- while [ "${myip}" == "" ]
- do
- read -p " IP to bind to> " myip
- done
- echo
-
- for service in ${services};
- do
- IPs[${service}]="${IPs[${service}]} ${myip}"
- done
-
- local dnscache_INSTALL="/usr/bin/dnscache-conf dnscache dnslog ${mypath}/dnscache/${myip} $myip"
- local tinydns_INSTALL="/usr/bin/tinydns-conf tinydns dnslog ${mypath}/tinydns/${myip} $myip"
- local axfrdns_INSTALL="\
- /usr/bin/axfrdns-conf tinydns dnslog ${mypath}/axfrdns/${myip} ${mypath}/tinydns/${myip} $myip &&\
- mkdir -p ${mypath}/axfrdns/${myip}/control &&\
- echo -e \"tcp.axfrdns.cdb:\ttcp.axfrdns\n\ttcprules tcp.axfrdns.cdb .tcp.axfrdns.cdb.tmp < tcp.axfrdns\" > ${mypath}/axfrdns/${myip}/control/Makefile &&\
- rm -f ${mypath}/axfrdns/${myip}/tcp ${mypath}/axfrdns/${myip}/Makefile"
-
- for service in ${services};
- do
- if [ ! -e ${mypath}/${service}/${myip} ]
- then
- ebegin "Setting up ${service} in ${mypath}/${service}/${myip}"
- eval command=\$${service}_INSTALL
- /bin/bash -c "${command}" && eend 0 || eend 1
- else
- ewarn "${service} directory ${mypath}/${service}/${myip} exists, nothing done."
- fi
- done
-
-}
-
-# functions }}}
-
-# {{{ main script
-
-if [ `id -u` -ne 0 ]
-then
- ewarn "You must be root to run this script, sorry."
- exit 1
-else
-
- echo "${D_SEPARATOR}"
- echo ": DJB DNS setup :"
- echo
- echo " This script will help you setup the following:"
- echo
- echo " DNS server(s): to publish addresses of Internet hosts"
- echo
- echo " DNS cache(s) : to find addresses of Internet hosts"
- echo
- echo " For further information see:"
- echo " http://cr.yp.to/djbdns/blurb/overview.html"
- echo
- ewarn "If you have already setup your services,"
- ewarn "either exit now, or setup in different directories."
- echo
-
- answer=""
- read -p " Would you like to continue with setup? [Y|n]> " answer
- if [ "${answer}" == "n" ] || [ "${answer}" == "N" ]
- then
- ewarn "Aborting setup"
- exit 1
- fi
-
- echo "${D_SEPARATOR}"
- echo ": Choose install location :"
- echo
- default_path="/var"
- echo " The default (${default_path}) will install them"
- echo " in ${default_path}/\${service}/\${IP_ADDRESS}"
- echo
- echo " For example:"
- echo " /var/tinydns /1.2.3.4"
- echo " /192.168.33.1"
- echo " /axfrdns /1.2.3.4"
- echo " /192.168.33.1"
- echo " /dnscache/127.0.0.1"
- echo
- ewarn "Do NOT enter trailing slash"
- echo " Where do you want services installed?"
- read -p "[${default_path}] > " mypath
- echo
-
- if [ "${mypath}" == "" ]
- then
- mypath=${default_path}
- fi
-
- echo "${D_SEPARATOR}"
- check_group_users
-
- answer=""
- another=""
- until [ "$answer" == "n" ]
- do
- echo "${D_SEPARATOR}"
- answer=""
- read -p " Would you like to setup ${another}dnscache? [Y|n]> " answer
- if [ "${answer}" == "Y" ] || [ "${answer}" == "" ]
- then
- myip=""
- echo "${S_SEPARATOR}"
- common_setup "DNS cache" "dnscache" "dnscache"
- if [ $? == 0 ]
- then
- dnscache_setup
- else
- ewarn "Skipping dnscache specific setup."
- fi
- fi
- another="another "
- done
-
- answer=""
- another=""
- until [ "$answer" == "n" ]
- do
- echo "${D_SEPARATOR}"
- answer=""
- read -p " Would you like to setup ${another}DNS server? [Y|n]> " answer
- if [ "${answer}" == "Y" ] || [ "${answer}" == "" ]
- then
- myip=""
- echo "${S_SEPARATOR}"
- common_setup "DNS server" "{tinydns,afxrdns}" "tinydns axfrdns"
- if [ $? == 0 ]
- then
- tinydns_setup
- axfrdns_setup
- else
- ewarn "Skipping tinydns and axfrdns specific setup."
- fi
- fi
- another="another "
- done
-
- echo "${D_SEPARATOR}"
-
- start_services "tinydns axfrdns dnscache"
-
- echo "${D_SEPARATOR}"
-fi
-# main script }}}
-# vim: set ts=4 fenc=utf-8 foldmethod=marker: