If you follow
my DNS stream on Twitter me, you may have noticed a status
update earlier that looks a bit incomplete. Observant readers will have
noticed that the status was created via an agent calling itself "RFC 2136".
And, believe it or not, that is indeed how I updated that particular
$ nsupdate -k /tmp/ddns.key > server 127.0.0.1 5300 > update add status.example.nil 60 txt "This tweet is brought to you by ..." > send
I hear you saying "WTF" several times over, but I can assure you I'm quite sober. Well, sort of. :-) Many of you will know that RFC 2136 is how we perform dynamic updates in the DNS (I've discussed that here before). We were joking around the other day, and Stéphane Bortzmeyer said: "There is another big thing missing: writing (not just reading). Extension to RFC 2136?". On the drive back from Antwerp yesterday, I thought it shouldn't be too difficult to do, and I started musing about how I'd do it without wast^H^H^H^Hspending too much time on it. I decided to hook into BIND's rather new DLZ dlopen() driver, and fire off a UDP datagram to a Node.js listener that would do the heavy Oauthy-Twittery stuff for me. Et voilà . Here's the code I wrote, and this is how it works:
- Node runs
udptweetr.js, which listens on a datagram socket.
- BIND starts up with a DLZ dlopen() driver and waits for a TXT update via RFC 2136 to appear for a particular domain name.
- As soon as BIND commits the DDNS transaction, it fires off a datagram to
udptweetr.js, which takes the message and posts a Twitter status update. (What you and I typically call a tweet is actually called a status.)
Rest assured that all this is quite useless, but it is fun. :-)