<?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>Schadenfreude &#187; dns</title>
	<atom:link href="http://www.ralree.com/tag/dns/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ralree.com</link>
	<description>Malicious enjoyment derived from observing someone else's misfortune</description>
	<lastBuildDate>Sun, 28 Feb 2010 04:18:37 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DNS for bash</title>
		<link>http://www.ralree.com/2008/03/31/dns-for-bash/</link>
		<comments>http://www.ralree.com/2008/03/31/dns-for-bash/#comments</comments>
		<pubDate>Mon, 31 Mar 2008 01:16:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[camping]]></category>
		<category><![CDATA[daemon]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[environment]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[script]]></category>
		<category><![CDATA[service]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2008/03/31/dns-for-bash</guid>
		<description><![CDATA[Today, I decided I wanted a network service that propagated variables and aliases to every login shell that subscribed to it.  This is dangerous on a large scale, but perfectly acceptable on my small home network where everyone trusts everyone else.
First, I got Camping installed, bringing back fond memories of Ruby development.  I [...]]]></description>
			<content:encoded><![CDATA[<p>Today, I decided I wanted a network service that propagated variables and aliases to every login shell that subscribed to it.  This is dangerous on a large scale, but perfectly acceptable on my small home network where everyone trusts everyone else.</p>
<p>First, I got <a href="http://code.whytheluckystiff.net/camping">Camping</a> installed, bringing back fond memories of Ruby development.  I then copied off the blog example, and created TreeHugger, a 427 line script that provides a web interface to edit the variables, and a plain text output for the shells to source.  </p>
<p><a href="http://modzer0.cs.uaf.edu/repos/hank/code/ruby/treehugger.rb">This script</a>, when run, allows some simple MVC actions to an sqlite3 database.</p>
<p><img src="http://ralree.com/assets/2008/3/31/screenshot2.png" alt="Example Screenshot"/></p>
<p>As you can see, I have some aliases here I want to send to all the subscribing hosts.  Eventually, I want to add some detection functionality to the database (mostly reverse DNS lookups for host rule referencing).  I just have to access <code>/out</code> to get my desired output:</p>
<pre><code>
# Treehugger Configuration
# Aliases
alias ai='sudo apt-get install'
alias aup='sudo apt-get update'
alias aug='sudo apt-get upgrade'

# Environment Variables
</code></pre>
<p>Now, to get this into bash.  I looked into making the <code>date</code> command spit out pretty unique timestamps.  Turns out you can do this with the nanoseconds format:</p>
<pre><code>
$ date +%s%N
1206926780157462141
</code></pre>
<p>I made it so <code>wget</code> saves the treehugger config to a tempfile using the somewhat random seed above as a filename suffix, and then I have my shell source it:</p>
<pre><code>
FILENAME=/tmp/treehugger-`date +%s%N`; 2&gt;/dev/null wget -O $FILENAME  http://rofl.who/treehugger/out &#038;&#038; source $FILENAME &#038;&#038; rm $FILENAME
</code></pre>
<p>And now I have nice aliases on my laptop served up from my desktop as fresh as the shell:</p>
<pre><code>
hank@davros:~$ alias
alias ai='sudo apt-get install'
alias aug='sudo apt-get upgrade'
alias aup='sudo apt-get update'
alias ls='ls --color=auto'
</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2008/03/31/dns-for-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up DNS on my network</title>
		<link>http://www.ralree.com/2008/03/25/setting-up-dns-on-my-network/</link>
		<comments>http://www.ralree.com/2008/03/25/setting-up-dns-on-my-network/#comments</comments>
		<pubDate>Tue, 25 Mar 2008 04:09:00 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[bind]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2008/03/25/setting-up-dns-on-my-network</guid>
		<description><![CDATA[I decided to set up bind9 today on my Gutsy server.  It wasn’t too painful after I finally found some posts from someone who knew what they were doing (2 tutorials I read contained invalid configurations…).
First, you install bind:

sudo apt-get install bind9


I decided to set up bind9 today on my Gutsy server.  It [...]]]></description>
			<content:encoded><![CDATA[<p>I decided to set up bind9 today on my Gutsy server.  It wasn’t too painful after I finally found some posts from someone who knew what they were doing (2 tutorials I read contained invalid configurations…).</p>
<p>First, you install bind:</p>
<pre><code>
sudo apt-get install bind9
</code></pre>
<p><span id="more-11138"></span></p>
<p>I decided to set up bind9 today on my Gutsy server.  It wasn’t too painful after I finally found some posts from someone who knew what they were doing (2 tutorials I read contained invalid configurations…).</p>
<p>First, you install bind:</p>
<pre><code>
sudo apt-get install bind9
</code></pre>
<p>Then, you edit <strong>/etc/bind/named.conf</strong>:</p>
<pre><code>
acl homenet { 192.168.1.0/24; };

options {
  directory "/etc/bind/zones";
};

zone "." IN {
  type hint;
  file "named.root";
};

zone "who" IN {
  type master;
  file "who.db";
  allow-query { homenet; };
};

zone "1.168.192.in-addr.arpa" {
  type master;
  file "rev.1.168.192.in-addr.arpa";
};
</code></pre>
<p>This makes an ACL for my home network (192.168.1.1 &#8211; 192.168.1.254), sets the directory where my zone files live, defines a zone for the root DNS servers, defines a domain called <strong>.who</strong>, where all my machines will live, and only allows my home network IP space to query it, and also defines the reverse lookup zone.</p>
<p>Now, I simply had to make the zone files.  Here’s what I came up with for <strong>zones/who.db</strong>:</p>
<pre><code>
$ORIGIN who.
$TTL 86400
@   IN  SOA   ns.who. rofl.who. (
    2006081401
    28800
    3600
    604800
    38400
)
                IN      NS  ns.who

                IN A       192.168.1.134
*               IN A       192.168.1.134
rofl            IN A       192.168.1.134
ns              IN A       192.168.1.134
davros          IN A       192.168.1.3
</code></pre>
<p>Basically, everything goes to my machine at <strong>192.168.1.134</strong> except things going to davros.  It’s lame, but it’s a good template.</p>
<p>Here’s the Reverse lookup zone:</p>
<pre><code>
$ORIGIN .
$TTL 86400
1.168.192.in-addr.arpa IN SOA ns1.who. rofl.who. (
                        2006081401;
                        28800;
                        604800;
                        604800;
                        86400
)
     NS     ns1.who.
$ORIGIN 1.168.192.in-addr.arpa.
134    PTR    rofl.who.
3      PTR    davros.who.
</code></pre>
<p>Restart the bind service with <code>sudo /etc/init.d/bind9 restart</code>.  Also, add it to your <strong>/etc/resolv.conf</strong>.  Try it out like this:</p>
<pre><code>
hank@davros:~$ dig davros.who

; &lt;&lt;&gt;&gt; DiG 9.4.1-P1 &lt;&lt;&gt;&gt; davros.who
;; global options:  printcmd
;; Got answer:
;; -&gt;&gt;HEADER&lt;&lt;- opcode: QUERY, status: NOERROR, id: 38320
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 1

;; QUESTION SECTION:
;davros.who.                    IN      A

;; ANSWER SECTION:
davros.who.             86400   IN      A       192.168.1.3

;; AUTHORITY SECTION:
who.                    86400   IN      NS      ns.who.who.

;; ADDITIONAL SECTION:
ns.who.who.             86400   IN      A       192.168.1.134

;; Query time: 1 msec
;; SERVER: 192.168.1.134#53(192.168.1.134)
;; WHEN: Mon Mar 24 23:22:46 2008
;; MSG SIZE  rcvd: 81
</code></pre>
<p>I then added it to my DD-WRT settings on my Linksys WRT54Gv8 router under <strong>Setup -&gt; Basic Setup</strong>:</p>
<p><img src="http://ralree.com/assets/2008/3/25/screenshot1.png" alt="DDWRT Screencap" /></p>
<p>My router now simply sends out its IP as the sole DNS server, but routes all the DNS requests to the right spots.  Brilliant.  Let me know if I did something stupid/wrong…</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2008/03/25/setting-up-dns-on-my-network/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DNS Catch-all for OpenID</title>
		<link>http://www.ralree.com/2007/02/20/dns-catch-all-for-openid/</link>
		<comments>http://www.ralree.com/2007/02/20/dns-catch-all-for-openid/#comments</comments>
		<pubDate>Tue, 20 Feb 2007 20:25:47 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[openid]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/dns-catch-all-for-openid</guid>
		<description><![CDATA[We were trying to get our OpenID server working today, and we found that we needed to make a catch-all DNS entry to do it.  That way, things like hank.myopenid.url would work.  Here&#8217;s one way to do it:

*.yourdomain.com. IN A 111.111.111.111

But, we ended up using a CNAME instead:

UPDATE ADD *.yourdomain.com. 86400 IN CNAME [...]]]></description>
			<content:encoded><![CDATA[<p>We were trying to get our OpenID server working today, and we found that we needed to make a catch-all DNS entry to do it.  That way, things like <strong>hank.myopenid.url</strong> would work.  Here&#8217;s one way to do it:</p>
<pre><code>
*.yourdomain.com. IN A 111.111.111.111
</code></pre>
<p>But, we ended up using a CNAME instead:</p>
<pre><code>
UPDATE ADD *.yourdomain.com. 86400 IN CNAME yourdomain.com
</code></pre>
<p>Then in your Apache virtual hosts directive add a wildcard alias like this</p>
<pre><code>
ServerAlias *.yourdomain.com
</code></pre>
<p>Incredible.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2007/02/20/dns-catch-all-for-openid/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>DNS Mania</title>
		<link>http://www.ralree.com/2006/09/02/dns-mania/</link>
		<comments>http://www.ralree.com/2006/09/02/dns-mania/#comments</comments>
		<pubDate>Sat, 02 Sep 2006 15:26:02 +0000</pubDate>
		<dc:creator>Erik</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[camping]]></category>
		<category><![CDATA[dns]]></category>
		<category><![CDATA[life]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[_why]]></category>

		<guid isPermaLink="false">http://www.ralree.info/2007/10/13/dns-mania</guid>
		<description><![CDATA[Well, I was stumbling today and found OpenDNS. I
was excited to find that I could make it coexist with OpenNIC in my dhclient
configuration.  Here&#8217;s the resultant line that makes all this magic happen:

prepend domain-name-servers 63.226.12.96, 208.67.222.222, 208.67.220.220;

So now, when I use dhcp to grab an IP, I end up prepending these nameservers
onto my resolv.conf. [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I was stumbling today and found <a href="http://www.opendns.com/">OpenDNS</a>. I<br />
was excited to find that I could make it coexist with OpenNIC in my dhclient<br />
configuration.  Here&#8217;s the resultant line that makes all this magic happen:</p>
<pre><code>
prepend domain-name-servers 63.226.12.96, 208.67.222.222, 208.67.220.220;
</code></pre>
<p>So now, when I use dhcp to grab an IP, I end up prepending these nameservers<br />
onto my resolv.conf.  OpenDNS makes spam sites and domain squatters disappear.<br />
And it makes the average request a lot faster.</p>
<p>Yesterday, <a href="http://dayne.broderson.org">bish0p</a> and I sat down and started<br />
work on <a href="http://mydns.bboy.net/">MyDNS</a>.  It turns out that the db structure<br />
isn&#8217;t all that bad, so it will be fairly straightforward to build a<br />
Rails/Camping interface for it.  I already started one in Camping called<br />
Beacon.  I was going to name it ChunkyBeacon, but <strong>#camping</strong> decided<br />
against that.</p>
<p>In other news, I&#8217;m going to leave Fairbanks for a while soon.  It will be<br />
exciting to go on this adventure into the <em>real</em> world for four months.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.ralree.com/2006/09/02/dns-mania/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.335 seconds -->
