Skip to content

fgiudici/ddflare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo logo

example workflow example workflow

ddflare provides a DDNS (Dynamic DNS) client that allows DNS type A record updates via the DynDNS update prococol v3 or via the Cloudflare API.

Note

ddflare acts as a client for Dynamic DNS services. You can used ddflare with yor Cloudflare registered DNS domain via the Cloudflare API or register to a Dynamic DNS service provider (e.g., No-IP, Dyn, ...) and update your DNS name via the DynDNS update prococol v3.

The DynDNS update prococol v3 is a HTTP based API introduced back in the day by dyndns.org (now Dyn, part of Oracle) which is used by many of the available DDNS service providers.

While ddflare main functionality is to run in a loop to update the target FQDN to the current public IP when a change is detected, it allows to:

  • retrieve and display the current public IP address
  • update a target domain name (FQDN, recorded as a type A record) to point to the current public address (or a custom IP)
  • resolve any domain name (acting as a simple DNS client)

Get ddflare

ddflare is released as statically compiled binaries for different OS/architetures that you can grab from the release page.

Get a x86_64 linux binary example:

wget https://github.com/fgiudici/ddflare/releases/download/v0.1.0/ddflare-linux-amd64
sudo install ddflare-linux-amd64 /usr/local/bin/ddflare

Container images are availble as well on the github repository. Run ddflare via docker with:

docker run -ti --rm ghcr.io/fgiudici/ddflare:0.3.0

Quickstart

ddflare has two main commands: set, to update the type A record of the target FQDN to the current public ip (or a custom IP address) and get, to retrieve the current public IP address (or resolve the FQDN passed as argument), and

Run ddflare help to display all the available commands and flags.

Update domain name via DynDNS update prococol v3

Note

You should register to the DDNS service first, select your FQDN and retrieve the username and password required to authenticate to the service

To update a domain name (FQDN, type A record) to the current public IP address of the host run:

ddflare set -s <DDNS_URL> -t <AUTH_TOKEN> <FQDN>

where <DDNS_URL> is the http endpoint of the DDNS service, <FQDN> is the domain to be updated and <AUTH_TOKEN> is the API authentication token.

Real example with:

  • No-IP DDNS provider
  • myhost.ddns.net FQDN
  • user 68816xj
  • password v4UMHzugodpE
ddflare set -s noip -t 68816xj:v4UMHzugodpE  myhost.ddns.net

Update domain name via Cloudflare API

Tip

In order to update domain names you need a Cloudflare API token with Zone.DNS Edit permission. You can create one following the Cloudflare docs.

To update a domain name (FQDN, type A record) to the current public IP address of the host run:

ddflare set -t <CLOUDFLARE_TOKEN> <FQDN>

where <FQDN> is the domain to be updated and <CLOUDFLARE_TOKEN> is a Cloudflare API token.

Real example with FQDN myhost.example.com and Cloudflare API token gB1fOLbl2d5XynhfIOJvzX8Y4rZnU5RLPW1hg7cM:

ddflare set -t gB1fOLbl2d5XynhfIOJvzX8Y4rZnU5RLPW1hg7cM  myhost.example.com

Note

ddflare can update existing A records but cannot create new ones, so the record should be created in advance.

To create an A type record see Cloudflare's Manage DNS Records docs.

Tip

When creating a type A record pay attention to the value of the TTL field: it tracks the number of seconds DNS clients and DNS resolvers are allowed to cache the resolved IP address for the record. You may want to keep the TTL low (min is 60 secs) if you plan to use the record to track the (dynamic) IP address of a host in a DDNS scenario.

Get the current public IP address

Retrieving the current public IP address is as easy as:

ddflare get

ddflare queries the ipify.org service under the hood, which detects the public IP address used to reach the service.