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.

053e75a5b48b44d6dd0612795dfb326d?s=128

Monica Dinculescu

March 11, 2014
Tweet

Transcript

  1. MORE CATS THE INTERNET NEEDS

  2. I’M MONICA @NOTWALDORF

  3. DNS DOMEOWN NAME SYSTEM

  4. DNS WWW.GOOGLE.COM == 74.125.226.134

  5. CAT-DNS WWW.GOOGLE.COM == CATS? CATS!!

  6. None
  7. HOW DO IT DO IT

  8. UDP USER DATAGRAM PROTOCOL

  9. UDP “THE HONEY BADGER OF THE INTERNET PROTOCOLS”

  10. UDP PORT 53

  11. DNS QUERIES

  12. WWW.IMAGES.GOOGLE.COM ? RECURSIVE NAME SERVER: YOU: HOLD ON. I’LL FIND

    OUT FOR YOU.
  13. WWW.IMAGES.GOOGLE.COM ? ROOT SERVER: RECURSIVE NAME SERVER: NOPE. TRY THE

    .COM SERVER.
  14. WWW.IMAGES.GOOGLE.COM ? .COM SERVER: NOPE. TRY THE GOOGLE SERVER. RECURSIVE

    NAME SERVER:
  15. WWW.IMAGES.GOOGLE.COM ? GOOGLE SERVER: I GOT IT! IT’S 74.125.226.135 RECURSIVE

    NAME SERVER:
  16. DNS MESSAGES 1987 RFCS ARE PAINFUL RFCS

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

    10 11 12 13 14 15 QR OPCODE AA TC RD RA RCODE
  18. LET’S TALK ABOUT TOOLS

  19. NSLOOKUP NSLOOKUP GOOGLE.COM

  20. None
  21. None
  22. WIRESHARK ———

  23. None
  24. None
  25. None
  26. None
  27. SURPRISE PENGUINS!

  28. ᕕ ( ᐛ ) ᕗ FINALLY, THE CODES!

  29. “I'LL OFTEN DROP DOWN TO NODE.JS IF I REALLY NEED

    TO BE CLOSE TO THE METAL” - SOME DUDE ON HACKER NEWS
  30. require(‘node-bitarray’) ! require(‘buffer’).Buffer ! require(‘dgram’) ! require(‘ip’)

  31. 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. }
  32. 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. }
  33. 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. }
  34. IMGUR OR: HOW WE ARE AUTHORITATIVE ABOUT CATS

  35. CAT-DNS, ENGAGE

  36. INSTA-REGRETS

  37. LESSONS LEARNED

  38. BAD DNS IS SLOW CHERISH 8.8.8.8

  39. OPEN SOURCE THE INTERNET IS A BEAUTIFUL PLACE

  40. CAT SERVICE THE INTERNET IS A BEAUTIFUL PLACE

  41. PULL REQUESTS THE INTERNET IS A BEAUTIFUL PLACE

  42. “CAT-DNS BEHAVES LIKE AN AUTHORITATIVE NAME SERVER, BUT DOES NOT

    SET THE AA BIT. SURELY CAT-DNS IS AUTHORITATIVE ABOUT CATS IN DNS.” ———
  43. =^. .^= @NOTWALDORF