GithubHelp home page GithubHelp logo

dreamhostdns_updater's Introduction

Dreamhost DNS updater

This is a short Python3 CGI script to update Dreamhost DNS entries. This is necessary for firewalls like OPNsense that don't directly support Dreamhost, but do support updating a DNS entry by URL.

WHile Dreamhost has an API, the DNS API doesn't support updates to a DNS entry. You can add an entry or delete an entry with a single URL, but not both. This simple Python3 CGI script allows the OPNsense DynDNS plugin to update your hostnames on Dreamhost with a single URL (per host, of course).

The script first retrieves the current IP address (in an A record) from Dreamhost, and then updates it only if it has changed. This avoids extraneous updates.

Usage

This is a CGI script that should run on any CGI-enabled web server that provides the requests Python3 package (along with standard packages uuid and cgi). It has been tested running as a CGI script on Dreamhost's own web servers. Place it in a directory with the following entries in .htaccess:

AddHandler cgi-script .cgi
Options +ExecCGI

OPNsense

This web page works with the Custom DynDNS provider. The URL you should use is:

https://path.to.server/.../dreamhostdns_updater.cgi?key=MY_API_KEY&hostname=my.host.name

You may optionally specify an address to use with &address=0.1.2.3. If you don't specify an address, the script will use the IP address of the system that sent the request. If you're using OPNsense to do the update, this works correctly as long as the request comes from the interface for which you're defining the DNS entry (which it should, if you've set things up correctly).

Security

The script should be relatively safe: it only takes inputs and passes them along to Dreamhosts's API using multiple requests rather than a single request. The script itself contains no secrets - the API key must be passed as part of the URL.

There's a potential issue if you install this script in a location where an unauthorized person can see access logs, since the API key is included in the URL. If this is an issue, it may be useful to modify the script to accept information in the form of embedded form data (POST) rather than in the URL. However, if you're installing this on a Dreamhost server in the first place, it's likely that the logs are only accessible to you (who knows the key) and Dreamhost (who could do whatever they want to your DNS entries), so it's likely not an issue.

dreamhostdns_updater's People

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Forkers

liverwust

dreamhostdns_updater's Issues

Integrate this into OPNSense

Hi I read your description of the project. I did not try it out but it looks useful. It may be more useful if you were able to integrate it directly into the OPNsense project.

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.