Coder Social home page Coder Social logo

harrego / cloudflare-ddns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dcerisano/cloudflare-dynamic-dns

0.0 2.0 3.0 139 KB

Cloudflare dynamic DNS shell script with support for multiple zones and records

License: MIT License

Shell 100.00%
cloudflare ddns dns

cloudflare-ddns's Introduction

cloudflare-ddns

Update/create Cloudflare records with an A record pointing to the public IP of the host. Records are specified
by listing a zone with -z followed by a list of unproxied (-r) or proxied (-p) records (full domain format),
see OPTIONS. Multiple zones and records can be specified, see EXAMPLE. Recommended to be ran in a crontab
every 5 minutes.

The public IP is determined by using the endpoint 'api.ipify.org', which returns the public IP in plain text.
The IP is cached to '/tmp/cloudflare-ddns-public-ip' in order to only make Cloudflare API requests when on IP
change. Both the endpoint and caching behavior can be changed, see ADVANCED OPTIONS.

Script output is minimal, only when the IP changes does the script report results. If you intend to notify only
on IP changes/record updates then conditionally doing so on any output will suffice.

REQUIREMENTS:
  * jq (apt install jq / pacman -S jq / brew install jq).
  * Cloudflare zone already configured.
  * Cloudflare API token with permissions:
    * Zone.Zone
    * Zone.DNS

USAGE: cloudflare-ddns.sh [OPTIONS] -t <token> -z <zone> -r <record>...

OPTIONS:
  -t <token>        Cloudflare token, can also be set with environment variable CLOUDFLARE_API_TOKEN.
  -z <zone>         Zone name (full domain, excluding subdomains) for proceeding records.
  -r <record>       New/existing record name for preceding zone containing entire domain, e.g. foo.bar.com.
  -p <record>       Like -r (above), but record will be Cloudflare proxied.

ADVANCED OPTIONS:
  -i <new ip>       Skip checking endpoint for public IP and use specified instead.
  -I <old ip>       Skip checking the cached old public IP and use specified instead.
  -E <endpoint>     Override default curl endpoint to determine public IP, must return in plain text.
  -C <cache file>   Override default IP cache file and use specified instead. Specify \"\" to disable caching.

EXAMPLE:
  cloudflare-ddns.sh -t <token> -z bar.com -r foo.bar.com -p foo2.bar.com -z y.com -p y.com -p www.y.com
    Set the A records of the listed domains across two zones to be the current public IP. foo2.bar.com,
    y.com, and www.y.com will be proxied by Cloudflare (denoted by -p), foo.bar.com will not (denoted by -r).

cloudflare-ddns's People

Contributors

dcerisano avatar harrego avatar

Watchers

 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.