Giter VIP home page Giter VIP logo

machineitsvcs / cloudflare-ddns-update Goto Github PK

View Code? Open in Web Editor NEW
35.0 4.0 12.0 65 KB

Advanced Dynamic DNS Update Script for Cloudflare

Home Page: http://cloudflare-ddns-update.machineitservices.com/

Shell 100.00%
cloudflare cloudflare-ddns cloudflare-api dns zone records dns-record dns-proxy cdn bash bash-script dynamic ip ipv4 dynamic-ip cloudflare-dns cloudflare-dynamic-dns ddns dyndns machine-it-services

cloudflare-ddns-update's Introduction

Introduction

This was a project I began working on when I founded Machine IT Services, a web hosting, web development, and IT company based in Louisville, KY. This script has the potential to update the DNS Records (A and AAAA) of a multitude of domains/zones on Cloudflare, while also providing flexibility by allowing the update of specific subdomains/records for each domain specified in the config file, compatible with both IPv4 and IPv6 addresses. You may refer to included config-example.sh for config file format. In order to run the script, just execute it with either the config file name (if in the same directory, i.e. config.sh) or the config file location (i.e. /your/config/directory/config.sh) as your first argument. You can specify numerous custom record sections, with each containing unique or different sets of subdomains/records for each zone specified. You can list the same zone more than once in separate records groups, setting the proxy option for each group as needed. It will also accept a second argument. This is to specify an additional script to run. Any additional arguments will be passed to the additional script. This is helpful in the situation that your server is also a DNS server or needs the IP address updated somewhere in it's own files or databases as it will include the $oldip4/6 and $newip4/6 variables, as well as the $updatedir/cloudflare-ddns-update.sh script location.. This is the perfect script if you're managing multiple sites on your dynamic server, and want to update several individual zones for separate Cloudflare accounts in one script. This script will allow you to specify your accounts, zones, records, and whether or not to use the Cloudflare proxy.

Usage

  • In this command, the config file is assumed to be in the same directory as the script.

    • /path/to/cloudflare-ddns-update.sh config.sh
  • In this command, the config file location is specified.

    • /path/to/cloudflare-ddns-update.sh /path/to/config.sh
  • Custom script specified. Please note that the variables $updatedir (cloudflare-ddns-update.sh location) $oldip4, $oldip6, $newip4, and $newip6 will be passed.

    • /path/to/cloudflare-ddns-update.sh config.sh update-my-dns-server.sh
  • Custom script and argument provided. Please note that the argument is passed normally as ${1} within your additional script.

    • /path/to/cloudflare-ddns-update.sh config.sh update-my-dns-server.sh secondary-server-address

Of course, I'd recommend using a cronjob to run this script automatically at set intervals; Once every minute should be fine.

Please set the hostnameaddr variable in your config file to a record that is NOT proxied, and INCLUDE it in your list of records to update. Otherwise it will always run, as it is the address checked against your current server address. This is IMPORTANT!

NOTE: In the future, I may just use the API to retrieve each record's currently set address in Cloudflare to do away with this "non-proxied" record requirement.

Contact

For assistance with the use or operation of this utility, feel free to email me. Please no spam or solicitation.

Donate

Donations are definitely welcome to encourage future developments like this one. You may visit our site if you would like to contribute. Thank you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.