Script to help manage dns through cloudflare rest api http://www.cloudflare.com/docs/client-api.html Jason Jorgensen Version 1.0 08-07-2014 1. Introduction 2. Installation 3. Usage 4. Copyright ----------------------------------------- 1. Introduction I wanted a simple script to update dns entries on our cloudflare accounts without having to use their web interface that I do not care for. Plus have some automation. ----------------------------------------- 2. Installation - wget http://innominatus.com/releases/cloudflare_dns/latest/cloudflare_dns.pl - perl -c cloudflare_dns.pl - Install any missing perl modules it complains about, via your OS package repos or CPAN ----------------------------------------- 3. Usage Usage: ./cloudflare_dns.pl (action arguments space delimited) Configured, valid domains: domain.com Examples: ./cloudflare_dns.pl list ./cloudflare_dns.pl list domain=domain.com ./cloudflare_dns.pl list domain=domain.com output=bind # output all the existing records in a bind-ish format ./cloudflare_dns.pl list domain=domain.com output=json # output all the existing records in json format ./cloudflare_dns.pl add domain=domain.com type=A sub=testrecord value=127.0.0.1 mode=1 # create a new 'A' record where cloudflare will proxy ./cloudflare_dns.pl add domain=domain.com type=MX sub=testmail value=127.0.0.1 priority=10 mode=0 # create a new 'MX' record where cloudflare will not proxy ./cloudflare_dns.pl delete domain=domain.com type=A sub=testrecord # delete a record with a sub ./cloudflare_dns.pl delete domain=domain.com id=634354764 # delete a single record with id Note: raw output (default) is terse json format json output is human readable json format Actions: list : domain=domain.com output=[raw, bind, csv, json] add : domain=domain.com type=[A, CNAME, MX, NS, TXT] sub=www or mail priority=10 value=271.23.51.83 or example.com delete : domain=domain.com sub=www or mail id=35907682 or 35924682 ----------------------------------------- 4. Copyright cloudflare_dns Copyright 2014 Jason Jorgensen, jasonj@innominatus.com This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.