From 03be4141d3a5e06059d6410ea26fe79cc74a236d Mon Sep 17 00:00:00 2001 From: cave beat Date: Tue, 15 Aug 2017 18:01:15 +0200 Subject: [PATCH] updated README --- README.md | 44 +++++++++++++++++++++++--------------------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index 867bdbb..7fa7de9 100644 --- a/README.md +++ b/README.md @@ -2,19 +2,20 @@ gandi_live_dns ---- This is a simple dynamic DNS updater for the -[Gandi](https://www.gandi.net) registrar. It uses their REST API to update -the zone file for a subdomain of a domain to point at the external IPv4 -address of the computer it has been run from. +[Gandi](https://www.gandi.net) registrar. It uses their [LiveDNS REST API](http://doc.livedns.gandi.net/) to update the zone file for a subdomain of a domain to point at the external IPv4 address of the computer it has been run from. It has been developed on Debian 8 Jessie and tested on Debian 9 Sretch GNU/Linux using Python 2.7. -With the new v5 Website, Gandi has also launched a -new REST API which makes it easier to communicate via bash/curl or python/requests. +With the new v5 Website, Gandi has also launched a new REST API which makes it easier to communicate via bash/curl or python/requests. ### Goal You want your homeserver to be always available at `dynamic.mydomain.tld`. +### Debian Package Requirements + +`apt-get update && apt-get upgrade && apt-get install unzip python-requests python-args python-simplejson` + #### API Key First, you must apply for an API key with Gandi. Visit https://account.gandi.net/en/ and apply for (at least) the production API @@ -23,10 +24,6 @@ key by following their directions. #### A DNS Record Create the DNS A Records in the GANDI Webinterface which you want to update if your IP changes. -### Debian Package Requirements - -`apt-get update && apt-get upgrade && apt-get install unzip python-requests python-args python-simplejson` - #### Git Clone or Download the Script Download the Script from [GitHub](https://github.com/cavebeat/gandi_live_dns/archive/master.zip) and unzip it. @@ -47,32 +44,37 @@ api_secret = '---my_secret_API_KEY----' ##### api_endpoint Gandiv5 LiveDNS API Location http://doc.livedns.gandi.net/#api-endpoint -''' + +``` api_endpoint = 'https://dns.beta.gandi.net/api/v5' +``` ##### domain -Your domain with the subdomains to be updated -domain = 'mydomain.tld' +Your domain for the subdomains to be updated + ##### subdomains -All subdomains which should be updated. They get created if they do not yet exist. -subdomains = ["subdomain1", "subdomain2", "subdomain3"] +All subdomains which should be updated. They get created if they do not yet exist. -The first domain is used to find out the actual IP in the Zone Records. +``` +subdomains = ["subdomain1", "subdomain2", "subdomain3"] +``` +The first subdomain is used to find out the actual IP in the Zone Records. #### Run the script And run the script: -` + +``` root@dyndns:~/gandi_live_dns-master/src# ./gandi_live_dns.py Checking dynamic IP: 127.0.0.1 Checking IP from DNS Record subdomain1: 127.0.0.1 IP Address Match - no further action -` +``` If your IP has changed, it will be detected and the update will be triggered. -` +``` root@dyndns:~/gandi_live_dns-master/src# ./gandi_live_dns.py Checking dynamic IP: 127.0.0.2 Checking IP from DNS Record subdomain1: 127.0.0.1 @@ -80,11 +82,11 @@ IP Address Mismatch - going to update the DNS Records for the subdomains with ne Status Code: 201 , DNS Record Created , IP updated for subdomain1 Status Code: 201 , DNS Record Created , IP updated for subdomain2 Status Code: 201 , DNS Record Created , IP updated for subdomain3 -` +``` #### Command Line Arguments -` +``` root@dyndns:~/gandi_live_dns-master/src# ./gandi_live_dns.py -h usage: gandi_live_dns.py [-h] [-f] @@ -92,7 +94,7 @@ optional arguments: -h, --help show this help message and exit -f, --force force an update/create -` +``` The force option runs the script, even when no IP change has been detected. It will update all subdomains and even create them if they are missing in the