Git Product home page Git Product logo

gandi-ldns's Introduction

gandi-ldns

Simple quick & dirty script to update DNS A record of your domain dynamically using gandi.net's API. It is very similar to no-ip and dyndns et al where you can have a domain on the internet which points at your computer's IP address, except it is free (once you have registered the domain) and does not suffer from any forced refreshing etc.

This fork is originally based on matt1's gandi-ddns script, however, it it modified to use Gandi's new "LiveDNS" API instead of the old XML-RPC API. The major differences are:

  • Uses the LiveDNS API and therefore requires your LiveDNS API key, which is different from the XML-RPC key.

  • Only retains compatibility with Python 3.3+, as Python 2.7 will be officially retired in 2020.

  • Dependent on the excellent Requests library.

This version is mostly compatible with the original config file format, only the API Key and API URL need to be changed (see config.example.txt).

Every time the script runs it will get the current domain config from gandi.net's API and look for the IP in the A record for the domain (default name for the record is '@' but you can change that if you want to). It will then get your current external IP from a public "what is my ip" site. Once it has both IPs it will compare what is in the DNS config vs what your IP is, and update the DNS config for the domain as appropriate so that it resolves to your current IP address.

Setup

Ensre you have Python 3.3+ installed, as well as Requests. If you are running a Linux distribution, Requests can likely be installed from your distribution's repositories.

On Arch-based distributions:

pacman -S python-requests

On Debian-based distributions (Ubuntu, Mint, etc):

apt install python3-requests

Then, simply download/clone the contents of this repository to a location of your choice.

You should then copy config.example.txt to config.txt and, at a minimum, modify the values for domain and apikey. If you want to edit the DNS record for a subdomain, you should also edit the a_name entry.

Usage

The script can be simply ran as python3 gandi-ldns.py and takes no arguments. The config.txt file in the script folder will be used.

To run periodically, you can use cron or systemd timers.

gandi-ldns's People

Contributors

matt1 avatar bentiss avatar auxym avatar michaelsanford avatar crsaracco avatar kay0u avatar

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.