From a9595976370251a445919a235901c9058bc683ff Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Mon, 7 Sep 2009 10:55:32 +1000 Subject: s4: bring nsupdate-gss into the s4 tree This is a perl script that does TSIG-GSS DNS updates against a AD DC. The bind 9.5 nsupdate still doesn't seem to work with TSIG-GSS, and we need a way to do DNS updates when we vampire a domain, so I revived this ancient perl script and added a wrapper script that can update DNS entries using our machine account credentials --- source4/scripting/bin/setup_dns.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 source4/scripting/bin/setup_dns.sh (limited to 'source4/scripting/bin/setup_dns.sh') diff --git a/source4/scripting/bin/setup_dns.sh b/source4/scripting/bin/setup_dns.sh new file mode 100755 index 0000000000..20051c352e --- /dev/null +++ b/source4/scripting/bin/setup_dns.sh @@ -0,0 +1,29 @@ +#!/bin/bash +# example script to setup DNS for a vampired domain + +[ $# = 3 ] || { + echo "Usage: setup_dns.sh HOSTNAME DOMAIN IP" + exit 1 +} + +HOSTNAME="$1" +DOMAIN="$2" +IP="$3" + +RSUFFIX=$(echo $DOMAIN | sed s/[\.]/,DC=/g) + +PRIVATEDIR=$(bin/testparm --section-name=global --parameter-name='private dir' --suppress-prompt 2> /dev/null) + +OBJECTGUID=$(bin/ldbsearch -H "$PRIVATEDIR/sam.ldb" -b "CN=NTDS Settings,CN=$HOSTNAME,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,DC=$RSUFFIX" objectguid|grep ^objectGUID| cut -d: -f2) + +echo "Found objectGUID $OBJECTGUID" + +echo "Running kinit for BLU\$@VSOFS8.COM" +bin/samba4kinit -e arcfour-hmac-md5 -k -t "$PRIVATEDIR/secrets.keytab" BLU\$@VSOFS8.COM || exit 1 +echo "Adding $HOSTNAME.$DOMAIN" +scripting/bin/nsupdate-gss --noverify $HOSTNAME $DOMAIN $IP 300 || exit 1 +echo "Adding $OBJECTGUID.$DOMAIN => $HOSTNAME.$DOMAIN" +scripting/bin/nsupdate-gss --noverify --ntype="CNAME" $OBJECTGUID $DOMAIN $HOSTNAME.$DOMAIN 300 || exit 1 +echo "Checking" +host $HOSTNAME.$DOMAIN +host $OBJECTGUID.$DOMAIN -- cgit