<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>OpenBSD and FreeBSD resources &#187; Setting up</title>
	<atom:link href="http://purebsd.com/tag/setting-up/feed" rel="self" type="application/rss+xml" />
	<link>http://purebsd.com</link>
	<description></description>
	<lastBuildDate>Tue, 01 Jun 2010 06:01:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Installing OpenBSD</title>
		<link>http://purebsd.com/installing-openbsd.html</link>
		<comments>http://purebsd.com/installing-openbsd.html#comments</comments>
		<pubDate>Tue, 01 Jun 2010 05:41:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[OpenBSD main]]></category>
		<category><![CDATA[Installing]]></category>
		<category><![CDATA[Setting up]]></category>

		<guid isPermaLink="false">http://purebsd.com/?p=71</guid>
		<description><![CDATA[The installation of OpenBSD is pretty easy and straightforward. Setup I use: - CPU: Intel Pentium-I 233MHz - RAM: 128MB - HD: 10GB, 15GB - FD: 1,44&#8243; - NIC: Realtek 8139, 3Com 3c905 100Base-TX A log file of the installation process of OpenBSD 2.9 is available here. It was retrieved from a FTP mirror, not created [...]]]></description>
			<content:encoded><![CDATA[<p>The installation of OpenBSD is pretty easy and straightforward.</p>
<p>Setup I use:</p>
<p>- CPU: Intel Pentium-I 233MHz<br />
- RAM: 128MB<br />
- HD: 10GB, 15GB<br />
- FD: 1,44&#8243;<br />
- NIC: Realtek 8139, 3Com 3c905 100Base-TX</p>
<p>A log file of the installation process of OpenBSD 2.9 is available <a href="http://web.archive.org/web/20060313055209/http://www.purebsd.com/files/log29.txt">here</a>. It was retrieved from a FTP mirror, not created by me. It is meant to give an impression of how the installation process looks like. The installation of OpenBSD 3.4 is just slightly different.</p>
<p>The OpenBSD v3.4 installation process went as follows (mail me if I forget important steps and/or info):</p>
<ol type="1">
<li>Connect to the nearest OpenBSD FTP <a href="http://web.archive.org/web/20060313055209/http://www.openbsd.org/ftp.html">mirror</a>.</li>
<li>Go to the <code>/pub/OpenBSD/3.4/i386</code> directory. Use something other than <em>i386</em> if you install on an other platform.</li>
<li>Retrieve the installation floppy image (floppy34.fs). This should be enough to start the install in most situations.</li>
<li>Burn the installation floppy to a floppy disk:<br />
Example: <code>dd if=floppy34.fs of=/dev/fd0</code></li>
<li>Boot the system from the floppy disk.</li>
<li>When asked for <code>/bin/sh</code> just hit the enter key.</li>
<li>For installation hit &laquo;i&raquo;, for a upgrade &laquo;u&raquo;. Only the installation option is covered here. I like clean installs.</li>
<li>If you&#8217;d like to use the complete disk for OpenBSD enter &laquo;yes&raquo;.</li>
<li>Now configure your OpenBSD disk slice. This is done by the label editor. Type &laquo;?&raquo; for help, &laquo;x&raquo; to exit without saving changes and &laquo;q&raquo; to exit and save changes. To add an partition type &laquo;a x&raquo; where &laquo;x&raquo; is the partition you&#8217;d like to add. Type &laquo;p&raquo; to see all partions. Partition &laquo;a&raquo; is often the / (root) partion, &laquo;b&raquo; is reserved for a potential swap partition, &laquo;c&raquo; is a sort of symbolic partition representing the whole disk, the rest of the letters are free to (ab)use.
<p>You would probably a separate partition for <code>/</code>, <code>/tmp</code>, <code>/var</code>, <code>/usr</code> and <code>/home</code>. My suggestion for a small (2G HD, 32MB RAM) home server/workstation system:</p>
<p><code> /     : 128 MB<br />
swap  : 128 MB<br />
/tmp  : 128 MB<br />
/var  : 256 MB<br />
/usr  : 1048 MB<br />
/home : the rest<br />
</code><br />
If you got the space, a 10G harddisk for instance and 64MB RAM, you could do it like this:</p>
<p><code> /     : 128 MB<br />
swap  : 128 MB<br />
/tmp  : 512 MB<br />
/var  : 1024 MB<br />
/usr  : 2048 MB<br />
/home : 1024 MB<br />
/vol  : the rest<br />
</code><br />
With a real small server, say 1G HD and 16MB RAM, you could probably do best by using this kind of layout:</p>
<p><code> /     : 64 MB<br />
swap  : 96 MB<br />
/usr  : the rest<br />
</code><br />
And symlink <code>/var</code>, <code>/tmp</code> and <code>/home</code> to respectively <code>/usr/var</code>, <code>/usr/tmp</code> and<code>/usr/home</code>.</p>
<p>Above layouts are rough indications and can vary enormously from system to system. Database servers might/should want a bigger <code>/var</code> for instance. A lot of users wanting space for their files could warrant more space being allocated to <code>/home</code>.</p>
<p>Hit &laquo;q&raquo; to exit and save your configuration when done.</li>
<li>The install process then presents a chance to initialize more disks (if found) via the same process explained a step earlier. If you&#8217;re satisfied with your disk(s), enter &laquo;done&raquo; and hit return. The install process shows all partitions and their respective mount points of all disks initialized for you to review. Hitting return will show the next partition and its moint point. This is an endless loop. When everything is okay, enter &laquo;done&raquo; and hit return, to escape the endless loop and continue.</li>
<li>The install formats your disks and partitions and continues by asking if you&#8217;d like to setup networking. Answer the simple questions and hit return at the default answer of no, when it asks if you&#8217;d like to escape to a shell environment.</li>
<li>The install mounts your partitions and asks for the root password. Type it carefully and remember it! (-;</li>
<li>Next, if you&#8217;d like to run the XFree86 X Window System, answer yes to the question prompted. If your setting up a server, answering no will be a good decision in most cases.</li>
<li>Now, you&#8217;re ready to download the base install files via FTP, HTTP and some other neat protocols. Select your favourite and select which packages it should install. To select or deselect a package simply type in the full name of it, including the ending &laquo;.tgz&raquo;.</li>
<li>When you&#8217;re done installing those nice tarballs answer no to the &laquo;extract more sets&raquo; question. The install creates some files in <code>/etc</code> and lets you choose your timezone. Select a cool looking zone and hit the return key.</li>
<li>Finally, you&#8217;re almost done! You only have to reboot the system now! But wait until the install process tells you it&#8217;s save, before doing that.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://purebsd.com/installing-openbsd.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a CVS server</title>
		<link>http://purebsd.com/setting-up-a-cvs-server.html</link>
		<comments>http://purebsd.com/setting-up-a-cvs-server.html#comments</comments>
		<pubDate>Tue, 01 Jun 2010 05:27:18 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Daemons]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[CVS]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Setting up]]></category>

		<guid isPermaLink="false">http://purebsd.com/?p=46</guid>
		<description><![CDATA[Here I&#8217;ll describe how to setup a CVS server that is accessed by CVS clients via the &#171;pserver protocol&#187;. The end result is a service that CVS clients connect to in order to use the CVS repositories on your system. Edit /etc/inetd.conf to add the &#171;cvs&#187; service: cvspserver stream tcp nowait cvs /usr/libexec/tcpd /usr/bin/cvs -f --allow-root=/home/cvs [...]]]></description>
			<content:encoded><![CDATA[<p>Here I&#8217;ll describe how to setup a CVS server that is accessed by CVS clients via the &laquo;pserver protocol&raquo;. The end result is a service that CVS clients connect to in order to use the CVS repositories on your system.</p>
<ol type="1">
<li>Edit <code>/etc/inetd.conf</code> to add the &laquo;cvs&raquo; service:<br />
<code>cvspserver stream tcp nowait cvs /usr/libexec/tcpd /usr/bin/cvs -f --allow-root=/home/cvs pserver</code></li>
<li>Edit <code>/etc/services</code> to add the cvspserver protocol:<br />
<code>cvspserver 2401/tcp</code></li>
<li>Edit <code>/etc/hosts.allow</code> to allow connections from certain hosts to the &laquo;cvs&raquo; service:<br />
<code>cvs: 192.168.0. botte-coders.example.org .aars.it</code></li>
<li>Add the &laquo;cvs&raquo; user mentioned in <code>/etc/inetd.conf</code> to /etc/master.passwd:<br />
<code>cvs:*:80:80::0:0:CVS:/home/cvs:/usr/local/bin/bash</code><br />
Run <code>pwd_mkdb -p /etc/master.passwd</code> to regenerate <code>/etc/passwd</code>.</p>
<p>Create the group &laquo;cvs&raquo;:<br />
<code>/etc/group:<br />
cvs:*:80:<br />
</code><br />
Create the home directory for user &laquo;cvs&raquo;:<br />
<code>mkdir /home/cvs<br />
chmod 700 /home/cvs<br />
</code></li>
<li>Init the CVSROOT directory in /home/cvs:<br />
<code>su -l cvs<br />
cvs -d /home/cvs init<br />
</code></li>
<li>Create and/or edit the file <code>/home/cvs/CVSROOT/passwd</code>. This file will list the users able to connect to the &laquo;cvs&raquo; service:<br />
<code>su -l cvs<br />
cd /home/cvs/CVSROOT<br />
touch passwd<br />
chmod 600 passwd<br />
vi passwd<br />
</code><br />
The file will look something like this:<br />
<code>harry:ZrLzRsjAPL7iQ:cvs<br />
klaas:Rf0DZbqhHM.Z.:cvs<br />
sjaak:kLruwLTHOsOXT2:cvs<br />
cvsusers:ORA7SfF0sRkD.:cvs<br />
</code><br />
&laquo;harry&raquo;, &laquo;klaas&raquo; and &laquo;sjaak&raquo; are the cvs users. &laquo;cvsusers&raquo; is the common user account for the developers working on a certain website project. It is mainly meant for doing cvs checkouts in the production environment.</li>
<li>Finally, create the common user account &laquo;cvsusers&raquo; to keep your developers happy. You know how to do that, don&#8217;t you? (-:</li>
<li>Now all developers should set their CVSROOT environment and execute a <code>cvs login</code>:<br />
<code>export CVSROOT=":pserver:&lt;username&gt;@yourserver.com:/home/cvs"<br />
cvs login<br />
cd ~public_html/<br />
cvs -q checkout PROJECTNAME</code></li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://purebsd.com/setting-up-a-cvs-server.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a DHCP server</title>
		<link>http://purebsd.com/setting-up-a-dhcp-server.html</link>
		<comments>http://purebsd.com/setting-up-a-dhcp-server.html#comments</comments>
		<pubDate>Tue, 01 Jun 2010 05:05:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Daemons]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[DHCP]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[Setting up]]></category>

		<guid isPermaLink="false">http://purebsd.com/?p=39</guid>
		<description><![CDATA[This is a guide to the (hopefully) succesful configuration and usage of the DHCP server distributed with the OpenBSD base install. Follow these pointers: Edit /etc/rc.conf.local to start the DHCP server automatically: dhcpd_flags="-q" # for normal use: "-q" Create/edit the file /etc/dhcpd.conf to configure dhcpd: # $OpenBSD: dhcpd.conf,v 1.1 1998/08/19 04:25:45 form Exp $ # # DHCP server [...]]]></description>
			<content:encoded><![CDATA[<p>This is a guide to the (hopefully) succesful configuration and usage of the DHCP server distributed with the OpenBSD base install.</p>
<p>Follow these pointers:</p>
<ol type="1">
<li>Edit <code>/etc/rc.conf.local</code> to start the DHCP server automatically:
<p><code> dhcpd_flags="-q" # for normal use: "-q"<br />
</code></li>
<li>Create/edit the file <code>/etc/dhcpd.conf</code> to configure <code>dhcpd</code>:
<p><code> # $OpenBSD: dhcpd.conf,v 1.1 1998/08/19 04:25:45 form Exp $<br />
#<br />
# DHCP server options.<br />
# See dhcpd.conf(5) and dhcpd(8) for more information.</p>
<p>shared-network LOCAL-NET {<br />
option routers 10.0.0.3;<br />
option domain-name "intranet.atomicvoid.net";<br />
option domain-name-servers 10.0.0.3;</p>
<p>subnet 10.0.0.0 netmask 255.255.255.0 {<br />
range 10.0.0.100 10.0.0.200;<br />
}</p>
<p>host miranda {<br />
hardware ethernet 00:00:39:3b:68:0d;<br />
fixed-address miranda.intranet.atomicvoid.net;<br />
}</p>
<p>host andromeda {<br />
hardware ethernet 00:50:fc:0c:3e:32;<br />
fixed-address andromeda.intranet.atomicvoid.net;<br />
}<br />
}<br />
</code><br />
For a more detailed working example, see my <a href="hhttp://www.purebsd.com/dhcpd.conf.txt">dhcpd.conf file</a>.</p>
<p>The &laquo;host&raquo; directives inform the DHCP server to allocate a &laquo;fixed-address&raquo; to requests with a MAC address equal to the one listed by &laquo;hardware ethernet&raquo;.<br />
The &laquo;subnet&raquo; directive informs the DHCP server that all DHCP requests result in a allocation of an IP address in the range of [10.0.0.100 - 10.0.0.200] if a client&#8217;s MAC address is not listed by one of the &laquo;host&raquo; directives.</li>
<li>Create/edit the file <code>/etc/dhcpd.interfaces</code> to list the interfaces <code>dhcpd</code> should listen on for DHCP requests:
<p><code> # $OpenBSD: dhcpd.interfaces,v 1.1 1998/08/19 04:25:45 form Exp $<br />
#<br />
# List of network interfaces served by dhcpd(8).<br />
#<br />
# ep0<br />
# ed0 le0<br />
# de1<br />
xl0<br />
</code><br />
In this case, only DHCP request entering via the interface <code>xl0</code> will be seen and handled by the DHCP daemon.</li>
<li>Reboot the system to have the changes take effect. Alternately, you can execute
<p><code> /usr/sbin/dhcpd -q xl0<br />
</code><br />
to start the DHCP server. Option &laquo;-q&raquo; quiets the chatter of the DHCP server and &laquo;xl0&#8243; is the interface on which the DHCP server should listen for requests.</li>
<li>Check <code>/var/log/daemon</code> if the DHCP server was started succesfully.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://purebsd.com/setting-up-a-dhcp-server.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up NTPD</title>
		<link>http://purebsd.com/setting-up-ntpd.html</link>
		<comments>http://purebsd.com/setting-up-ntpd.html#comments</comments>
		<pubDate>Tue, 01 Jun 2010 05:03:50 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Daemons]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[NTPD]]></category>
		<category><![CDATA[Setting up]]></category>

		<guid isPermaLink="false">http://purebsd.com/?p=37</guid>
		<description><![CDATA[Here I try to provide a guide to the succesful installation, configuration and usage of NTPD on OpenBSD. Install the ntp package: pkg_add ntp-4.1.1c.tgz pkg_add ntp-doc-4.1.1c.tgz The &#171;doc&#187; package is optional. It contains the documentation for the NTP daemon. Edit /etc/rc.conf.local to start the network time services automatically. Set &#171;ntpdate_flags&#187; to the IP address of a [...]]]></description>
			<content:encoded><![CDATA[<p>Here I try to provide a guide to the succesful installation, configuration and usage of NTPD on OpenBSD.</p>
<ol type="1">
<li>Install the ntp package:
<p><code> pkg_add ntp-4.1.1c.tgz<br />
pkg_add ntp-doc-4.1.1c.tgz<br />
</code><br />
The &laquo;doc&raquo; package is optional. It contains the documentation for the NTP daemon.</li>
<li>Edit <code>/etc/rc.conf.local</code> to start the network time services automatically.
<p>Set &laquo;ntpdate_flags&raquo; to the IP address of a NTP server, so that when the system boots, the local system clock is synchronized with that remote NTP server. This is a one time only action, only executed at system start.</p>
<p><code> ntpdate_flags="129.6.15.28" # for normal use: NTP server; run before ntpd starts<br />
</code><br />
Why? Well, if the difference of the local system&#8217;s time and the remote NTP server(s) time is greater than one hour, the local running NTPD won&#8217;t synchronize the local system&#8217;s time with the time of the remote NTP server(s).</p>
<p>Set &laquo;ntpd&raquo; to &laquo;YES&raquo; if you&#8217;d like to continuesly run a local NTP daemon, which synchronizes the local system&#8217;s time with the time offered by one or more remote NTP servers.</p>
<p><code> ntpd=YES # run ntpd if it exists<br />
</code></li>
<li>Create a directory where <code>ntpd</code> can store some files like <code>drift</code>:
<p><code> mkdir /etc/ntp<br />
</code></li>
<li>Create/edit the file <code>/etc/ntp.conf</code> to configure the workings of <code>ntpd</code>:
<p><code> # Keep it rather quiet<br />
logconfig =syncevents +allclock</p>
<p># Drift file. Put this in a directory which the daemon can write to.<br />
driftfile /etc/ntp/drift</p>
<p># Undisciplined Local Clock. This is a fake driver intended for backup<br />
# and when no outside source of synchronized time is available.<br />
server 127.127.1.0<br />
fudge 127.127.1.0 stratum 10</p>
<p># NTP servers from NIST for Atlantis<br />
server 129.6.15.28	iburst<br />
server 129.6.15.29	iburst</p>
<p># Do not allow anybody<br />
restrict default ignore</p>
<p># Do not peer with oneself<br />
restrict 127.0.0.1 mask 255.255.255.255 nopeer<br />
restrict 10.0.0.3 mask 255.255.255.255 nopeer<br />
restrict 192.168.0.3 mask 255.255.255.255 nopeer<br />
restrict 131.174.117.141 mask 255.255.255.255 nopeer</p>
<p># Allow NTP servers to inform us (-:<br />
restrict 129.6.15.28	mask 255.255.255.255<br />
restrict 129.6.15.29	mask 255.255.255.255<br />
</code><br />
For a more detailed working example, see my <a href="http://www.purebsd.com/ntp.conf.txt">ntp.conf file</a>.</li>
<li>Reboot the system to have the changes take effect. Alternately, you can execute
<p><code> /usr/local/sbin/ntpd -p /var/run/ntpd.pid<br />
</code><br />
to start the local NTP server.</li>
<li>Check <code>/var/log/daemon</code> if the NTP server was started succesfully.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://purebsd.com/setting-up-ntpd.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up Qmail</title>
		<link>http://purebsd.com/setting-up-qmail.html</link>
		<comments>http://purebsd.com/setting-up-qmail.html#comments</comments>
		<pubDate>Tue, 01 Jun 2010 05:01:31 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Daemons]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[Qmail]]></category>
		<category><![CDATA[Setting up]]></category>

		<guid isPermaLink="false">http://purebsd.com/?p=35</guid>
		<description><![CDATA[Here I try to provide a step-by-step guide to the succesful installation, configuration and usage of Qmail on OpenBSD. >Installation Unpack the distribution source code: cd /tmp tar xvpfz /location/of/netqmail-1.04.tar.gz cd netqmail-1.04 collate.sh Note: watch for errors that collate.sh might produce. Create the &#171;home&#187; directorie for Qmail: mkdir /var/qmail Next we have to create some user [...]]]></description>
			<content:encoded><![CDATA[<p>Here I try to provide a step-by-step guide to the succesful installation, configuration and usage of Qmail on OpenBSD.</p>
<p>><strong>Installation</strong></p>
<ol type="1">
<li>Unpack the distribution source code:<br />
<code> cd /tmp<br />
tar xvpfz /location/of/netqmail-1.04.tar.gz<br />
cd netqmail-1.04<br />
collate.sh<br />
</code><strong>Note:</strong> watch for errors that <code>collate.sh</code> might produce.</li>
<li>Create the &laquo;home&raquo; directorie for Qmail:<br />
<code> mkdir /var/qmail<br />
<code> </code></code></li>
<p><code><code></p>
<li>Next we have to create some user and group accounts. Edit<code>/etc/master.passwd</code> to look like this:<br />
<code> alias:*:100:101::0:0:Qmail-alias:/var/qmail/alias:/bin/true<br />
qmaild:*:101:101::0:0:Qmail-qmaild:/var/qmail:/bin/true<br />
qmaill:*:102:101::0:0:Qmail-qmaill:/var/qmail:/bin/true<br />
qmailp:*:103:101::0:0:Qmail-qmailp:/var/qmail:/bin/true<br />
qmailq:*:104:100::0:0:Qmail-qmailq:/var/qmail:/bin/true<br />
qmailr:*:105:100::0:0:Qmail-qmailr:/var/qmail:/bin/true<br />
qmails:*:106:100::0:0:Qmail-qmails:/var/qmail:/bin/true<br />
</code><br />
Then add two new groups to <code>/etc/group</code>:<br />
<code> qmail:*:100:<br />
nofiles:*:101:<br />
</code></li>
<li>Now we're ready to build Qmail from source:<br />
<code> cd /tmp/netqmail-1.04/netqmail-1.04<br />
make setup check<br />
./config<br />
</code><br />
If <code>config</code> can't determine your hostname, you can tip it by running:<br />
<code> ./config-fast mail.purebsd.com<br />
</code></li>
<li>More coming soon!</li>
<p></code></code></ol>
<p><code><code><a name="links"></a><strong>Links</strong></p>
<p>General links</p>
<ul>
<li><a href="http://cr.yp.to/qmail.html">Official Qmail site</a> - Created by the Qmail author Daniel J. Bernstein</li>
<li><a href="http://cr.yp.to/qmail/sendmail.html">Moving large Sendmail sites to Qmail</a> - By Daniel J. Bernstein</li>
<li><a href="http://web.archive.org/web/20060313055314/http://www.qmail.org/">Qmail homepage</a> - Reference site for Qmail users</li>
<li><a href="http://www.lifewithqmail.org/">Life With Qmail</a> - A very information rich and broad Qmail tutorial</li>
</ul>
<p>Spam related links</p>
<ul>
<li><a href="http://web.archive.org/web/20060313055314/http://www.chrishardie.com/tech/qmail/qmail-antispam.html">Qmail anti-spam howto</a> - Qmail and general spam related info</li>
<li><a href="http://web.archive.org/web/20060313055314/http://rbls.org/">RBLs</a> - List of many RBLs</li>
<li><a href="http://web.archive.org/web/20060313055314/http://www.sdsc.edu/~jeff/spam/Fighting.html">Fighting spam</a> - Provides a up to date blacklist info among other things</li>
</ul>
<p></code></code></p>
]]></content:encoded>
			<wfw:commentRss>http://purebsd.com/setting-up-qmail.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up DJBDNS</title>
		<link>http://purebsd.com/setting-up-djbdns.html</link>
		<comments>http://purebsd.com/setting-up-djbdns.html#comments</comments>
		<pubDate>Tue, 01 Jun 2010 04:59:26 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Daemons]]></category>
		<category><![CDATA[OpenBSD]]></category>
		<category><![CDATA[DJBDNS]]></category>
		<category><![CDATA[Setting up]]></category>

		<guid isPermaLink="false">http://purebsd.com/?p=33</guid>
		<description><![CDATA[Didactic assumptions You want to run a secure DNS service on your system(s). (BIND is not secure, nor reliable.) Read DJBDNS&#8217;s security guarantee. You have three network interfaces: 127.0.0.1 &#8211; the IP address of the localhost/loopback interface. 192.168.0.3 &#8211; the IP address of the internal network interface. 131.174.117.141 &#8211; the IP address of the external network [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Didactic assumptions</strong></p>
<ul>
<li>You want to run a secure DNS service on your system(s). (BIND is not secure, nor reliable.) Read DJBDNS&#8217;s <a href="http://cr.yp.to/djbdns/guarantee.html">security guarantee</a>.</li>
<li>You have three network interfaces:<br />
127.0.0.1 &#8211; the IP address of the localhost/loopback interface.<br />
192.168.0.3 &#8211; the IP address of the internal network interface.<br />
131.174.117.141 &#8211; the IP address of the external network interface.</p>
<p>I assume that 127.0.0.1 needs no clarification. 192.168.0.3 is the IP with which the server babbles with the rest of the machines on your intranet. 131.174.117.141 is the IP address that your ISP provided to you in order to TCP/IP you into the scary dungeons of the internet.</li>
<li>Your intranet domain name is &laquo;intranet.purebsd.com&raquo; and your domain name is &laquo;purebsd.com&raquo;.</li>
<li>The secondary name server is setup the same way like our server.</li>
<li>You like to install machine dependend things into <code>/usr/local</code> and stuff that can grow into <code>/var</code>.</li>
</ul>
<p><strong>Goal</strong></p>
<p>We are going to create a split-horizon DNS service:</p>
<ul>
<li>The intranet machines will contact your server for resolving DNS queries.</li>
<li>The intranet machines will contact your server to query the private intranet domain &laquo;intranet.purebsd.com&raquo;.</li>
<li>The intranet machines will contact your server to query the public internet domain &laquo;purebsd.com&raquo;.</li>
<li>The server itself will be able to do all of the above.</li>
<li>The server will transfer its primary zones to its secondary nameserver by means of the dnszxfr &laquo;program&raquo;.</li>
<li>The server will receive its secondary zones from its primary nameserver by means of the dnszxfr &laquo;program&raquo;.</li>
<li>The machines on the internet will only be able to query the public internet domain &laquo;purebsd.com&raquo;.</li>
</ul>
<p><strong>Roadmap to the DJBDNS solution</strong></p>
<p>This page documents one possible roadmap to install, configure and use DJBDNS.</p>
<p><em>Getting the software</em></p>
<p>For DJBDNS you need to download three tarballs:</p>
<ol type="1">
<li>The latest djbdns package: <a href="http://cr.yp.to/djbdns/djbdns-1.05.tar.gz">djbdns-1.05.tar.gz</a><br />
DJBDNS, obviously.</li>
<li>The latest daemontools package: <a href="http://cr.yp.to/daemontools/daemontools-0.76.tar.gz">daemontools-0.76.tar.gz</a><br />
Daemontools is a collection of tools for managing UNIX services. DJBDNS makes use of it.</li>
<li>The latest ucspi-tcp package: <a href="http://cr.yp.to/ucspi-tcp/ucspi-tcp-0.88.tar.gz">ucspi-tcp-0.88.tar.gz</a><br />
Ucspi-tcp is a collection of tools to create and accept TCP connections.</li>
</ol>
<p><em>Installing the framework</em></p>
<p>To install these three packages:</p>
<ol type="1">
<li>First, create a <code>package</code> directory in <code>/usr/local</code>:<br />
<code>mkdir -p /usr/local/package<br />
chmod 1755 /usr/local/package<br />
ln -s /usr/local/package /package<br />
cd /package<br />
</code><br />
Extract the daemontools sources in <code>/package</code>:<br />
<code>tar xpfz daemontools-0.76.tar.gz<br />
cd admin/daemontools-0.76<br />
</code><br />
To compile and setup daemontools:<br />
<code>package/install<br />
</code><br />
The directories <code>/command</code> and <code>/service</code> are created by the installation script.<code>/command</code> is populated by symbolic links to programs located in <code>/package</code> or<code>/usr/local/package</code>. Symbolic links located in <code>/service</code> are used by <code>svscan</code> to start (daemontools compatible) services under supervision of <code>supervise</code>. DJBDNS, daemontools and ucspi-tcp need those directories by default. If you don&#8217;t like them and want to change the names or locations of those directories, make sure you know exactly what you&#8217;re doing when hacking the Makefiles and source code.</p>
<p>Note: <code>/command/svscanboot</code> is automatically added to <code>/etc/rc.local</code></li>
<li>Extract the ucspi-tcp sources somewhere:<br />
<code>tar xvfz ucspi-tcp-0.88.tar<br />
cd ucspi-tcp-0.88<br />
</code><br />
To compile and install ucspi-tcp:<br />
<code>make<br />
make setup check<br />
</code></li>
<li>Extract the djbdns sources somewhere:<br />
<code>tar xvfz djbdns-1.05.tar<br />
cd djbdns-1.05<br />
</code><br />
To compile and install djbdns:<br />
<code>make<br />
make setup check<br />
</code></li>
</ol>
<p>Edit the <code>/etc/dnsroots.global</code> file to reflect the new IP address of j.root-servers.net:</p>
<ul>
<li>Replace <code>198.41.0.10</code> with <code>192.58.128.30</code>.</li>
</ul>
<p>Now setup some nice system accounts for DJBDNS:</p>
<ol type="1">
<li>Add &laquo;dnscache&raquo;, &laquo;dnslog&raquo;, &laquo;tinydns&raquo; and &laquo;dnszxfr&raquo; as new accounts to the system by adding the following <strong>four</strong> lines to <code>/etc/master.passwd</code>:
<p><code> dnscache:*:90:90::0:0:dnscache:/nonexistent:/sbin/nologin<br />
dnslog:*:91:91::0:0:dnslog:/nonexistent:/sbin/nologin<br />
tinydns:*:92:92::0:0:tinydns:/nonexistent:/sbin/nologin<br />
dnszxfr:*:93:93::0:0:DNS zone transfer agent:/var/djbdns/public-dnszxfr:/bin/sh<br />
</code><br />
<strong>Note:</strong> make sure that each account entry is just one line. Do not spread over multiple lines or you will corrupt the file.</p>
<p>Then run <code>pwd_mkdb -p /etc/master.passwd</code> to activate the changes.</li>
<li>Add four new groups to <code>/etc/group</code>:<br />
<code>dnscache:*:90:<br />
dnslog:*:91:<br />
tinydns:*:92:<br />
dnszxfr:*:93:<br />
</code></li>
<li>Change dnszxfr&#8217;s password with a string of about 10 random characters found on your keyboard:<br />
<code>passwd dnszxfr</code></li>
</ol>
<p>Now we can create the data directories of the various DJBDNS programs:</p>
<ol type="1">
<li>First, create a directory where DJBDNS data directories will reside:<br />
<code>mkdir /var/djbdns</code></li>
<li>Create a caching DNS service:<br />
<code>dnscache-conf dnscache dnslog \<br />
/var/djbdns/private-dnscache 192.168.0.3</code></li>
<li>Create an authorative DNS service for the intranet:<br />
<code>tinydns-conf tinydns dnslog \<br />
/var/djbdns/private-tinydns 127.0.0.1</code></li>
<li>Create an authorative DNS service for the internet:<br />
<code>tinydns-conf tinydns dnslog \<br />
/var/djbdns/public-tinydns 131.174.117.141</code></li>
<li>Create a directory for the zone transfer dnszxfr:<br />
<code>mkdir /var/djbdns/public-dnszxfr<br />
chown dnszxfr:dnszxfr /var/djbdns/public-dnszxfr<br />
chmod 700 /var/djbdns/public-dnszxfr<br />
</code></li>
</ol>
<p><em>Getting ready</em></p>
<p>The data directories are created and already filled with some files that form the framework. We have to finetune some of these files or create some new files in order to let things run smoothly on our server.</p>
<ol type="1">
<li>Edit <code>/var/djbdns/private-tinydns/run</code> to increase the softlimit:<br />
<code>... vdir ./env softlimit -d500000 /usr/loc ...<br />
</code></li>
<li>Edit <code>/var/djbdns/public-tinydns/run</code> to increase the softlimit:<br />
<code>... vdir ./env softlimit -d500000 /usr/loc ...<br />
</code></li>
<li>To enable the intranet to use dnscache&#8217;s services:<br />
<code>cd /var/djbdns/private-dnscache/root/ip<br />
touch 192.168.0<br />
chmod 600 192.168.0<br />
</code></li>
<li>In order to have <code>dnscache</code> resolve 192.168.0.* and *.intranet.purebsd.com, it has to know where to look:<br />
<code>cd /var/djbdns/private-dnscache/root/servers<br />
echo 127.0.0.1 &gt; 0.168.192.in-addr.arpa<br />
echo 127.0.0.1 &gt; intranet.purebsd.com<br />
</code><br />
127.0.0.1 is the IP address that <code>private-tinydns</code>, which knows about 129.168.0.* and *.intranet.purebsd.com, listens on.</li>
<li>Edit <code>/var/djbdns/private-tinydns/root/Makefile</code> to read:<br />
<code>data.cdb: data<br />
/usr/local/bin/tinydns-data</p>
<p>data: private-zones-primary<br />
cat private-zones-primary &gt; data<br />
</code></li>
<li>Edit <code>/var/djbdns/public-tinydns/root/Makefile</code> to read:<br />
<code>data.cdb: data<br />
@echo -n "[3] Creating 'data.cdb' from 'data'.. "<br />
@/usr/local/bin/tinydns-data<br />
@echo "OK"</p>
<p>data: public-zones-primary public-zones-secondary<br />
@echo -n "[1] Creating 'data' from 'public-zones-primary' \<br />
and 'public-zones-secondary'.. "<br />
@cat public-zones-primary public-zones-secondary &gt; data<br />
@echo "OK"</p>
<p>@echo -n "[2] Copying primary zone to DNSZXFR transfer \<br />
directory.. "<br />
@/bin/cp -f public-zones-primary /var/djbdns/public-dnszxfr/<br />
@echo "OK"<br />
</code><br />
<strong>Note:</strong>All indented lines should be indented with tabs instead of spaces. Make will complain if you fail to meet this requirement.</li>
</ol>
<p><em>Prime time</em></p>
<p>Now we are ready to run the DJBDNS services:</p>
<ol type="1">
<li>Go to the <code>/service</code> directory:<br />
<code>cd /service</code></li>
<li>Make symbolic links to <code>public-tinydns</code>, <code>private-tinydns</code> and <code>private-dnscache</code>:<br />
<code>ln -s /var/djbdns/private-dnscache .<br />
ln -s /var/djbdns/private-tinydns .<br />
ln -s /var/djbdns/public-tinydns .<br />
</code></li>
<li>The services should be started automatically within seconds. To verify: <code>svstat /service/*</code><br />
The output will be something similar to:<br />
<code>/service/private-dnscache: up (pid 17170) 686536 seconds<br />
/service/private-tinydns: up (pid 15258) 686536 seconds<br />
/service/public-tinydns: up (pid 22261) 686536 seconds<br />
</code></li>
<li>You should let your system&#8217;s DNS resolver(s) know what IP address should be used to submit DNS queries to. Create/edit <code>/etc/resolv.conf</code> to have it use <code>dnscache</code>&#8216;s IP address:<br />
<code>nameserver 192.168.0.3</code></li>
</ol>
<p><em>Serving DNS records</em></p>
<p>The <code>dnscache</code> program is already providing resolving DNS services to your system and intranet. But nothing is known about *.intranet.purebsd.com (the intranet domain) nor *.purebsd.com (the public internet domain).<br />
First, we&#8217;re going to inform private-tinydns (the tinydns instance that knows about *.intranet.purebsd.com) what it should know about the intranet.</p>
<ol type="1">
<li>The tinydns data format is very simple (and easy to parse for programs). Make yourself acquaintable with the <a href="http://cr.yp.to/djbdns/tinydns-data.html">tinydns data format</a>.</li>
<li>Now that you know all about the tinydns data format, go to the <code>private-tinydns</code>directory to which tinydns chroot()&#8217;s:<br />
<code>cd /var/djbdns/private-tinydns/root</code></li>
<li>There you create the file <code>private-zones-primary</code>. It could look like this:<br />
<code># Zone: *.intranet.purebsd.com<br />
#<br />
.intranet.purebsd.com::atlantis.intranet.purebsd.com<br />
@intranet.purebsd.com::atlantis.intranet.purebsd.com:10<br />
'purebsd.com:PureBSD intranet<br />
=antarctica.intranet.purebsd.com:192.168.0.1<br />
=aldebaran.intranet.purebsd.com:192.168.0.2<br />
=atlantis.intranet.purebsd.com:192.168.0.3<br />
</code></li>
<li>To have <code>tinydns</code> load the new private (primary) zone file just run <code>make</code>. <code>make</code> processes the <code>Makefile</code> file. That copies <code>private-zones-primary</code> to <code>data</code> and calls<code>tinydns-data</code> to generate <code>data.cdb</code> out of <code>data</code>.
<p>The usage of <code>private-zones-primary</code> looks a bit clumsy or overdone, but I found it to be more consistent with the public-tinydns approach I took.</li>
</ol>
<p>Now we&#8217;re going to have public-tinydns publish our beloved purebsd.com domain.</p>
<ol type="1">
<li>Go to the <code>public-tinydns</code> directory to which tinydns chroot()&#8217;s:<br />
<code>cd /var/djbdns/public-tinydns/root</code></li>
<li>There you create the file <code>public-zones-primary</code>. It could look like this:<br />
<code># Zone: *.purebsd.com<br />
#<br />
.purebsd.com::ns1.purebsd.com<br />
.purebsd.com::ns2.purebsd.com<br />
@purebsd.com::mail1.purebsd.com:10<br />
@purebsd.com::mail2.purebsd.com:20<br />
'purebsd.com:PureBSD - BSD resources<br />
+ns1.purebsd.com:131.174.117.141<br />
+ns2.purebsd.com:131.174.119.121<br />
+mail1.purebsd.com:131.174.117.141<br />
+mail2.purebsd.com:131.174.119.121<br />
+www.purebsd.com:131.174.117.141<br />
</code></li>
<li>To have <code>tinydns</code> load the new public (primary) zone file just run <code>make</code>. <code>make</code> processes the <code>Makefile</code> file. That copies <code>public-zones-primary</code> and <code>public-zones-secondary</code> to <code>data</code> and calls <code>tinydns-data</code> to generate <code>data.cdb</code> out of <code>data</code>.
<p>Make also copies the file <code>public-zones-primary</code> to the DNSXFR directory so that DNSXFR can transfer it to the secondary nameserver(s).</li>
</ol>
<p><em>Zone transfers</em></p>
<p>The setup and configuration of the The DNS zone transfer program &laquo;dnszxfr&raquo; will be coverend when the rest of the DJBDNS setup is completed (and documented here <img src='http://purebsd.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .</p>
<p><strong>More reading</strong></p>
<p>For more in-depth documentation for the DJBDNS, daemontools and ucspi-tcp programs:</p>
<ul>
<li>DJBDNS:<br />
- <a href="http://cr.yp.to/djbdns.html">Official DJBDNS site</a></li>
<li>Daemontools:<br />
- <a href="http://cr.yp.to/daemontools.html">Official daemontools site</a></li>
<li>Ucspi-tcp:<br />
- <a href="http://cr.yp.to/ucspi-tcp.html">Official ucspi-tcp site</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://purebsd.com/setting-up-djbdns.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

