Giter Club home page Giter Club logo

ddns4me's Introduction

DDNS4Me

A Dynamic DNS Command Line tool for use with Cloudflare

Build

Overview

DDNS4Me is a basic CLI tool that allows updating of Cloudflare DNS "A" Records to reflect your current public IP address. It utilises the Cloudflare API to perform the DNS updating and a third-party service to identify your public IP address.

Usage

Common Usage

ddns4me --auth-path cfauth.json --zone dac9630aec642a428cd73f4be0a03569 --name my.example.org

Using a custom IP provider

ddns4me --auth-path cfauth.json --zone dac9630aec642a428cd73f4be0a03569 --name my.example.org --ip-provider https://echo.example.org

Using a custom TTL

ddns4me --auth-path cfauth.json --zone dac9630aec642a428cd73f4be0a03569 --name my.example.org --ttl 360

Command Line Arguments

Argument Description
--auth-path Required. Path to the authentication file that contains the authentication details.
--zone Required. The Cloudflare Zone Identifier.
--name Required. The DNS name to use in the zone.
--ttl (Default: 120) The DNS record Time-to-Live (TTL) in seconds.
--ip-provider (Default: https://icanhazip.com/) URL for service that returns your public IP as plain text.

Authentication

DDNS4Me requires a Cloudflare API token which needs to be stored in a JSON file to avoid the token itself being stored in shell logs.

{
    "CloudflareApiToken": "3706c7ce56fa785fe0e8e09c0c4bbacd"
}

To create your own Cloudflare API token, head to your account profile on Cloudflare then to the API Tokens page. From there, you need to create a token with the Edit zone DNS permission which Cloudflare has a template for.

Cloudflare Create API Tokens page

Public IP Address Discovery

The third-party service for public IP addresses can be any service that returns your public IP as plain text from a HTTP request. By default, DDNS4Me will use icanhazip.com however you can specify your own via the --ip-provider command line argument.

For those that have privacy concerns or would like to control the IP provider themselves, it can be a straightforward task to make your own. Through something like Cloudflare Workers, available for free, you can build your own IP provider with code similar to this example:

addEventListener('fetch', event => {
  event.respondWith(handleRequest(event.request))
})

/**
 * Respond to the request
 * @param {Request} request
 */
async function handleRequest(request) {
  return new Response(request.headers.get("cf-connecting-ip"), {status: 200})
}

It is entirely possible to build your own in any language on any Internet-available service - whether that be Azure Functions, AWS Lambda or some other hosting. The only thing it needs to do is echo-back as plain text the IP address of the client that made the request.

ddns4me's People

Contributors

turnerj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

mollsandhersh

ddns4me's Issues

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.