Giter Club home page Giter Club logo

cloudflare_ddnss's Introduction

Cloudflare ddnss

This script updates the DNS A and AAAA records of specified domains and subdomains for different DNS zones and different Accounts.

Features

Updates specified A and AAAA records for different zones

Usage

With API Token (recommended)

  • Create API Token via the Cloudflare Dashborad.

  • Required permissions Zone read and DNs edit for all zones with domains to be updated.

  • Enter the Token in domains.json (config -> token, email and key not requiered)

  • Set "token_mode": true

Enter your Domains under zones with sub entry for the zone in ther the Doamin is.

{
	"Demo Auth": {
		"config": {
			"token": "<your-api-token>",
			"token_mode": true
		},
		"zones": {
			"example.com": {
				"0": "example.com",
				"1": "www.example.com"
			},
			"example.de": {
				"0": "example.de",
				"1": "www.example.de"
			}
		}
	},
	"Demo Auth 2": {
		"config": {
			"token": "<other-api-token>",
			"token_mode": true
		},
		"zones": {
			"example.us": {
				"0": "example.com",
				"1": "www.example.com"
			},
			"example.gb": {
				"0": "example.de",
				"1": "www.example.de"
			}
		}
	}
}

With Global API Key

Get Api Key via Cloudflare Dashbord.

  • Cloudflare Dashboard
  • My Profile - Account Home
  • API Tokens - Global API Key
  • Add API Key to domains.json (config -> key , email is requiered, token is not requiered)
  • Set "token_mode": false

Enter your Domains under zones with sub entry for the zone in ther the Doamin is.

{
	"Demo Auth": {
		"config": {
			"email": "<your-email-adress>",
			"key": "<your-global-api-key>",
			"token_mode": false
		},
		"zones": {
			"example.com": {
				"0": "example.com",
				"1": "www.example.com"
			},
			"example.de": {
				"0": "example.de",
				"1": "www.example.de"
			}
		}
	},
	"Demo Auth 2": {
		"config": {
			"email": "<other-email-adress>",
			"key": "<other-global-api-key>",
			"token_mode": false
		},
		"zones": {
			"example.us": {
				"0": "example.com",
				"1": "www.example.com"
			},
			"example.gb": {
				"0": "example.de",
				"1": "www.example.de"
			}
		}
	}
}

Mixed Mode Example

{
	"Demo Auth": {
		"config": {
			"token": "<your-api-token>",
			"token_mode": true
		},
		"zones": {
			"example.com": {
				"0": "example.com",
				"1": "www.example.com"
			},
			"example.de": {
				"0": "example.de",
				"1": "www.example.de"
			}
		}
	},
	"Demo Auth 2": {
		"config": {
			"email": "<other-email-adress>",
			"key": "<other-global-api-key>",
			"token_mode": false
		},
		"zones": {
			"example.us": {
				"0": "example.com",
				"1": "www.example.com"
			},
			"example.gb": {
				"0": "example.de",
				"1": "www.example.de"
			}
		}
	}
}

Options

You can set preferences for each auth block and record.

  • To set TTL you must add
"ttl": <time>

(default: 1 = auto)

  • To set Proxy you must add
"proxied": true or false

(default: true)

  • To set IPv4 you must add
"ip4": true or false

(default: true)

  • To set IPv6 you must add
"ip6": true or false

(default: true)

  • To set Force Settings update to Cloudflare you must add
"foce_settingsip6": true or false

(default: true)

to the config section or to the record in the domains.json file

*If several records with the same name exist, the record id can be passed in the record entry.

"record4_id": "<Record-IPv4-ID>",
"record6_id": "<Record-IPv6-ID>"

Schedule Script Execution

sudo crontab -e

Add new Line to the End

*/1 * * * * python3 /<path>/cloudfare_ddnss.py

cloudflare_ddnss's People

Contributors

larsl-net avatar

Stargazers

 avatar

cloudflare_ddnss's Issues

Add Api Token

Possibility to use a api token and not only the global api key

Add option for default values

Possibility to add standard values or additional values (TTL, proxy).
And possibility to add the Record ID for DNS based load balancing over several records under one name.

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.