GithubHelp home page GithubHelp logo

adijot / cloudflare-dynamic-dns Goto Github PK

View Code? Open in Web Editor NEW

This project forked from dcerisano/cloudflare-dynamic-dns

0.0 0.0 0.0 142 KB

Ditch your third-party DDNS service! Cloudflare DDNS curl scripts that call Cloudflare's API (v4) directly.

Shell 100.00%

cloudflare-dynamic-dns's Introduction

alt text

Cloudflare DDNS curl scripts that call CF-API (v4) directly.

My third-party DDNS service stopped working recently with CF. It seems CF has moved to a new API (v4).

The very good news is you can ditch third-party DDNS and simply run a DDNS shell script as a cron job every minute on your webserver. It calls the new CF API directly.

This is a bare bones script that requires:

  • Internet connectivity is available.
  • CF API v4 service is available
  • api.ipify.org service is available

You need the Zone ID, Authorization key and A-record ID for your domain.

Fetch the first two from your CF account.

Create the A-record in CF named "dynamic".

Create the CNAME alias (example.com --> dynamic.example.com)

alt text

Fetch The A-record ID with cloudflare-dns-id.sh

Run cloudflare-ddns.sh as a cron job * * * * * /.../cloudflare-ddns.sh

Test by changing your A-record to a bogus IP and then deleting /tmp/ip-record The cron job will change the A-record to your webserver IP address on it's next run.

Marvel at your own dynamic dns service - no more surrendering your CF Authorization key to a third party DDNS service.

Note that the CNAME alias masks your real IP address - a fundamental advantage of CF. Naming the A-record directly as your domain (example.com) would allow anyone to see your real IP address just by ping example.com. Try it!

Note that you will need to update this script:

  • if your CF Zone ID, Authorization key, or A-record ID change. Only you can change these.
  • if CF API v4 is deprecated. It is currently new, so should be stable for many years.
  • if api.ipify.org is deprecated. There are many others. Or use dig if you like.

TO DO

  • Convert curl from linux bash script to other platforms.

DO NOT commit your Authorization key to GitHub - thar be dragons. Purge any such commits and change your key.

alt text

cloudflare-dynamic-dns's People

Contributors

dcerisano 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.