Giter Site home page Giter Site logo

srshearer / cloudflare-ddns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from adrienbrignon/cloudflare-ddns

0.0 1.0 0.0 47 KB

A script to update your Cloudflare DNS records at a glance.

License: BSD 3-Clause "New" or "Revised" License

Python 100.00%

cloudflare-ddns's Introduction

cloudflare-ddns

This is a continued version of thatjpk's cloudflare-ddns.

Introduction

A script for dynamically updating Cloudflare DNS records. If you have a dynamic IP and you're hosting servers behind it, it's an easy way to make it 'pseudo-static'.

Dependencies

You'll need a Python interpreter and the following libraries:

You can install them with pip: pip install -r requirements.txt

Features

  • Two ways to grab your IP address
    • HTTP
    • DNS lookup (dig)
  • IPv4 and IPv6 support (A and AAAA records)
  • Logging
  • One configuration file for multiple records
  • Multiple record settings:
    • Time to Live (TTL)
    • Proxy mode
    • Logging level
  • Lightweight
  • Smart update (your record will only be updated if needed)

Usage

First, a few assumptions:

  • You're using Cloudflare to host DNS for a domain you own.
  • You have one or more A/AAAA records in Cloudflare you intend to dynamically update.

To use this utility, create a copy of the example.com.yml file inside the zones folder and rename it to your zone name. To do a one-off update of your DNS record, simply run python cloudflare-ddns.py -z example.com from your terminal. The script will determine your public IP address and automatically update the records along with it and the settings you provided.

If the program encounters an issue while attempting to update Cloudflare's records, you can check the the logs folder for more informations.

Because dynamic IPs can change regularly, it's recommended that you run this utility periodically in the background to keep your records up-to-date.

Just add a line to your crontab and let cron run it for you at a regular interval.

# Every 30 minutes, update my Cloudflare records.
*/30 * * * * python /path/to/cloudflare-ddns.py -z example.com

This example will update your records every 30 minutes. You'll want to be sure that you insert the correct paths to reflect where the codebase is located.

If you want to learn more about the Cloudflare API, you can read on here.

Credits and Thanks

  • Cloudflare for having an API and otherwise generally being cool.
  • icanhazip.com for making grabbing your public IP from a script super easy.
  • thatjpk for the initial releases of this project.

cloudflare-ddns's People

Contributors

thatjpk avatar adrienbrignon avatar kahn avatar gazzer82 avatar davejm avatar jenswbe avatar johnnyrose avatar kimw avatar sullivanmatt avatar pierrelvx avatar stephandollberg avatar srshearer avatar

Watchers

James Cloos avatar

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.