From: Wes H. <har...@us...> - 2004-10-21 21:41:40
|
Update of /cvsroot/dnssec-tools/dnssec-tools/tools/linux-ifup-dyn-dns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9050 Added Files: ifup-dyndns Log Message: A linux init script to register dynamic dns hosts --- NEW FILE: ifup-dyndns --- #!/bin/sh # # meant to be installed as /sbin/ifup-local or called from there # [ a patch should be sent to the initscripts maintainers to add this ] # # # Calling arguments available in ifcfg-DEV: # # UPDATEDNS=yes # enables this script to do its thing # # NSUPDATE=nsupdate # The name (or path) to the nsupdate binary # # UPDATEDNSNAME=NAME # updates this dns NAME. If not specified, the output of # hostname will be used. # # If a secure (via a TSIG key) transaction is to be used, then one of # these should be used: # # UPDATEDNSKEY=DNSKEY # Should be a DNSKEY value suitable for passing to nsupdate -y # DNSKEY # # UPDATEDNSKEYFILE=KEYFILE # Should point to a dnssec (TSIG) key file if one should be used. # Note that both the .key and .private files must be present, but # just the .key file needs to be pointed to. # # Note: if a ifcfg-DEV.key and .private file are found, it will # default to trying to use these if you don't specify one of # these options # # KEYARGS=args # Specifies your own keying arguments passed to nsupdate. # Overrides the above arguments. # cd /etc/sysconfig/network-scripts . network-functions [ -f ../network ] && . ../network DEVICE=$1 CONFIG=/etc/sysconfig/network-scripts/ifcfg-$DEVICE source_config if [ "$UPDATEDNS" ] ; then # # defaults # [ -z "$UPDATEDNSNAME" ] && UPDATEDNSNAME=`hostname` [ -z "$UPDATEDNSTTL" ] && UPDATEDNSTTL=600 [ -z "$NSUPDATE" ] && NSUPDATE="nsupdate" # # get the devices ip address # IPADDR=`LANG= LC_ALL= ifconfig ${DEVICE} | grep 'inet addr' | awk -F: '{ print $2 } ' | awk '{ print $1 }'` # # see if a key or a key file has been specified or is found # if [ -z "$KEYARGS" ]; then if [ -n "$UPDATEDNSKEYFILE" ] ; then KEYARGS="-k $UPDATEDNSKEYFILE" elif [ -n "$UPDATEDNSKEY" ] ; then KEYARGS="-y $UPDATEDNSKEY" elif [ -f ${CONFIG}.key ] ; then KEYARGS="-k ${CONFIG}.key" fi fi # # perform the update # - delete the old records for the name # - adds the new address to the now empty record name # $NSUPDATE $KEYARGS <<EOF update delete ${UPDATEDNSNAME}. update add ${UPDATEDNSNAME}. $UPDATEDNSTTL IN A $IPADDR send EOF fi |