Giter Site home page Giter Site logo

cloudflare-dynamicdns's Introduction

Cloudflare Dynamic DNS (CDDNS)

CodeFactor Build Container

With a specified Cloudflare DNS API token and a subdomain, this tool will detect your current IP address (using ident.me) and sets your Cloudflare DNS record to that value. Optionally supports IPv6.

Warning

This is not production ready, and undergoing pre-alpha changes - PRs will not be accepted at this time.

Usage

Docker

They can also be found on Dockerhub.

See the help documentation for more details:

docker run ghcr.io/soup-bowl/cf-dynamicdns:latest --help

Run with arguments:

docker run ghcr.io/soup-bowl/cf-dynamicdns:latest \
  && --domain <your Dynamic DNS domain> \
  && --token <Your CF API Token>

Run with environments:

docker run ghcr.io/soup-bowl/cf-dynamicdns:latest \
  && --env CF_DOMAIN=<your Dynamic DNS domain> \
  && --env CF_TOKEN=<Your CF API Token>

Run via Docker/Podman Compose:

services:
  cfdydns:
    image: ghcr.io/soup-bowl/cf-dynamicdns:latest
    environment:
      CF_TOKEN: <token>
      CF_DOMAIN: example.com

Executable

There are executables on the Releases page. These should work without Python being installed.

Below is a one-liner script to download and install to the binary path on Linux (requires sudo).

wget -O /tmp/cddns.zip "https://github.com/soup-bowl/cloudflare-dynamicdns/releases/download/0.2/cddns-0.2-linux-$(dpkg --print-architecture).zip" \
  && unzip /tmp/cddns.zip -d /tmp \
  && rm /tmp/cddns.zip \
  && chmod +x /tmp/cddns \
  && sudo chown root:root /tmp/cddns \
  && sudo mv /tmp/cddns /bin/

Verify by running cddns -v.

Native

python3 run.py --domain <your Dynamic DNS domain> --token <Your CF API Token>

(Arguments can be omitted if you have the values in your environment).

This Python script depends on Python3 using the requests library, which can be installed in the following manners:

Via pip (universal):

pip install requests

Via apt-get (Debian-based):

sudo apt-get install python3-requests

Getting your Cloudflare Token

Visit the API Tokens segment of your Cloudflare Profile. Create an API Token (not an API Key), and select to use the Edit Zone DNS template.

How you fill the rest is up to you, but I recommend specifying the Zone Resource to Include, Specific zone, and specify the domain where your Dynamic DNS will be.

After review, the system will output an API Token. This is what the tool wants as either --token or CF_TOKEN argument. The --domain/CF_DOMAIN argument must match whatever zone you specified for the token, or at least be applicable within the scope you set.

cloudflare-dynamicdns's People

Contributors

dependabot[bot] avatar soup-bowl avatar

Stargazers

 avatar

Watchers

 avatar  avatar

cloudflare-dynamicdns's Issues

Create the record if it doesn’t exist

Would be good to have the ability (or an override) to let the tool create the record if it doesn’t exist. Currently the tool will throw an error if the destination zone record doesn’t exist.

N.B. The readme doesn’t cover this. Amended.

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.