Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cat-DNS: a DNS server that resolves everything to cats

Cat-DNS: a DNS server that resolves everything to cats

The internet needs more cats. DNS servers are the authority on all things internet. Therefore, the best DNS server is the one that resolves everything to cats. This talk is about DNS servers: how they work, how your browser talks to them, and how to write a DNS server that always gives you a cat in less than 200 lines of JavaScript.

Monica Dinculescu

March 11, 2014
Tweet

More Decks by Monica Dinculescu

Other Decks in Programming

Transcript

  1. 0 1 2 3 4 5 6 7 8 9

    10 11 12 13 14 15 QR OPCODE AA TC RD RA RCODE
  2. “I'LL OFTEN DROP DOWN TO NODE.JS IF I REALLY NEED

    TO BE CLOSE TO THE METAL” - SOME DUDE ON HACKER NEWS
  3. var dnsServer = dgram.createSocket('udp4'); dnsServer.bind(53,'localhost'); ! dnsServer.on('message', function (msg, rinfo)

    { ! // Step 1. Parse message. // Step 2. Make answer, echoing the question // Step 3. ??? // Step 4. CATS. ! dnsServer.send(…); } ! dnsServer.on("listening", function () { if (process.getuid && process.setuid) process.setuid(501); // Default user. }
  4. var dnsServer = dgram.createSocket('udp4'); dnsServer.bind(53,'localhost'); ! dnsServer.on('message', function (msg, rinfo)

    { ! // Step 1. Parse message. // Step 2. Make answer, echoing the question // Step 3. ??? // Step 4. CATS. ! dnsServer.send(…); } ! dnsServer.on("listening", function () { if (process.getuid && process.setuid) process.setuid(501); // Default user. }
  5. var dnsServer = dgram.createSocket('udp4'); dnsServer.bind(53,'localhost'); ! dnsServer.on('message', function (msg, rinfo)

    { ! // Step 1. Parse message. // Step 2. Make answer, echoing the question // Step 3. ??? // Step 4. CATS. ! dnsServer.send(…); } ! dnsServer.on("listening", function () { if (process.getuid && process.setuid) process.setuid(501); // Default user. }
  6. “CAT-DNS BEHAVES LIKE AN AUTHORITATIVE NAME SERVER, BUT DOES NOT

    SET THE AA BIT. SURELY CAT-DNS IS AUTHORITATIVE ABOUT CATS IN DNS.” ———