Skip to content

clempaul/dreamhost-dynamic-dns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

24 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Dreamhost Dynamic DNS Script

A Dynamic DNS updater for use with the Dreamhost API


This script updates a DNS A record hosted by Dreamhost to your current IP address via the Dreamhost API.

You need to have generated an API key from the web panel with permissions for the following requests:

  • dns-list_records
  • dns-remove_record
  • dns-add_record

WARNING: Do not rely on this script to always work perfectly!! Due to the lack of update_record API request, we are forced to delete and then re-add. If there is a problem with the API, we could end up deleting a record and then fail to re-add it. If you have this in cron, it will likely update the next time the script is run, or you could just be left without a DNS record at all.

This script is dependant on the following executables: bash (this is a bash script after all), wget or curl, uuidgen, grep, awk, sed, and dig.

Usage

The script can be run using either command line options or a configuration file. A sample configuration file is found below.

SYNOPSIS

dynamicdns.bash [-Sd][-k API Key] [-r Record] [-i New IP Address] [-L Logging (true/false)]

DESCRIPTION

The dynamicdns.bash utility reads a configuration file or command-line options to update DNS records for a Dreamhost account. Options provided at the command line override any options specified within the configuration file.

The options are as follows:

-S Save any options provided via the command line to the configuration file.

-d Save any options provided via the command line to the configuration file and do not update DNS.

-v Enable verbose mode.

-l Enable list-only mode, showing only current value returned by the Dreamhost API.

-k API Key

Dreamhost API Key with dns-list_records, dns-remove_record, and dns-add_record permissions.

-r Record

The DNS Record to be updated.

i IP Address

Specify the IPv4 Address to update the Record to. If no address is specified, the utility will use dig to obtain the current public IPv4 Address of your computer.

L (true/false)

Enables system logging via the logger command. The configuration file sets logging to true by default.

RUNNING WITH CRON

You can easily add this to your crontab with an entry like

@hourly ~/bin/dreamhost-dynamic-dns/dynamicdns.bash

TODO

  • Allow disabling of error logging
  • Add verbose mode

About

A Dynamic DNS updater for use with the Dreamhost API

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages