Ruby -vs- PHP Showcase: nsupdate script

These are the source code files for the Ruby -vs- PHP Showcase: nsupdate script Read the full story in my blog.

Source codes

Config files

#
# Lookup table of passwords associated with hosts to update.
# The available parameters are:
#   * key - Password the host uses to authenticate the update (REQUIRED).
#   * nskey - Path to the TSIG key for this host (default $DEFAULT_NSKEY).
#   * nameserver - Host to which update is sent (default $DEFAULT_NAMESERVER).
#   * ttl - Default TTL value to use for this host. (default $DEFAULT_TTL).
# The _HOSTKEY() function may be used for the common case of assigning
# a key and defaulting all the other values.
#
defaults:
  #
  # Default pathname to the TSIG key generated by dnssec-keygen(8).
  #
  # *** You MUST adjust DEFAULT_NSKEY and point it to the key you generated
  # *** when installing web-nsupdate.
  #
  nskey: /usr/local/lib/web-nsupdate/Kweb-nsupdate.+157+61241.key

  #
  # Default nameserver to which the update will be sent.
  #
  nameserver: localhost

  #
  # Default TTL value (seconds) to use for the host record.
  #
  ttl: 3600











# *** You MUST add entries for your DDNS clients here, one entry
# *** per client.  I recommend adding a test entry (say
# *** "test.example.com") that does not correspond to a real host.

# simple example, three hosts, each assigned a password
host1.example.com: { key: fowCofyud  }
host2.example.com: { key: Jinsevish7 }
host3.example.com: { key: AvFafEmray }

# complicated example, with everything set
host4.darkride.org:
  key:          edyokJevFi
  nskey:        /etc/bind/Khost4.example.com.+157+25458.key
  nameserver:   ns.example.net
  ttl:          300