Coder Social home page Coder Social logo

gandi-ddns's Introduction

gandi-ddns

Simple script to update DNS A record of your domain dynamically using gandi.net's API

Inspired from https://github.com/matt1/gandi-ddns

The script simply connects to Gandi LiveDNS API to update a specific A record from the current public IP Address. The script use ipify to get current IP Address, if the address is different from the one in the selected A record, the record is updated with the current IP Address.

Pre-Requisite

You'll need a GANDI API Key to use the script. You can create one in the Security section of your Gandi Account.

How to use

Direct run

git clone https://github.com/z720/gandi-ddns .
cd gandi-ddns
npm install
export GANDI_API_KEY=<your API Key>
npm start <yourdomain.example> <subdomain>

Using a docker container

Using Environment Variables

docker run -e "GANDI_API_KEY=<your API Key>" -d z720/gandi-ddns <yourdomain.example> <subdomain>

Configuration

It's possible to update the configuration by creating a config.json file in the script directory.

  • api_key: Your API key if you want to store it in a file (probaby unsecure)
  • endpoint (default https://dns.api.gandi.net/api/v5) The GANDI liveDNS endpoint if you need to overwrite it
  • ipcheck (default https://api.ipify.org) The current public IP reference if you need to overwrite it (should return the IP address in plain text).
  • domain: The domain to get the zone file from
  • record: The record name to fetch, the record must exists and be an A record. The script only updates an existing records. Should probably work fine with @ record as well as *.subdomain.
  • interval: (default 300 every 5 minutes) Time in minutes between each checks, for each check the script gets the record and the current IP Address.
  • debug: Enable debugging - false by default.

Limitations

  • Only one record is updated, it means that only one subdomain/domain is updated. You can use a CNAME records to match the updated records or run several instance of the script at once.

gandi-ddns's People

Contributors

dependabot[bot] avatar z720 avatar

Stargazers

 avatar

Watchers

 avatar

gandi-ddns's Issues

Script Crashes if current ip can't be retrieved.

if (oldip != current.ip) {
--
^
 
TypeError: Cannot read property 'ip' of null
at /usr/src/app/index.js:28:26
at Request._callback (/usr/src/app/index.js:47:4)
at self.callback (/usr/src/app/node_modules/�[4mrequest�[24m/request.js:185:22)
�[90m    at Request.emit (events.js:315:20)�[39m
at Request.onRequestError (/usr/src/app/node_modules/�[4mrequest�[24m/request.js:881:8)
�[90m    at ClientRequest.emit (events.js:315:20)�[39m
�[90m    at TLSSocket.socketErrorListener (_http_client.js:426:9)�[39m
�[90m    at TLSSocket.emit (events.js:315:20)�[39m
�[90m    at emitErrorNT (internal/streams/destroy.js:92:8)�[39m
�[90m    at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)�[39m

config.json

Hi,

I have tried a few things to configure the config.json file but without success. The api-key is not accepted (while it works when I export it).
Any advice ?

Thanks,
G.

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.