diff options
author | Andrew Tridgell <tridge@samba.org> | 2009-09-07 10:55:32 +1000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 2009-09-07 10:55:32 +1000 |
commit | a9595976370251a445919a235901c9058bc683ff (patch) | |
tree | a64f69ba88aed05ef00bac86355d75d90a65d661 /source4/scripting/bin/setup_dns.sh | |
parent | 86f3a2ea0984e0a28fab2228ff7bd4f97543d098 (diff) | |
download | samba-a9595976370251a445919a235901c9058bc683ff.tar.gz samba-a9595976370251a445919a235901c9058bc683ff.tar.bz2 samba-a9595976370251a445919a235901c9058bc683ff.zip |
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
Diffstat (limited to 'source4/scripting/bin/setup_dns.sh')
-rwxr-xr-x | source4/scripting/bin/setup_dns.sh | 29 |
1 files changed, 29 insertions, 0 deletions
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 |