1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-28 07:21:54 +03:00
samba-mirror/source4/scripting/devel/drs/revampire_ad.sh
Andrew Bartlett 40b09f689b s4:drs-development Scripts to assist testing of DRS replication with AD
These scripts, originally by tridge, allow developers to easily
reproduce the same domain join senerio time after time.

They need documentation, and the template named.conf and zone files
for hosting an AD domain are not provided.  However, I hope to have
the provision script provide these shortly.

They assume a local 'bind' set up to read PREFIX/private/named.conf
(as per the provision instructions).

Ensure you edit the 'vars' file to match your local setup.

Andrew Bartlett
2009-10-06 11:10:33 +11:00

24 lines
810 B
Bash
Executable File

#!/bin/bash
set -x
. `dirname $0`/vars
`dirname $0`/vampire_ad.sh || exit 1
ntds_guid=$(sudo bin/ldbsearch -H $PREFIX/private/sam.ldb -b "CN=NTDS Settings,CN=$machine,CN=Servers,CN=Default-First-Site-Name,CN=Sites,CN=Configuration,$dn" objectGUID|grep ^objectGUID| awk '{print $2}')
cp $PREFIX/private/$DNSDOMAIN.zone{.template,}
sed -i "s/NTDSGUID/$ntds_guid/g" $PREFIX/private/$DNSDOMAIN.zone
cp $PREFIX/private/named.conf{.local,}
sudo rndc reconfig
fsmotmp=`mktemp fsmo.ldif.XXXXXXXXX`
cp `dirname $0`/fsmo.ldif.template $fsmotmp
sed -i "s/NTDSGUID/$ntds_guid/g" $fsmotmp
sed -i "s/MACHINE/$machine/g" $fsmotmp
sed -i "s/DNSDOMAIN/$DNSDOMAIN/g" $fsmotmp
sed -i "s/BASEDN/$dn/g" $fsmotmp
sed -i "s/NETBIOSDOMAIN/$workgroup/g" $fsmotmp
sudo bin/ldbmodify -H $PREFIX/private/sam.ldb $fsmotmp
rm $fsmotmp