Last active
February 25, 2017 00:27
-
-
Save depwl9992/f5137ca98e034d24ae34e24ffae811a8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Update A-records on each domain hosted at enom.com. | |
# Updated by Daniel Powell on 2017-02-24 | |
# 2017-02-24 - Turns out according to https://gist.github.com/agarzon/2431219, we can combine HostName+Zone into Zone, and omitting Address assumes the IP performing the HTTP call. | |
# - Functionize this script! It's totally awesome now. | |
# | |
# Make a GET call to http://dynamic.name-services.com/interface.asp | |
# All known params according to https://www.enom.com/download/updateip.cpp: | |
# Command=SetDNSHost -- I don't know if this is the only option. Would be great if one could set cnames, mx records, redirects, text records from this too... | |
# HostName=www -- Set subdomain including '@', '*', etc. | |
# Zone=domain.com -- This is the domain used to login to access.enom.com. Can omit the HostName parameter and include the subdomain here instead (e.g. 'www.domain.com'). | |
# DomainPassword=passwd -- This is the password used to login to access.enom.com. | |
# Address=127.0.0.1 -- Can enter any IPv4 address. If omitted, it uses the IP making the HTTP call. | |
setEnom() { | |
Command="SetDNSHost" | |
if [ -z "$1" ] | |
then | |
echo "Need valid zone." | |
return 1 | |
fi | |
if [ -z "$2" ] | |
then | |
echo "Need valid domain password." | |
return 1 | |
fi | |
curl http://dynamic.name-services.com/interface.asp?Command=$Command\&Zone=$1\&DomainPassword=$2 | |
} | |
setEnom "@.domain.com" "domainPasswd" | |
setEnom "www.domain.com" "domainPasswd" | |
setEnom "sub.domain.com" "domainPasswd" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment