Skip to content
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.
/ dyndns Public archive

A dynamic dns update script for cloudflare.

Notifications You must be signed in to change notification settings

tyduptyler13/dyndns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DynDNS (v2)

A dynamic dns updater for cloudflare.

Requirements (Preinstall)

  • You will need node.js installed on your computer. It comes with npm which handles all other dependencies.

Setup

  • Open this repository in any directory.
  • Run npm install
  • Run cp settings-example.json settings.json
  • Edit settings to fit your own domain(s). (See setup options)

Usage

To run the program use npm start

To run this periodically, use sudo crontab -e to install a root cron task. Add a line like the following: */30 * * * * /home/USER/git/dyndns/update.sh Change the directory to the path you have chosen for this tool. Change the 30 to the number of minutes you would like to wait before executing again. (*/15 would be every 15 mins).

If you know how often your ip changes then change the cron accordingly. (Default of 30mins)

To force update your dns on the next update just remove the ips.json file.

This is extremely modular and it is possible to use an entirely different api by simply changing the settings.json. It will not be able to do id lookups if you choose not to use the cloudflare api.

Setup options

Globals:

  • url - Cloudflare url. (Change this only if you want to adapt this for another api.) (REQUIRED)
  • timeout - Maximum timeout for responses. (REQUIRED)
  • strictSSL - Use strict ssl connections? (REQUIRED)
  • checkipv4 - Boolean for disabling ipv4 lookups. (Default: true)
  • checkipv6 - Boolean for disabling ipv6 lookups. (Default: true)
  • ipv4Site - A site to scrape for your ip. (REQUIRED if ipv4 enabled)
  • ipv4Query - A jQuery css search string. (REQUIRED if ipv4 enabled)
  • ipv6Int - Interface to check for ipv6 address. (REQUIRED if ipv6 enabled)
  • includes - These attributes are included in all domains.
    • email - Your email for cloudflare. (Required for cloudflare)
    • tkn - Your cloudflare token. (Required for cloudflare)

Domains: Array of records to update. Each entry in the domain entry will be used as a query set in the update.

Example domain:

{
	"name": "example.com",
	"a": "rec_edit",
	"type": "A",
	"ttl": 1,
	"service_mode": 1,
	"z": "example.com",
	"content": "{ipv4}",
	"id": "?"
}

All of the attributes of a domain are used in the api and using a different attribute set will allow compatibility with other dns apis. (ID lookups only work for cloudflare)

Special notes:

  • "Id" can have "?" instead of the actual id. The program will look it up and update your settings file the first time its run.
  • Content field can have {ipv4} or {ipv6} which will be replaced at update time.
  • The global includes are included only at update time so DO NOT remove name or type from the domains. It will break id lookup functionality.
  • Ipv6 will be the first Global address found on your network interface.

About

A dynamic dns update script for cloudflare.

Resources

Stars

Watchers

Forks

Packages

No packages published