{"id":13648303,"url":"https://github.com/cavebeat/gandi-live-dns","last_synced_at":"2025-04-22T07:31:09.338Z","repository":{"id":44499950,"uuid":"100310722","full_name":"cavebeat/gandi-live-dns","owner":"cavebeat","description":"DynDNS Updater for Gandi LiveDNS REST API","archived":false,"fork":false,"pushed_at":"2024-05-28T16:21:06.000Z","size":27,"stargazers_count":126,"open_issues_count":19,"forks_count":55,"subscribers_count":10,"default_branch":"master","last_synced_at":"2024-11-09T22:38:48.723Z","etag":null,"topics":["api","dns","dyndns","dyndns-updater","gandi","livedns","python","rest"],"latest_commit_sha":null,"homepage":"http://doc.livedns.gandi.net/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cavebeat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-14T21:25:37.000Z","updated_at":"2024-06-03T02:02:34.000Z","dependencies_parsed_at":"2024-11-09T22:32:14.100Z","dependency_job_id":"f8caa0ed-6cb4-4ea5-800e-69442a82297a","html_url":"https://github.com/cavebeat/gandi-live-dns","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cavebeat%2Fgandi-live-dns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cavebeat%2Fgandi-live-dns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cavebeat%2Fgandi-live-dns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cavebeat%2Fgandi-live-dns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cavebeat","download_url":"https://codeload.github.com/cavebeat/gandi-live-dns/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250195033,"owners_count":21390230,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","dns","dyndns","dyndns-updater","gandi","livedns","python","rest"],"created_at":"2024-08-02T01:04:07.717Z","updated_at":"2025-04-22T07:31:09.100Z","avatar_url":"https://github.com/cavebeat.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"gandi-live-dns\n----\n\nThis is a simple dynamic DNS updater for the\n[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.\n\nIt has been developed on Debian 8 Jessie and tested on Debian 9 Stretch GNU/Linux using Python 2.7.\n\nWith the new v5 Website, Gandi has also launched a new REST API which makes it easier to communicate via bash/curl or python/requests.  \n\n### Goal\n\nYou want your homeserver to be always available at `dynamic_subdomain.mydomain.tld`.\n\n### Debian Package Requirements\n\n`apt-get update \u0026\u0026 apt-get upgrade \u0026\u0026 apt-get install unzip python-requests python-args python-simplejson`\n\n#### API Key\nFirst, you must apply for an API key with Gandi. Visit \nhttps://account.gandi.net/en/ and apply for (at least) the production API \nkey by following their directions.\n\n#### A DNS Record \nCreate the DNS A Records in the GANDI Webinterface which you want to update if your IP changes. \n\n#### Git Clone or Download the Script\nDownload the Script from here as [zip](https://github.com/cavebeat/gandi-live-dns/archive/master.zip)/[tar.gz](https://github.com/cavebeat/gandi-live-dns/archive/master.tar.gz) and extract it.  \n\nor clone from git\n\n`git clone https://github.com/cavebeat/gandi-live-dns.git` \n\n#### Script Configuration\nThen you'd need to configure the script in the src directory.\nCopy `example.config.py` to `config.py`, and put it in the same directory as the script.\n\nEdit the config file to fit your needs. \n\n##### api_secret\nStart by retrieving your API Key from the \"Security\" section in new [Gandi Account admin panel](https://account.gandi.net/) to be able to make authenticated requests to the API.\napi_secret = '---my_secret_API_KEY----'\n\n##### api_endpoint\nGandiv5 LiveDNS API Location\nhttp://doc.livedns.gandi.net/#api-endpoint\n\n```\napi_endpoint = 'https://dns.api.gandi.net/api/v5'\n```\n\n##### domain\nYour domain for the subdomains to be updated \n\n\n##### subdomains\nAll subdomains which should be updated. They get created if they do not yet exist.\n\n``` \nsubdomains = [\"subdomain1\", \"subdomain2\", \"subdomain3\"]\n```\nThe first subdomain is used to find out the actual IP in the Zone Records. \n\n#### Run the script\nAnd run the script:\n\n```\nroot@dyndns:~/gandi-live-dns-master/src# ./gandi-live-dns.py   \nChecking dynamic IP:  127.0.0.1\nChecking IP from DNS Record subdomain1:  127.0.0.1\nIP Address Match - no further action\n```\n\nIf your IP has changed, it will be detected and the update will be triggered. \n\n\n```\nroot@dyndns:~/gandi-live-dns-master/src# ./gandi-live-dns.py\nChecking dynamic IP:  127.0.0.2\nChecking IP from DNS Record subdomain1:  127.0.0.1\nIP Address Mismatch - going to update the DNS Records for the subdomains with new IP 127.0.0.2\nStatus Code: 201 , DNS Record Created , IP updated for subdomain1\nStatus Code: 201 , DNS Record Created , IP updated for subdomain2\nStatus Code: 201 , DNS Record Created , IP updated for subdomain3\n```\n\n#### Command Line Arguments\n\n```\nroot@dyndns:~/gandi-live-dns-master/src# ./gandi-live-dns.py -h\nusage: gandi-live-dns.py [-h] [-f]\n\noptional arguments:\n  -h, --help     show this help message and exit\n  -f, --force    force an update/create\n\n```\n\nThe force option runs the script, even when no IP change has been detected. \nIt will update all subdomains and even create them if they are missing in the \nZone File/Zone UUID. This can be used if additional/new subdomains get appended to the conig file.  \n\n### IP address lookup service \nThere exist several providers for this case, but better is to run your own somewhere. \n\n#### Poor Mans PHP Solution\nOn a LAMP Stack, place the file [index.php](https://github.com/cavebeat/gandi-live-dns/blob/master/src/example-index.php) in a directory /ip in your webroot. \n\n```\nroot@laptop:~# curl https://blog.cavebeat.org/ip/\n127.0.0.1\n```\nThis should fit your personal needs and you still selfhost the whole thing. \n\n####  IP address lookup service https://ifconfig.co\nhttps://github.com/mpolden/ipd A simple service for looking up your IP address. This is the code that powers [https://ifconfig.co](https://ifconfig.co)\n\n#### use external services\nchoose one as described in the config file. \n\n### Cron the script\n\nRun the script every five minutes. \n```\n*/5 * * * * /root/gandi-live-dns-master/src/gandi-live-dns.py \u003e/dev/null 2\u003e\u00261 \n```\n### Limitations\nThe 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. \n\n\n### Upcoming Features\n* command line Argument for verbose mode\n\n### Inspiration   \n\nThis DynDNS updater is inspired by https://github.com/jasontbradshaw/gandi-dyndns which worked very well \nwith the classic DNS from Gandiv4 Website and their XML-RPC API.\n\nGandi has created a new API, i accidently switched to the new DNS Record System, so someone had to start a new updater.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcavebeat%2Fgandi-live-dns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcavebeat%2Fgandi-live-dns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcavebeat%2Fgandi-live-dns/lists"}