Skip to content

joshuar/cf-ddns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cf-ddns

Apache 2.0 GitHub last commit Go Report Card Go Reference Release

What is it?

A Dynamic DNS client for Cloudflare. cf-ddns will update any A/AAAA (IPv4 and IPv6) records for the listed hostnames defined in the configuration file.

Features

  • Simple (YAML) configuration. Just specify your account details, domain and a list of records to update.
  • Runs on a defined interval (no need for cron scheduling) or as a one-shot execution.
  • Fail-over external IP service checks.

Installation

Linux Packages

RPM/DEB packages are available, see the releases page.

go get

go get -u github.com/joshuar/cf-ddns

Usage

Create a configuration file; see the example in this repo. It should contain:

  • Cloudflare account details:
    • Email username.
    • API Key.
    • Zone (i.e., DNS domain) in which record updates are made.
  • Records to update, a list of hostnames for which the host running cf-ddns is called.
  • Interval to run under, specified in a human way (i.e., 1h, 1d, 30m, etc.)
    • Interval is optional; the default will be 1 hour.

cf-ddns looks for a configuration file at /etc/cf-ddns/cf-ddns.yaml by default, but you can specify a path with the --config command-line option.

Once you've got a configuration file, you have two options to run:

Daemon Mode

In daemon mode, cf-ddns will run constantly and check on the interval specific in the configuration file whether an update is needed:

cf-ddns daemon # --config /path/to/config.yml (optional)

A systemd service file has been provided that will run cf-ddns in daemon mode using a configuration file at the default location (/etc/cf-ddns/cf-ddns.yaml).

One-shot Mode

In one-shot mode, cf-ddns will run once, will perform updates as needed, then exit:

cf-ddns # --config /path/to/config.yml (optional)

One-shot mode can be run on a systemd timer, see the provided cf-ddns-oneshot.{service,timer} files.

Contributions

I would welcome your contribution! If you find any improvement or issue you want to fix, feel free to send a pull request!

Creator

Joshua Rich (joshua.rich@gmail.com)