Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Jul 2009 00:46:43 -0400
From:      Steve Bertrand <steve@ibctech.ca>
To:        John Almberg <jalmberg@identry.com>
Cc:        vogelke+unix@pobox.com, freebsd-questions@freebsd.org
Subject:   Re: Should DNS be on same server as webserver?
Message-ID:  <4A5C0DB3.5090205@ibctech.ca>
In-Reply-To: <7DD18C43-5B03-4624-9487-ACC4AFAF000F@identry.com>
References:  <20090713222746.5D519BF05@kev.msw.wpafb.af.mil> <7DD18C43-5B03-4624-9487-ACC4AFAF000F@identry.com>

next in thread | previous in thread | raw e-mail | index | archive | help
This is a cryptographically signed message in MIME format.

--------------ms020206010008020306060408
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

John Almberg wrote:
> 
> On Jul 13, 2009, at 6:27 PM, Karl Vogel wrote:
> 
>>>> On Mon, 13 Jul 2009 13:03:24 -0400,
>>>> Jon Radel <jon@radel.com> said:
>>
>> J> Apache and Bind have both had their security issues over the years,
>> and
>> J> there's something to be said for running them on different servers to
>> J> reduce both the "all eggs in one basket" factor and the ease of
>> J> spreading an attack.  (Yes, I'm assuming what you're actually
>> J> running....)
>>
>>    You can fix the security problems by dumping Bind and using djbdns.
>>    It's very easy to set up a caching nameserver without using all the
>>    memory on your system.  See http://www.lifewithdjbdns.com/ for more.
> 
> 
> I actually do use djbdns. Super easy to use, once you figure it out.

...to run a DNS cache with djbdns, it doesn't take much figuring out:

(As root. I just tested this as I wrote it).

% pkg_add -r daemontools
% pkg_add -r ucspi-tcp
% echo 'svscan_enable="YES"' >> /etc/rc.conf
% mkdir /var/service
% /usr/local/etc/rc.d/svscan.sh start

% adduser -q

# add a 'dnscache' user. Put user in 'dnscache' group, and set the
# users shell to nologin

#rinse/repeat for a 'dnslog' user

% pkg_add -r djbdns
% rehash

% dnscache-conf dnscache dnslog /etc/dnscache

% ln -s /etc/dnscache /var/service

# now edit your /etc/resolv.conf file, so that the first "nameserver"
# entry in the list points to 127.0.0.1

__END__

By default, your new cache will only listen on the loopback address
(127.0.0.1).

There is a single file in /etc/dnscache/root/ip, named 127.0.0.1

If you want this cache to serve internal /24 network queries:

% touch /etc/dnscache/root/ip/192.168.0

To restart the service after a change:

% svc -t /etc/dnscache

To down the cache:

% svc -d /etc/dnscache

To up the cache:

% svc -u /etc/dnscache

Note that this is only for the dnscache. Setting up an authoritative
server is pretty much just as simple. Note also that I had to do some
patching and hacking to make the tinydns web frontend (VegaDNS) allow
for IPv6 records properly... that's out of the scope of this mail though
(for the record, I use BIND for most things v6).

An example of the empty files that allow cache access:

amigo# ll /etc/dnscache/root/ip
total 0
-rw-r--r--  1 root  wheel  0 Aug 19  2008 127.0.0.1
-rw-r--r--  1 root  wheel  0 Aug 19  2008 208.70.104
-rw-r--r--  1 root  wheel  0 Aug 19  2008 208.70.105
-rw-r--r--  1 root  wheel  0 Aug 19  2008 208.70.106
-rw-r--r--  1 root  wheel  0 Aug 19  2008 208.70.107
-rw-r--r--  1 root  wheel  0 Aug 19  2008 208.70.108
...

Steve

--------------ms020206010008020306060408
Content-Type: application/x-pkcs7-signature; name="smime.p7s"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="smime.p7s"
Content-Description: S/MIME Cryptographic Signature

MIAGCSqGSIb3DQEHAqCAMIACAQExCzAJBgUrDgMCGgUAMIAGCSqGSIb3DQEHAQAAoIII/zCC
AtowggJDoAMCAQICEEs5xg/J3t77QWJ4SatV1HcwDQYJKoZIhvcNAQEFBQAwYjELMAkGA1UE
BhMCWkExJTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMT
I1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBMB4XDTA5MDUwNzIzMTYxMFoX
DTEwMDUwNzIzMTYxMFowQjEfMB0GA1UEAxMWVGhhd3RlIEZyZWVtYWlsIE1lbWJlcjEfMB0G
CSqGSIb3DQEJARYQc3RldmVAaWJjdGVjaC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AUAwBwYFKw4DAgcwDQYIKoZIhvcNAwICASgwgYUGCSsGAQQBgjcQBDF4MHYwYjEL
MAkGA1UEBhMCWkExJTAjBgNVBAoTHFRoYXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAq
BgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBGcmVlbWFpbCBJc3N1aW5nIENBAhBLOcYPyd7e+0Fi
eEmrVdR3MIGHBgsqhkiG9w0BCRACCzF4oHYwYjELMAkGA1UEBhMCWkExJTAjBgNVBAoTHFRo
YXd0ZSBDb25zdWx0aW5nIChQdHkpIEx0ZC4xLDAqBgNVBAMTI1RoYXd0ZSBQZXJzb25hbCBG
cmVlbWFpbCBJc3N1aW5nIENBAhBLOcYPyd7e+0FieEmrVdR3MA0GCSqGSIb3DQEBAQUABIIB
AESz+TMIQ+u9Qs+sAsueUumhBnQmIvZslK9hC61f/030jj3EOn6Wczn1O7hNK/5BFqepFJyk
RrZS3wwAjvkRWPXkTHYPvcqAT4xGFJsmz7YaklAaTYzcgUZkLHOIUxO0o+CII/XGJv1MmaUp
LFE2/ncnZQ+341LSnquIx59TMpwIIhlIHAV5TqraJlknDf233xxL5Pzi+EOjLYqB2L/d38a0
NfgCznuoKQUzSmMH4TvfpNcrZT3hldoXwDq8aQW/0sVyNClR52EkrcGAAE34L2vdNxdZ8rq6
C8l/CNM8hORJmZut5bOPPH/yzW5PN8y8Blehtu5vFXGFf8djgpGtF9sAAAAAAAA=
--------------ms020206010008020306060408--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4A5C0DB3.5090205>