DynamicDNS with CloudFlare
I’ve been using CloudFlare for a while now to protect my sites and generally make life easy. If you haven’t seen it before then stop here and go check them out. I’ll wait.
If you’re already familiar then you know the one of the key requirements is that CloudFlare becomes your DNS provider. They also have a wonderful API. Connect the dots and you too can replace your DDNS provider with a completely free solution, get better security, and accelerate your site! Woo! I decided to build my own Ruby based DDNS client to modify CloudFlare for me. This is partly because I wanted to learn something new and secondly so I can integrate it into all those Low End Box honeypots I have sprinkled around the web.
Chances are if the server belongs to me it has RVM so this was a pretty simple choice. I simply call the script on a cron schedule, it does the update if needed, and off we go.
Without further blathering I present the final project: CFDDNS-Ruby.
Some lessons learned along the way:
- Don’t use rest-client. Really. Like ever. Simple things like “Hey use this header” devolve into a discussion of “Well which helper are you using? It goes here for this and there for that.” Not. Even. Once
- Use unirest because great googley moogley it’s simple and easy. Try it. You’ll like it.
About the author
Brooks Garrett is a dedicated technologist who specializes in information security. Brooks has spent over 10 years implementing security programs for both the public and private sector including some of the biggest names in the Fortune 500. When he's not managing risk in the corporate environment you can find him at the local firestation where he is a volunteer firefighter.