Giter VIP home page Giter VIP logo

cloudflare-ddns's Introduction

cloudflare-ddns

Simple bash script to keep Cloudflare A record up to date with your current global ip.

Useful for servers without a static ip.

Dependencies

You will need jq and curl to run the script.

On Debian/Ubuntu:

apt-get install -y curl jq

Usage

Put ddns somewhere (on your path if you want) and make it executable.

curl -o /path/to/ddns https://raw.githubusercontent.com/claudetech/cloudflare-ddns/master/ddns
chmod +x /path/to/ddns

Create a file with the EMAIL and TOKEN variables containing your Cloudflare email and API key. The default path is /etc/cloudflare/default but you can override it with the DNS_ENV variable.

You can also set the ZONE and DOMAIN variables for the A record you want to keep up to date, or pass the variables directly when executing the script.

You can find an example config in dns_env.example.

Do not forget to set the permission to 600 on the file, to avoid having your Cloudflare API key read.

You can then run the script with:

DNS_ENV=/path/to/config ZONE=example.com DOMAIN=foo.example.com /path/to/ddns

You can omit ZONE and DOMAIN if you wrote them in the config file.

Note that it will not work if DOMAIN does not have an A record associated.

Running periodically

To keep your A record up to date, you can add the task to your crontab. After running crontab -e, add the following.

* * * * * DNS_ENV=/path/to/config /path/to/ddns 2>&1 >> /path/to/logfile

This will execute the script every minute.

cloudflare-ddns's People

Watchers

James Cloos avatar Daniel Perez avatar Yuya Soneoka avatar  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.