innominatus
Projects:
btrfs-snap-script
Cloudflare DNS API Client
IAM
Q3Admin
GameServer Script
spamfirewall
Misc Scripts
Comtrol Projects:
DeviceMaster Installer
Driver Installer
Web Portvision

Support:
Open a Ticket

Other:
Home
Webmail
Squirrel Webmail
Definition


Downloads:
Release Directory

License: GPL
Script to help manage dns through cloudflare rest api
http://www.cloudflare.com/docs/client-api.html
Jason Jorgensen 
Version 2.0
2018-09-04

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
- pip3 install -r requirements.txt
- Setup credentials with file or environment variables
  $ export CF_API_EMAIL='user@example.com'
  $ export CF_API_KEY='00000000000000000000000000000000'

  These are optional environment variables; however, they do override the values set within a configuration file.

  Using configuration file to store email and keys
  $ cat ~/.cloudflare.cfg
  [CloudFlare]
  email = user@example.com
  token = 00000000000000000000000000000000

-----------------------------------------

3. Usage 

  Usage: ./cloudflare_dns  (action arguments space delimited)
    Examples: ./cloudflare_dns zones #list available zones
              ./cloudflare_dns list
              ./cloudflare_dns list domain=example.com
              ./cloudflare_dns list domain=example.com output=bind # output all the existing records in a bind-ish format
              ./cloudflare_dns list domain=example.com output=json # output all the existing records in json format
              ./cloudflare_dns add domain=example.com type=A sub=testrecord value=127.0.0.1 mode=1   # create a new 'A' record where cloudflare will proxy
              ./cloudflare_dns add domain=example.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 delete domain=example.com type=A sub=testrecord # delete a record with a sub
              ./cloudflare_dns delete domain=example.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=example.com
               output=[bind, csv, json, json_many] #json is one large object, json_many is an object per record
      add    : domain=example.com
               type=[A, CNAME, MX, NS, TXT AAAA, SRV, LOC, SPF, CERT, DNSKEY, DS, NAPTR, SMIMEA, SSHFP, TLSA, URI]
               sub=www or mail
               priority=10
               value=271.23.51.83 or example.com
      delete : domain=example.com
               sub=www or mail
               id=35907682 or 35924682

-----------------------------------------

4. Copyright

cloudflare_dns Copyright 2018 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. 

    



Email the Webmaster