All pastes #961138 Raw Edit

Someone

public text v1 · immutable
#961138 ·published 2008-03-28 18:19 UTC
rendered paste body
TinyDNS on FreeBSD (revised from http://www.djbdnsrocks.org by James McMillan)
____________________________________________________________

Prerequisites: ucspi-tcp, daemontools, apache, php, mysql

The Following Document assumes that your webroot is in `/usr/local/www/apache22/`, if it is not change it in the appropriate places.

Lines Begining with a '#' are shell commands.  All else are comments.

This Document is for a single DNS server.  I will add the secondary soon.

# fetch http://www.djbdnsrocks.org/downloads/djbdnsrocks.tar.gz
# mkdir /downloads
# cd /downloads
# tar zxvf djbdnsrocks.tar.gz
# cd djbdnsrocks 
# tar zxvf djbdns-1.05.tar.gz
# cd djbdns-1.05
# make
# make setup check
# pw useradd tinydns -s /sbin/nologin -d /dev/null
# pw useradd dnslog -s /sbin/nologin -d /dev/null
# pw useradd syncdns -s /sbin/nologin -d /etc/syncdns
# pw useradd dnscache -s /sbin/nologin -d /dev/null
Run the following command replacing "ip.address.of.yournameserver" with the ip address of your nameserver
# /usr/local/bin/tinydns-conf tinydns dnslog /etc/tinydns ip.address.of.yournameserver
# ln -s /etc/tinydns /service

# ps axf | grep tiny

You should see some ps output showing supervise running tinydns

# dnscache-conf dnscache dnslog /etc/dnscache 127.0.0.1
# ln -s /etc/dnscache /service
# cp /etc/resolv.conf /etc/resolv.conf.orig
# echo nameserver 127.0.0.1 > /etc/resolv.conf
# dig yahoo.com

You should now receive something like the following

; <<>> DiG 9.3.2 <<>> yahoo.com
;; global options:  printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50974
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;yahoo.com.                     IN      A

;; ANSWER SECTION:
yahoo.com.              300     IN      A       216.109.112.135
yahoo.com.              300     IN      A       66.94.234.13

;; Query time: 38 msec
;; SERVER: 127.0.0.1#53(127.0.0.1)
;; WHEN: Wed Jan 24 12:09:50 2007
;; MSG SIZE  rcvd: 59

# cd /usr/local/www/apache22/data
# tar zxvf /path/to/djbdnsrocks/vegadns-0.9.10.tgz
# mv vegadns-0.9.10 vegadns
# mysqladmin -u root create vegadns -p
Enter your mysql password

Run the following command replacing "password" with whatever you feel secure.

# mysql -u root -e "GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER ON vegadns.* TO vegadns@localhost IDENTIFIED BY 'password'" mysql -p
Enter your mysql password

Let's get the private directories out of the webspace. 
# cd /usr/local/www/apache22/
# mkdir -p vegadns_private/templates_c
# mkdir vegadns_private/configs
# mkdir vegadns_private/cache
# mkdir vegadns_private/sessions

# chown -R www:www vegadns_private
# chmod -R 770 vegadns_private
# vi ./data/vegadns/src/config.php

Change the following variables accordingly
$private_dirs 
$mysql_pass 
$vegadns_url 
$supportname
$supportemail 
$trusted_hosts 

VegaDNS is only a web app that does not work directly with tinydns, instead it comes with an update script that you can run that will update the actual data files for tinydns. We will move it into the PATH.
# cp update-data.sh /usr/local/sbin/

Let's automate the updating
# crontab -e 
Enter the following for an every 10 minute schedule.
*/10 * * * * /usr/local/sbin/update-data.sh > /dev/null


Now in a web browser goto http://yourdomain.com/vegadns or whatever you set for $vegadns_url
Login Info as follows. 
Email: test@test.com
Pass: test

Once logged in, go ahead and Click "Edit My Account" and change the info to what you would like.  Keep the privileges set to "senior_admin".