Giter VIP home page Giter VIP logo

gandyn's Introduction

Forked from Chralu/gandyn


Gandyn

Your server has a dynamic IP address and you use Gandi as domain name server? Then Gandyn is for you!

This is an unsecure script based on Comète's work. It uses Gandi XML-RPC service to update your DNS record. Server public IP address is retrieved from http://ifconfig.me.

As this is my first python "project", code might not be very pythonic. So, feel free to improve it :)

Prequisites

First of all you have to enable XML-RPC interface for your domain on Gandi web interface. Gandi will then give you an API key. Copy paste it to your gandyn config file.

Installation

Archlinux users:

There is a 'gandyn-git' package in AUR.

Others:

The python standard way works.

$ wget -O gandyn.tar.gz https://github.com/Chralu/gandyn/tarball/<version>
$ tar xvzf gandyn.tar.gz
$ cd gandyn/src/
# python setup.py install

If you encounter issues with the xmlrpc.client missing module, you may try to install with Python 3.3 (or any other version 3 of python you may have)

$ python3.3 setup.py install

Execution

Add execute permission to gandyn.py

chmod +x /usr/local/bin/gandyn.py

Gandyn gets its configuration from a simple python file. Config file syntax is described later. To run Gandyn, use the command :

gandyn.py --config <path to the config file>

To get Gandyn run every 5 minutes, add the following line to your crontab.

*/5 * * * * /usr/local/bin/gandyn.py --config <path to the config file>

Configuration

Configuration file is a simple python script that defines global constants.

This is unsecure, so it is important that nobody can change the config file content.

Here is a basic config file with default values:

#API key generated by Gandi
API_KEY = '' 

#Name of the domain to update
DOMAIN_NAME = 'mydomain.net'

#Time to live of the updated record
TTL = 300

#Filters used to find the record to update.
#By default, the updated record is "@   A   xxx.xxx.xxx.xxx"
#Where 'xxx.xxx.xxx.xxx' is the updated value
RECORD = {'type':'A', 'name':'@'}

#Log level of the script. Values are :
#   logging.DEBUG
#   logging.INFO
#   logging.WARNING
#   logging.ERROR
#   logging.CRITICAL
LOG_LEVEL = logging.DEBUG

#Path of the log file
LOG_FILE = 'gandyn.log'

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.