summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThilo Bangert <bangert@gentoo.org>2002-06-29 00:55:03 +0000
committerThilo Bangert <bangert@gentoo.org>2002-06-29 00:55:03 +0000
commit6fd1686d6b18a634b4c81211c4c7292986fb3f27 (patch)
tree2fe3b5fdb45b1b92faf53493b06c26d8d9b22116 /net-dns/djbdns/files
parentnew category: net-dns (diff)
downloadgentoo-2-6fd1686d6b18a634b4c81211c4c7292986fb3f27.tar.gz
gentoo-2-6fd1686d6b18a634b4c81211c4c7292986fb3f27.tar.bz2
gentoo-2-6fd1686d6b18a634b4c81211c4c7292986fb3f27.zip
new category: net-dns. initial import
Diffstat (limited to 'net-dns/djbdns/files')
-rw-r--r--net-dns/djbdns/files/digest-djbdns-1.05-r21
-rw-r--r--net-dns/djbdns/files/dnscache-setup239
-rw-r--r--net-dns/djbdns/files/tinydns-setup146
3 files changed, 386 insertions, 0 deletions
diff --git a/net-dns/djbdns/files/digest-djbdns-1.05-r2 b/net-dns/djbdns/files/digest-djbdns-1.05-r2
new file mode 100644
index 000000000000..7f303eca6ac3
--- /dev/null
+++ b/net-dns/djbdns/files/digest-djbdns-1.05-r2
@@ -0,0 +1 @@
+MD5 3147c5cd56832aa3b41955c7a51cbeb2 djbdns-1.05.tar.gz 85648
diff --git a/net-dns/djbdns/files/dnscache-setup b/net-dns/djbdns/files/dnscache-setup
new file mode 100644
index 000000000000..b9795c36923a
--- /dev/null
+++ b/net-dns/djbdns/files/dnscache-setup
@@ -0,0 +1,239 @@
+#!/bin/bash
+
+#for einfo, ewarn etc..
+. /sbin/functions.sh
+
+setup() {
+ echo
+ echo
+ einfo "Dnscache Setup"
+ echo
+ echo
+ echo ">>> More information on this package can be found at"
+ echo ">>> http://cr.yp.to/djbdns.html and http://djbdns.org"
+ echo
+ echo "After this script completes, dnscache will be configured."
+ echo "Your /etc/resolv.conf will be updated so that all DNS"
+ echo "lookups will be directed to dnscache."
+ echo
+ echo "Your original /etc/resolv.conf will be backed up to "
+ echo "/etc/resolv.conf.orig."
+ echo
+ echo "If you have previously setup dnscache, those directories will"
+ echo "not be overwritten. To redo setup, delete your dnscache"
+ echo "dirs first or choose a different install location."
+ echo
+ echo '(press enter to begin setup, or press control-C to abort)'
+ echo
+ read
+
+ echo
+ einfo "Install location"
+ echo
+ echo "Where do you want dnscache installed?"
+ echo "Ex. Default (/var) will install dnscache in /var/dnscache,"
+ echo "or an external cache in /var/dnscachex."
+ echo "!!No trailing slash!!"
+ echo
+ read -p "[/var]> " mypath
+ echo
+
+ if [ "$mypath" == "" ]
+ then
+ mypath="/var"
+ fi
+
+ if [ ! -e ${mypath} ]
+ then
+ echo ">>> Creating ${mypath}..."
+ mkdir $mypath
+ fi
+
+ echo
+ echo
+ einfo "Internal or external cache?"
+ echo
+ echo "Specify an address to which dnscache should bind."
+ echo "If this is the only machine accessing dnscache,"
+ echo "127.0.0.1 is a good start."
+ echo "Currently running IP addresses:"
+ echo
+
+ # grab interfaces
+ addrs=`ifconfig -a | grep "inet addr" | cut -f2 -d":" | cut -f1 -d" "`
+
+ echo $addrs
+ echo
+ read -p "IP to bind cache to [127.0.0.1]> " myip
+ echo
+
+ if [ "$myip" == "" ]
+ then
+ myip="127.0.0.1"
+ mycachedir="dnscache"
+ else
+ mycachedir="dnscachex"
+ fi
+
+ # check for existance of users dnscache and dnslog:
+ echo
+ echo
+ einfo "Checking for dnscache and dnslog user accts ..."
+ echo
+ /usr/bin/grep nofiles /etc/group &> /dev/null
+ if [ $? -ne 0 ]
+ then
+ echo ">>> Adding group nofiles ..."
+ /usr/sbin/groupadd nofiles &> /dev/null
+ fi
+
+ /usr/bin/grep dnscache /etc/passwd &> /dev/null
+ if [ $? -ne 0 ]
+ then
+ echo ">>> Adding user dnscache ..."
+ /usr/sbin/useradd -d /dev/null -s /bin/false -g nofiles \
+ dnscache &> /dev/null
+ fi
+
+ /usr/bin/grep dnslog /etc/passwd &> /dev/null
+ if [ $? -ne 0 ]
+ then
+ echo ">>> Adding user dnslog ..."
+ /usr/sbin/useradd -d /dev/null -s /bin/false -g nofiles \
+ dnslog &> /dev/null
+ fi
+
+ if [ ! -e ${mypath}/${mycachedir} ]
+ then
+ /usr/bin/dnscache-conf dnscache dnslog \
+ ${mypath}/${mycachedir} ${myip}
+ else
+ ewarn "*** dnscache directory currently exists, nothing done."
+ fi
+
+ echo
+ echo
+ einfo "Configure a forward for dnscache?"
+ echo
+ echo "dnscache can be configured to forward queries to another"
+ echo "nameserver (such as the nameserver of your ISP) rather than "
+ echo "perform the lookups itself. If you would like to enable this "
+ echo "forwarding mode (a good idea most of the time), then enter the "
+ echo "IP's of your forwarding nameservers now,"
+ echo "otherwise just hit Enter."
+ echo
+ read -p "enter forward-to IP> " myforward
+ echo
+ if [ "$myforward" != "" ]
+ then
+ echo $myforward > ${mypath}/${mycachedir}/root/servers/\@
+ echo -n "1" > ${mypath}/${mycachedir}/env/FOWARDONLY
+
+ read -p "enter forward-to IP [hit Enter to stop]> " myforward
+ while [ "$myforward" != "" ]
+ do
+ echo $myforward >> ${mypath}/${mycachedir}/root/servers/\@
+ read -p "enter forward-to IP [hit Enter to stop]> " myforward
+ done
+ echo ">>> Setting up forwarding..."
+ fi
+
+ if [ "$myip" != "127.0.0.1" ]
+ then
+ echo
+ echo
+ einfo "Configuring clients"
+ echo
+ echo "dnscache by default only allows 127.0.0.1 to access it."
+ echo "You have to specify the IP addresses of the clients"
+ echo "that shall be allowed to use dnscache."
+ echo
+ echo "1.2.3.4 would allow host 1.2.3.4"
+ echo "1.2.3 would allow all hosts underneath 1.2.3.x"
+ echo
+ echo "Just hit Enter if you do not want to specify clients!"
+ echo
+
+ read -p "Enter IP> " myclientip
+
+ while [ "$myclientip" != "" ]
+ do
+ touch ${mypath}/${mycachedir}/root/ip/${myclientip}
+ read -p "Enter IP (hit Enter to stop)>" myclientip
+ done
+ fi
+
+ echo
+ echo
+ einfo "Misc"
+ echo
+ if [ ! -e /var/log/dnscache ]
+ then
+ echo ">>> linking /var/log/${mycachedir} to the $mycachedir log..."
+ ln -s ${mypath}/${mycachedir}/log/main /var/log/${mycachedir}
+ fi
+
+ if [ -e /etc/resolv.conf ]
+ then
+ /usr/bin/grep $myip /etc/resolv.conf &> /dev/null
+ if [ $? -ne 0 ]
+ then
+ echo ">>> Backing up /etc/resolv.conf to resolv.conf.orig..."
+ cp /etc/resolv.conf /etc/resolv.conf.orig
+ cat /etc/resolv.conf.orig | grep -v nameserver > /etc/resolv.conf
+ echo ">>> Removed nameserver entries from resolv.conf..."
+ echo nameserver $myip >> /etc/resolv.conf
+ echo
+ echo ">>> Added \"nameserver ${myip}\" to /etc/resolv.conf!"
+ else
+ echo ">>> ${myip} is already in /etc/resolv.conf - nothing done!"
+ fi
+ else
+ echo nameserver $myip >> /etc/resolv.conf
+ echo
+ echo ">>> Added \"nameserver ${myip}\" to /etc/resolv.conf!"
+ fi
+
+ #TODO
+ #configure cachsize - $mypath/env/CACHESIZE
+
+ #TODO
+ #configure datalimit - $mypath/env/DATALIMIT
+
+ echo
+ echo
+ einfo "Start service"
+ echo
+ echo "dnscache is ready for startup."
+ echo "Do you want dnscache to be started and"
+ echo "supervised by daemontools now?"
+
+ echo
+ echo "This requires svscan (daemontools) to be running currently and"
+ echo "monitoring /service !!"
+ echo
+ echo '(press control-C to abort)'
+ read
+
+ # check in /mnt/.init.d to find svscan link in running...
+ # if not running execute /etc/init.d/svscan start
+
+ ln -sf ${mypath}/${mycachedir} /service/${mycachedir}
+
+ echo
+ echo
+ einfo "Installation successfull"
+ echo
+}
+
+# check for root user
+
+if [ `id -u` -ne 0 ]
+then
+ eerror "${0}: must be root."
+ exit 1
+fi
+
+
+# run setup
+setup
diff --git a/net-dns/djbdns/files/tinydns-setup b/net-dns/djbdns/files/tinydns-setup
new file mode 100644
index 000000000000..f12bfaaf39b7
--- /dev/null
+++ b/net-dns/djbdns/files/tinydns-setup
@@ -0,0 +1,146 @@
+#!/bin/bash
+
+#
+# source functions.sh for einfo, eerror and ewarn
+. /sbin/functions.sh
+
+setup() {
+ echo
+ echo
+ einfo "tinydns Setup"
+ echo
+ echo ">>> More information on this package can be found at"
+ echo ">>> http://cr.yp.to/djbdns/tinydns.html"
+ echo
+ echo "If you have previously setup tinydns, those directories will"
+ echo "not be overwritten. To redo setup, delete your"
+ echo "tinydns dir tree first."
+ echo
+ echo '(press enter to begin setup, or press control-C to abort)'
+ echo
+ read
+
+ echo
+ einfo "Install location"
+ echo
+ echo "Where do you want tinydns installed?"
+ echo "Ex. /var would install dnscache in /var/tinydns."
+ echo "!!No trailing slash!!"
+ echo
+ read -p "[/var]> " mypath
+ echo
+
+ if [ "$mypath" == "" ]
+ then
+ mypath="/var"
+ fi
+
+ if [ ! -e ${mypath} ]
+ then
+ echo ">>> Creating ${mypath}..."
+ mkdir $mypath
+ fi
+
+ # check for existance of users dnscache and dnslog:
+ echo
+ echo
+ einfo "Checking for tinydns and dnslog user accts ..."
+ echo
+ /usr/bin/grep nofiles /etc/group &> /dev/null
+ if [ $? -ne 0 ]
+ then
+ echo ">>> Adding group nofiles ..."
+ /usr/sbin/groupadd nofiles &> /dev/null
+ fi
+
+ /usr/bin/grep tinydns /etc/passwd &> /dev/null
+ if [ $? -ne 0 ]
+ then
+ echo ">>> Adding user dnscache ..."
+ /usr/sbin/useradd -d /dev/null -s /bin/false -g nofiles \
+ dnscache &> /dev/null
+ fi
+
+ /usr/bin/grep dnslog /etc/passwd &> /dev/null
+ if [ $? -ne 0 ]
+ then
+ echo ">>> Adding user dnslog ..."
+ /usr/sbin/useradd -d /dev/null -s /bin/false -g nofiles \
+ dnslog &> /dev/null
+ fi
+
+
+ # grab interfaces
+ addrs=`ifconfig -a | grep "inet addr" | cut -f2 -d":" | cut -f1 -d" "`
+
+ echo "Specify an address to which tinydns should bind."
+ echo "NOTICE: tinydns must be able to bind to port 53 on "
+ echo "choosen ip address! udp by tinydns - tcp by axfrdns"
+ echo "Usually this is NOT 127.0.0.1"
+ echo "Currently running IP addresses:"
+ echo
+ echo $addrs
+ echo
+
+ while [ "$myip" = "" ]
+ do
+ read -p "IP to bind nameserver to>" myip
+ done
+ echo
+
+ if [ ! -e ${mypath}/tinydns ]
+ then
+ einfo "Setting up tinydns..."
+ /usr/bin/tinydns-conf tinydns dnslog \
+ ${mypath}/tinydns $myip
+ else
+ ewarn "*** tinydns directory currently exists, nothing done."
+ fi
+
+ #add afxrdns
+ if [ ! -e ${mypath}/axfrdns ]
+ then
+ einfo "Setting up axfrdns..."
+ /usr/bin/axfrdns-conf tinydns dnslog \
+ ${mypath}/axfrdns ${mypath}/tinydns $myip
+ else
+ ewarn "*** axfrdns directory currently exists, nothing done."
+ fi
+
+ #grant access to axfrdns
+
+ echo
+ echo
+ einfo "Start service"
+ echo
+ echo "tinydns is ready for startup."
+ echo "Do you want dnscache to be started and"
+ echo "supervised by daemontools now?"
+
+ echo
+ echo "This requires daemontools to supervise"
+ echo "/service !!"
+ echo
+ echo '(press control-C to abort)'
+ read
+
+ ln -sf ${mypath}/tinydns /service/
+ ln -sf ${mypath}/axfrdns /service/
+
+ echo
+ echo
+ einfo "Installation successfull"
+ echo
+
+}
+
+# check for root user!
+if [ `id -u` -ne 0 ]
+then
+ eerror "${0}: must be root."
+ exit 1
+fi
+
+
+# run setup
+setup