项目作者: Spoofardio

项目描述 :
Tracks the public IP of a server and updates DNS records if that IP address changes
高级语言: Go
项目地址: git://github.com/Spoofardio/dns-ip-updater.git
创建时间: 2018-10-04T22:44:16Z
项目社区:https://github.com/Spoofardio/dns-ip-updater

开源协议:MIT License

下载


DNS IP Updater

This program polls the host’s ip public address and infroms a third-party server to update the DNS records with the host’s new IP.

The client is the ‘host’ in this project. It is the computer that runs the services and its where the DNS records point to. The server is the third-party computer that is in charge of updating the DNS records for the client because the client’s new IP is not whitelisted by namecheap’s API.

Getting Started

Create the file ‘config.go’ in both the client and server

server/config.go

  1. package main
  2. const namecheapAPIUser = ""
  3. const namecheapAPIToken = ""
  4. const namecheapUserName = ""
  5. const namecheapSLD = "yahoo"
  6. const namecheapTLD = "com"

client/config.go

  1. package main
  2. const twilioSid = ""
  3. const twilioToken = ""
  4. const twilioFrom = "" // format: +17778889999
  5. const twilioTo = ""
  6. const serverURL = ""

Testing Locally

To run the server

  1. KEY="default" go run server/*.go

Build Docker

The Client

  1. docker build -t registry.tunerinc.com/dns-ip-updater:client ./client/

The Server

  1. docker build -t registry.tunerinc.com/dns-ip-updater:server ./server/

Running The Program

Locally

Run the Client

  1. docker run -d --restart=unless-stopped /
  2. --name=dns-ip-updater-client \
  3. -e KEY=default -e USERNAME=username -e PASSWORD=password \
  4. registry.tunerinc.com/dns-ip-updater:client

Run the Server

  1. docker run -d --restart=unless-stopped /
  2. --name=dns-ip-updater-server -e KEY=default \
  3. registry.tunerinc.com/dns-ip-updater:server

Production (On host and VM)

Fill in the docker-compose template for both the client and server

  1. cp docker-compose.template.yaml docker-compose.yaml

Fill in traefik config

  1. cp traefik.template.toml traefik.toml

To encrypt the login information for basic-auth use this command after filling out your username and password.

  1. echo $(htpasswd -nb <AUTH-USER> <AUTH-PASS>) | sed -e s/\\$/\\$\\$/g

Run the client with the docker-compose file

  1. docker-compose up -d

Run the Server with docker-compose file on a GCE VM(shared cpu + .6Gb RAM)

  1. docker network create web && \
  2. touch ./dns-ip-updater/server/acme.json && chmod 600 ./dns-ip-updater/server/acme.json && \
  3. docker-compose up -d