Showing posts with label dns. Show all posts
Showing posts with label dns. Show all posts

Thursday, November 28, 2013

Utiliser l'API gandi pour faire du DNS dynamique (à la DynDNS)

Vous avez un nom de domaine enregistré chez gandi.net ? Vous avez besoin d'un nom de domain pour une machine perso sur une ligne ADSL ? Rien de plus simple !

Créer d'abord une clé d'API sur https://www.gandi.net/admin/api_key

Puis on crée via l'interface web une entrée initiale pour la machine qui nous intéresse (par exemple monpc.mydomain.com) sur https://www.gandi.net/admin/domain

On télécharge le script python qui va accèder à cette API:
git clone https://github.com/lembregtse/gandi-dyndns.git /usr/local/src/gandi-dyndns
ln -s  /usr/local/src/gandi-dyndns/gandi-dyndns  /usr/local/bin/gandi-dyndns

Premier jet en ligne de commande ( vous devez utilisez la clé de production pour que ca marche)
gandi-dyndns --api=123rdyy --domain=mydomain.com --record=monpc

On ajoute dans la crontab le script suivant pour actualiser toutes les heures:

dans un fichier /etc/cron.hourly/gandy

#!/bin/sh
/usr/local/bin/gandi-dyndns --api=123rdBy --domain=mydomain.com --record=monpc > /var/log/gandy.log

Enjoy your dyndns !