All Projects → cavebeat → Gandi Live Dns

cavebeat / Gandi Live Dns

Licence: gpl-3.0
DynDNS Updater for Gandi LiveDNS REST API

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Gandi Live Dns

Rrda
REST API allowing to perform DNS queries over HTTP
Stars: ✭ 176 (+51.72%)
Mutual labels:  api, rest, dns
Com api
API framework for Joomla
Stars: ✭ 102 (-12.07%)
Mutual labels:  api, rest
Kubernetes Pfsense Controller
Integrate Kubernetes and pfSense
Stars: ✭ 100 (-13.79%)
Mutual labels:  api, dns
Flickr Sdk
Almost certainly the best Flickr API client in the world for node and the browser
Stars: ✭ 104 (-10.34%)
Mutual labels:  api, rest
Tiledesk Server
Tiledesk server. Tiledesk is an Open Source Live Chat platform written in NodeJs and MongoDB
Stars: ✭ 94 (-18.97%)
Mutual labels:  api, rest
Http restful api
整理HTTP后台端的RESTful API方面的知识
Stars: ✭ 94 (-18.97%)
Mutual labels:  api, rest
Denonavr
Automation Library for Denon AVR receivers.
Stars: ✭ 104 (-10.34%)
Mutual labels:  api, rest
Go Whatsapp Rest
Go WhatsApp Implementation in REST API
Stars: ✭ 86 (-25.86%)
Mutual labels:  api, rest
Airdcpp Webclient
Communal peer-to-peer file sharing application for file servers/NAS devices
Stars: ✭ 106 (-8.62%)
Mutual labels:  api, rest
Golang Gin Realworld Example App
Exemplary real world application built with Golang + Gin
Stars: ✭ 1,780 (+1434.48%)
Mutual labels:  api, rest
Vue Api Query
💎 Elegant and simple way to build requests for REST API
Stars: ✭ 1,528 (+1217.24%)
Mutual labels:  api, rest
Behat Api Extension
API extension for Behat, used to ease testing of JSON-based APIs
Stars: ✭ 92 (-20.69%)
Mutual labels:  api, rest
Api Client Generator
Angular REST API client generator from Swagger YAML or JSON file with camel case settigs
Stars: ✭ 92 (-20.69%)
Mutual labels:  api, rest
Appy Backend
A user system to bootstrap your app.
Stars: ✭ 96 (-17.24%)
Mutual labels:  api, rest
Camunda.api.client
Camunda REST API Client for .NET platform
Stars: ✭ 87 (-25%)
Mutual labels:  api, rest
Tcases
A model-based test case generator
Stars: ✭ 103 (-11.21%)
Mutual labels:  api, rest
Psx
PHP REST API Framework
Stars: ✭ 108 (-6.9%)
Mutual labels:  api, rest
Huobi golang
Go SDK for Huobi Spot API
Stars: ✭ 76 (-34.48%)
Mutual labels:  api, rest
Queryql
Easily add filtering, sorting, and pagination to your Node.js REST API through your old friend: the query string!
Stars: ✭ 76 (-34.48%)
Mutual labels:  api, rest
Invoice As A Service
💰 Simple invoicing service (REST API): from JSON to PDF
Stars: ✭ 106 (-8.62%)
Mutual labels:  api, rest

gandi-live-dns

This is a simple dynamic DNS updater for the Gandi registrar. It uses their LiveDNS 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.

It has been developed on Debian 8 Jessie and tested on Debian 9 Stretch 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.

Goal

You want your homeserver to be always available at dynamic_subdomain.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 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.

Git Clone or Download the Script

Download the Script from here as zip/tar.gz and extract it.

or clone from git

git clone https://github.com/cavebeat/gandi-live-dns.git

Script Configuration

Then you'd need to configure the script in the src directory. Copy example.config.py to config.py, and put it in the same directory as the script.

Edit the config file to fit your needs.

api_secret

Start by retrieving your API Key from the "Security" section in new Gandi Account admin panel to be able to make authenticated requests to the API. api_secret = '---my_secret_API_KEY----'

api_endpoint

Gandiv5 LiveDNS API Location http://doc.livedns.gandi.net/#api-endpoint

api_endpoint = 'https://dns.api.gandi.net/api/v5'
domain

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"]

The first subdomain is used to find out the actual IP in the Zone Records.

Run the script

And run the script:

[email protected]:~/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.

[email protected]:~/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
IP Address Mismatch - going to update the DNS Records for the subdomains with new IP 127.0.0.2
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

[email protected]:~/gandi-live-dns-master/src# ./gandi-live-dns.py -h
usage: gandi-live-dns.py [-h] [-f]

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 Zone File/Zone UUID. This can be used if additional/new subdomains get appended to the conig file.

IP address lookup service

There exist several providers for this case, but better is to run your own somewhere.

Poor Mans PHP Solution

On a LAMP Stack, place the file index.php in a directory /ip in your webroot.

[email protected]:~# curl https://blog.cavebeat.org/ip/
127.0.0.1

This should fit your personal needs and you still selfhost the whole thing.

IP address lookup service https://ifconfig.co

https://github.com/mpolden/ipd A simple service for looking up your IP address. This is the code that powers https://ifconfig.co

use external services

choose one as described in the config file.

Cron the script

Run the script every five minutes.

*/5 * * * * /root/gandi-live-dns-master/src/gandi-live-dns.py >/dev/null 2>&1 

Limitations

The XML-RPC API has a limit of 30 requests per 2 seconds, so i guess it's safe to update 25 subdomains at once with the REST API.

Upcoming Features

  • command line Argument for verbose mode

Inspiration

This DynDNS updater is inspired by https://github.com/jasontbradshaw/gandi-dyndns which worked very well with the classic DNS from Gandiv4 Website and their XML-RPC API.

Gandi has created a new API, i accidently switched to the new DNS Record System, so someone had to start a new updater.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].