The branch, master has been updated via 192f300 wintest: fixed cleanup of /etc/resolv.conf via 1252d6b wintest: remove reliance on hostname in /etc/hosts via f207cc1 wintest: fixed interface handling and DNS forwarding from b1dacb8 Add in fsp->access_mask checks. Not required (underlying system does this) but makes logic cleaner. Pointed out by Metze.
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master - Log ----------------------------------------------------------------- commit 192f3001aea604f42e1f316b66b75b9bc782c277 Author: Andrew Tridgell <tri...@samba.org> Date: Wed Nov 24 16:42:43 2010 +1100 wintest: fixed cleanup of /etc/resolv.conf Autobuild-User: Andrew Tridgell <tri...@samba.org> Autobuild-Date: Wed Nov 24 07:29:49 CET 2010 on sn-devel-104 commit 1252d6bdf4b213dec432dbe1a9e3dd45d8e95c76 Author: Andrew Tridgell <tri...@samba.org> Date: Wed Nov 24 14:16:35 2010 +1100 wintest: remove reliance on hostname in /etc/hosts - don't setwinvars() in test code - use fully qualified names where possible - don't delete named and rndc config commit f207cc185f228490860151a35e2b94066120f335 Author: Andrew Tridgell <tri...@samba.org> Date: Wed Nov 24 13:36:21 2010 +1100 wintest: fixed interface handling and DNS forwarding - allow for _IP vars on VMs - resolve IPs using nmblookup - forward DNS requests for windows domains ----------------------------------------------------------------------- Summary of changes: wintest/conf/abartlet.conf | 2 +- wintest/conf/tridge.conf | 5 +- wintest/test-s4-howto.py | 206 ++++++++++++++++++++++++-------------------- wintest/wintest.py | 43 ++++++++- 4 files changed, 155 insertions(+), 101 deletions(-) Changeset truncated at 500 lines: diff --git a/wintest/conf/abartlet.conf b/wintest/conf/abartlet.conf index fb0a590..b632c6e 100644 --- a/wintest/conf/abartlet.conf +++ b/wintest/conf/abartlet.conf @@ -19,7 +19,7 @@ INTERFACE : virbr0:0 # this is an additional IP that will be used for named to listen # on. It should not be the primary IP of the interface INTERFACE_IP : 192.168.122.2 -INTERFACE_NET : 192.168.122.0/24 +INTERFACE_NET : 192.168.122.2/24 # how to run bind9 BIND9 : /usr/sbin/named diff --git a/wintest/conf/tridge.conf b/wintest/conf/tridge.conf index f5081ed..1c7ed0b 100644 --- a/wintest/conf/tridge.conf +++ b/wintest/conf/tridge.conf @@ -19,7 +19,7 @@ INTERFACE : virbr0:0 # this is an additional IP that will be used for named to listen # on. It should not be the primary IP of the interface INTERFACE_IP : 10.0.0.2 -INTERFACE_NET : 10.0.0.0/24 +INTERFACE_NET : 10.0.0.2/24 # how to run bind9 BIND9 : /usr/sbin/named @@ -57,6 +57,8 @@ W2K8R2A_REALM : v2.tridgell.net W2K8R2A_DOMAIN : v2 W2K8R2A_PASS : p...@ssw0rd5 W2K8R2A_SNAPSHOT : howto-test +W2K8R2A_IP : 10.0.0.4 + # this w2k8r2 VM will become a DC in the samba domain W2K8R2B_HOSTNAME : w2k8r2b @@ -78,6 +80,7 @@ W2K3A_REALM : vsofs3.com W2K3A_DOMAIN : vsofs3 W2K3A_PASS : penguin W2K3A_SNAPSHOT : howto-test +W2K3A_IP : 10.0.0.3 # this w2k3 VM will become a DC in the samba domain W2K3B_HOSTNAME : w2k3b diff --git a/wintest/test-s4-howto.py b/wintest/test-s4-howto.py index ec96581..67c98e9 100755 --- a/wintest/test-s4-howto.py +++ b/wintest/test-s4-howto.py @@ -12,7 +12,7 @@ def check_prerequesites(t): if os.getuid() != 0: raise Exception("You must run this script as root") t.putenv("KRB5_CONFIG", '${PREFIX}/private/krb5.conf') - t.run_cmd('ifconfig ${INTERFACE} ${INTERFACE_IP} up') + t.run_cmd('ifconfig ${INTERFACE} ${INTERFACE_NET} up') def build_s4(t): @@ -26,29 +26,28 @@ def build_s4(t): t.run_cmd('make -j install') -def provision_s4(t, func_level="2008", interface=None): +def provision_s4(t, func_level="2008"): '''provision s4 as a DC''' t.info('Provisioning s4') t.chdir('${PREFIX}') - t.del_files(["var", "etc", "private"]) + t.del_files(["var", "private"]) + t.run_cmd("rm -f etc/smb.conf") options=' --function-level=%s -d${DEBUGLEVEL}' % func_level - if interface: - options += ' --option=interfaces=%s' % interface - options += ' --host-ip=%s' % interface + options += ' --option=interfaces=${INTERFACE}' + options += ' --host-ip=${INTERFACE_IP} --host-ip6="::"' t.run_cmd('sbin/provision --realm=${LCREALM} --domain=${DOMAIN} --adminpass=${PASSWORD1} --server-role="domain controller"' + options) t.run_cmd('bin/samba-tool newuser testallowed ${PASSWORD1}') t.run_cmd('bin/samba-tool newuser testdenied ${PASSWORD1}') t.run_cmd('bin/samba-tool group addmembers "Allowed RODC Password Replication Group" testallowed') -def start_s4(t, interface=None): +def start_s4(t): '''startup samba4''' t.info('Starting Samba4') t.chdir("${PREFIX}") t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False) t.run_cmd(['sbin/samba', - '--option', 'panic action=gnome-terminal -e "gdb --pid %PID%"', - '--option', 'interfaces=%s' % interface]) + '--option', 'panic action=gnome-terminal -e "gdb --pid %PID%"']) t.port_wait("localhost", 139) @@ -87,6 +86,32 @@ def create_shares(t): t.run_cmd("mkdir -p var/profiles") +def set_nameserver(t, nameserver): + '''set the nameserver in resolv.conf''' + if not getattr(t, 'resolv_conf_backup', False): + t.run_cmd("mv -f /etc/resolv.conf /etc/resolv.conf.wintest-bak") + t.write_file("/etc/resolv.conf", ''' +# Generated by wintest, the Samba v Windows automated testing system +nameserver %s + +# your original resolv.conf appears below: + +''' % t.substitute(nameserver)) + t.run_cmd('cat /etc/resolv.conf.wintest-bak >> /etc/resolv.conf') + t.resolv_conf_backup = '/etc/resolv.conf.wintest-bak'; + + +def restore_resolv_conf(t): + '''restore the /etc/resolv.conf after testing is complete''' + if getattr(t, 'resolv_conf_backup', False): + t.info("restoring /etc/resolv.conf") + t.run_cmd("mv -f %s /etc/resolv.conf" % t.resolv_conf_backup) + +def rndc_cmd(t, cmd, checkfail=True): + '''run a rndc command''' + t.run_cmd("${RNDC} -c ${PREFIX}/etc/rndc.conf %s" % cmd, checkfail=checkfail) + + def restart_bind(t): '''restart the test environment version of bind''' t.info("Restarting bind9") @@ -127,13 +152,29 @@ key "rndc-key" { }; controls { - inet ${INTERFACE_IP} + inet ${INTERFACE_IP} port 953 allow { 127.0.0.0/8; ${INTERFACE_NET}; } keys { "rndc-key"; }; }; include "${PREFIX}/private/named.conf"; ''') + # add forwarding for the windows domains + domains = t.get_domains() + for d in domains: + t.write_file('etc/named.conf', + ''' +zone "%s" IN { + type forward; + forward only; + forwarders { + %s; + }; +}; +''' % (d, domains[d]), + mode='a') + + t.write_file("etc/rndc.conf", ''' # Start of rndc.conf key "rndc-key" { @@ -148,34 +189,14 @@ options { }; ''') - t.run_cmd("${RNDC} -c ${PREFIX}/etc/rndc.conf stop", checkfail=False) + set_nameserver(t, t.getvar('INTERFACE_IP')) + + rndc_cmd(t, "stop", checkfail=False) t.port_wait("${INTERFACE_IP}", 53, wait_for_fail=True) t.bind_child = t.run_child("${BIND9} -u ${BIND_USER} -n 1 -c ${PREFIX}/etc/named.conf -g") - t.run_cmd("mv -f /etc/resolv.conf /etc/resolv.conf.wintest-bak") - t.write_file("/etc/resolv.conf", ''' -# Generated by wintest, the Samba v Windows automated testing system - -nameserver ${INTERFACE_IP} - -# your original resolv.conf appears below: - -''') - - t.run_cmd('cat /etc/resolv.conf.wintest-bak >> /etc/resolv.conf') - - t.resolv_conf_backup = '/etc/resolv.conf.wintest-bak'; - t.port_wait("${INTERFACE_IP}", 53) - t.run_cmd("${RNDC} -c ${PREFIX}/etc/rndc.conf flush") - t.run_cmd("${RNDC} -c ${PREFIX}/etc/rndc.conf freeze") - t.run_cmd("${RNDC} -c ${PREFIX}/etc/rndc.conf thaw") - - -def restore_resolv_conf(t): - '''restore the /etc/resolv.conf after testing is complete''' - if getattr(t, 'resolv_conf_backup', False): - t.run_cmd("mv -f %s /etc/resolv.conf" % t.resolv_conf_backup) + rndc_cmd(t, "flush") def test_dns(t): @@ -200,7 +221,7 @@ def test_dyndns(t): '''test that dynamic DNS is working''' t.chdir('${PREFIX}') t.run_cmd("sbin/samba_dnsupdate --fail-immediately") - t.run_cmd("${RNDC} -c ${PREFIX}/etc/rndc.conf flush") + rndc_cmd(t, "flush") def run_winjoin(t, vm): @@ -210,24 +231,22 @@ def run_winjoin(t, vm): t.info("Joining a windows box to the domain") t.vm_poweroff("${WIN_VM}", checkfail=False) t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}") - t.ping_wait("${WIN_HOSTNAME}") child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_USER}", "${WIN_PASS}", set_time=True, set_ip=True) child.sendline("netdom join ${WIN_HOSTNAME} /Domain:${LCREALM} /PasswordD:${PASSWORD1} /UserD:administrator") child.expect("The command completed successfully") child.expect("C:") child.sendline("shutdown /r -t 0") - t.port_wait("${WIN_HOSTNAME}", 139, wait_for_fail=True) - t.port_wait("${WIN_HOSTNAME}", 139) + t.port_wait("${WIN_IP}", 139, wait_for_fail=True) + t.port_wait("${WIN_IP}", 139) child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_USER}", "${WIN_PASS}", set_time=True, set_ip=True) child.sendline("ipconfig /registerdns") child.expect("Registration of the DNS resource records for all adapters of this computer has been initiated. Any errors will be reported in the Event Viewer") child.expect("C:") def test_winjoin(t, vm): - t.setwinvars(vm) t.info("Checking the windows join is OK") t.chdir('${PREFIX}') - t.port_wait("${WIN_HOSTNAME}", 139) + t.port_wait("${WIN_IP}", 139) t.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -uadministra...@${lcrealm}%${password1}', ["C$", "IPC$", "Sharename"], retries=100) t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address']) t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -utestallo...@${lcrealm}%${password1}', ["C$", "IPC$", "Sharename"]) @@ -246,7 +265,6 @@ def run_dcpromo(t, vm): t.info("Joining a windows VM ${WIN_VM} to the domain as a DC using dcpromo") t.vm_poweroff("${WIN_VM}", checkfail=False) t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}") - t.ping_wait("${WIN_HOSTNAME}") child = t.open_telnet("${WIN_HOSTNAME}", "administrator", "${WIN_PASS}", set_ip=True) child.sendline("copy /Y con answers.txt") child.sendline(''' @@ -275,27 +293,26 @@ SafeModeAdminPassword=${PASSWORD1} i = child.expect(["You must restart this computer", "failed", "Active Directory Domain Services was not installed", "C:"], timeout=120) if i == 1 or i == 2: raise Exception("dcpromo failed") - t.port_wait("${WIN_HOSTNAME}", 139, wait_for_fail=True) - t.port_wait("${WIN_HOSTNAME}", 139) + t.port_wait("${WIN_IP}", 139, wait_for_fail=True) + t.port_wait("${WIN_IP}", 139) def test_dcpromo(t, vm): '''test that dcpromo worked''' - t.setwinvars(vm) t.info("Checking the dcpromo join is OK") t.chdir('${PREFIX}') - t.port_wait("${WIN_HOSTNAME}", 139) + t.port_wait("${WIN_IP}", 139) t.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -uadministra...@${lcrealm}%${password1}', ["C$", "IPC$", "Sharename"]) t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address']) t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -utestallo...@${lcrealm}%${password1}', ["C$", "IPC$", "Sharename"]) t.cmd_contains("bin/samba-tool drs kcc ${HOSTNAME} -uadministra...@${lcrealm}%${password1}", ['Consistency check', 'successful']) - t.cmd_contains("bin/samba-tool drs kcc ${WIN_HOSTNAME} -uadministra...@${lcrealm}%${password1}", ['Consistency check', 'successful']) + t.cmd_contains("bin/samba-tool drs kcc ${WIN_HOSTNAME}.${LCREALM} -uadministra...@${lcrealm}%${password1}", ['Consistency check', 'successful']) t.kinit("administra...@${realm}", "${PASSWORD1}") for nc in [ '${BASEDN}', 'CN=Configuration,${BASEDN}', 'CN=Schema,CN=Configuration,${BASEDN}' ]: - t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME} ${WIN_HOSTNAME} %s -k yes" % nc, ["was successful"]) - t.cmd_contains("bin/samba-tool drs replicate ${WIN_HOSTNAME} ${HOSTNAME} %s -k yes" % nc, ["was successful"]) + t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME} ${WIN_HOSTNAME}.${LCREALM} %s -k yes" % nc, ["was successful"]) + t.cmd_contains("bin/samba-tool drs replicate ${WIN_HOSTNAME}.${LCREALM} ${HOSTNAME} %s -k yes" % nc, ["was successful"]) t.cmd_contains("bin/samba-tool drs showrepl ${HOSTNAME} -k yes", [ "INBOUND NEIGHBORS", @@ -315,7 +332,7 @@ def test_dcpromo(t, vm): ordered=True, regex=True) - t.cmd_contains("bin/samba-tool drs showrepl ${WIN_HOSTNAME} -k yes", + t.cmd_contains("bin/samba-tool drs showrepl ${WIN_HOSTNAME}.${LCREALM} -k yes", [ "INBOUND NEIGHBORS", "${BASEDN}", "Last attempt .* was successful", @@ -350,8 +367,8 @@ def test_dcpromo(t, vm): t.info("Checking if new users propogate to windows") t.run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}') - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC']) - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC']) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC']) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC']) t.info("Checking if new users on windows propogate to samba") child.sendline("net user test3 ${PASSWORD3} /add") @@ -370,9 +387,9 @@ def test_dcpromo(t, vm): child.sendline("net user test3 /del") child.expect("The command completed successfully") - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE']) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE']) t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['LOGON_FAILURE']) - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE']) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE']) t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['LOGON_FAILURE']) t.vm_poweroff("${WIN_VM}") @@ -383,7 +400,6 @@ def run_dcpromo_rodc(t, vm): t.info("Joining a w2k8 box to the domain as a RODC") t.vm_poweroff("${WIN_VM}", checkfail=False) t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}") - t.ping_wait("${WIN_HOSTNAME}") child = t.open_telnet("${WIN_HOSTNAME}", "administrator", "${WIN_PASS}", set_ip=True) child.sendline("copy /Y con answers.txt") child.sendline(''' @@ -417,17 +433,16 @@ RebootOnCompletion=No if i != 0: raise Exception("dcpromo failed") child.sendline("shutdown -r -t 0") - t.port_wait("${WIN_HOSTNAME}", 139, wait_for_fail=True) - t.port_wait("${WIN_HOSTNAME}", 139) + t.port_wait("${WIN_IP}", 139, wait_for_fail=True) + t.port_wait("${WIN_IP}", 139) def test_dcpromo_rodc(t, vm): '''test the RODC dcpromo worked''' - t.setwinvars(vm) t.info("Checking the w2k8 RODC join is OK") t.chdir('${PREFIX}') - t.port_wait("${WIN_HOSTNAME}", 139) + t.port_wait("${WIN_IP}", 139) t.retry_cmd('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -uadministra...@${lcrealm}%${password1}', ["C$", "IPC$", "Sharename"]) t.cmd_contains("host -t A ${WIN_HOSTNAME}.${LCREALM}.", ['has address']) t.cmd_contains('bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -utestallo...@${lcrealm}%${password1}', ["C$", "IPC$", "Sharename"]) @@ -446,13 +461,13 @@ def test_dcpromo_rodc(t, vm): t.info("Checking if new users are available on windows") t.run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}') - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC']) - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE']) - t.retry_cmd("bin/samba-tool drs replicate ${WIN_HOSTNAME} ${HOSTNAME} ${BASEDN} -k yes", ["was successful"]) - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC']) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC']) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE']) + t.retry_cmd("bin/samba-tool drs replicate ${WIN_HOSTNAME}.${LCREALM} ${HOSTNAME} ${BASEDN} -k yes", ["was successful"]) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC']) t.run_cmd('bin/samba-tool user delete test2 -uadministra...@${lcrealm}%${password1}') - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE']) - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE']) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE']) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${LCREALM} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE']) t.vm_poweroff("${WIN_VM}") @@ -464,17 +479,17 @@ def join_as_dc(t, vm): t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False) t.vm_poweroff("${WIN_VM}", checkfail=False) t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}") - t.run_cmd('${RNDC} -c ${PREFIX}/etc/rndc.conf flush') - t.run_cmd("rm -rf etc private") - t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True, set_ip=True) - t.retry_cmd("bin/samba-tool drs showrepl ${WIN_HOSTNAME} -Uadministrator%${WIN_PASS}", ['INBOUND NEIGHBORS'] ) - t.run_cmd('bin/samba-tool join ${WIN_REALM} DC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL}') - t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME} -uadministra...@${win_realm}%${win_pass}') + rndc_cmd(t, 'flush') + t.run_cmd("rm -rf etc/smb.conf private") + child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True) + t.get_ipconfig(child) + t.retry_cmd("bin/samba-tool drs showrepl ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator%${WIN_PASS}", ['INBOUND NEIGHBORS'] ) + t.run_cmd('bin/samba-tool join ${WIN_REALM} DC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL} --option=interfaces=${INTERFACE}') + t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME}.${WIN_REALM} -uadministra...@${win_realm}%${win_pass}') def test_join_as_dc(t, vm): '''test the join of a windows domain as a DC''' - t.setwinvars(vm) t.info("Checking the DC join is OK") t.chdir('${PREFIX}') t.retry_cmd('bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -uadministra...@${win_realm}%${win_pass}', ["C$", "IPC$", "Sharename"]) @@ -482,13 +497,13 @@ def test_join_as_dc(t, vm): child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True) t.info("Forcing kcc runs, and replication") - t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME} -uadministra...@${win_realm}%${win_pass}') + t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME}.${WIN_REALM} -uadministra...@${win_realm}%${win_pass}') t.run_cmd('bin/samba-tool drs kcc ${HOSTNAME} -uadministra...@${win_realm}%${win_pass}') t.kinit("administra...@${win_realm}", "${WIN_PASS}") for nc in [ '${WIN_BASEDN}', 'CN=Configuration,${WIN_BASEDN}', 'CN=Schema,CN=Configuration,${WIN_BASEDN}' ]: - t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME} ${WIN_HOSTNAME} %s -k yes" % nc, ["was successful"]) - t.cmd_contains("bin/samba-tool drs replicate ${WIN_HOSTNAME} ${HOSTNAME} %s -k yes" % nc, ["was successful"]) + t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME} ${WIN_HOSTNAME}.${WIN_REALM} %s -k yes" % nc, ["was successful"]) + t.cmd_contains("bin/samba-tool drs replicate ${WIN_HOSTNAME}.${WIN_REALM} ${HOSTNAME} %s -k yes" % nc, ["was successful"]) child.sendline("net use t: \\\\${HOSTNAME}.${WIN_REALM}\\test") child.expect("The command completed successfully") @@ -504,8 +519,8 @@ def test_join_as_dc(t, vm): t.info("Checking if new users propogate to windows") t.run_cmd('bin/samba-tool newuser test2 ${PASSWORD2}') - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC']) - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC']) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%${PASSWORD2} -k no", ['Sharename', 'Remote IPC']) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%${PASSWORD2} -k yes", ['Sharename', 'Remote IPC']) t.info("Checking if new users on windows propogate to samba") child.sendline("net user test3 ${PASSWORD3} /add") @@ -518,9 +533,9 @@ def test_join_as_dc(t, vm): child.sendline("net user test3 /del") child.expect("The command completed successfully") - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE']) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%${PASSWORD2} -k no", ['LOGON_FAILURE']) t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['LOGON_FAILURE']) - t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE']) + t.retry_cmd("bin/smbclient -L ${WIN_HOSTNAME}.${WIN_REALM} -Utest2%${PASSWORD2} -k yes", ['LOGON_FAILURE']) t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['LOGON_FAILURE']) t.vm_poweroff("${WIN_VM}") @@ -533,17 +548,17 @@ def join_as_rodc(t, vm): t.run_cmd('killall -9 -q samba smbd nmbd winbindd', checkfail=False) t.vm_poweroff("${WIN_VM}", checkfail=False) t.vm_restore("${WIN_VM}", "${WIN_SNAPSHOT}") - t.run_cmd('${RNDC} -c ${PREFIX}/etc/rndc.conf flush') - t.run_cmd("rm -rf etc private") - t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True, set_ip=True) - t.retry_cmd("bin/samba-tool drs showrepl ${WIN_HOSTNAME} -Uadministrator%${WIN_PASS}", ['INBOUND NEIGHBORS'] ) - t.run_cmd('bin/samba-tool join ${WIN_REALM} RODC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL}') - t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME} -uadministra...@${win_realm}%${win_pass}') + rndc_cmd(t, 'flush') + t.run_cmd("rm -rf etc/smb.conf private") + child = t.open_telnet("${WIN_HOSTNAME}", "${WIN_DOMAIN}\\administrator", "${WIN_PASS}", set_time=True) + t.get_ipconfig(child) + t.retry_cmd("bin/samba-tool drs showrepl ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator%${WIN_PASS}", ['INBOUND NEIGHBORS'] ) + t.run_cmd('bin/samba-tool join ${WIN_REALM} RODC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL} --option=interfaces=${INTERFACE}') + t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME}.${WIN_REALM} -uadministra...@${win_realm}%${win_pass}') def test_join_as_rodc(t, vm): '''test a windows domain RODC join''' - t.setwinvars(vm) t.info("Checking the RODC join is OK") t.chdir('${PREFIX}') t.retry_cmd('bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -uadministra...@${win_realm}%${win_pass}', ["C$", "IPC$", "Sharename"]) @@ -552,11 +567,11 @@ def test_join_as_rodc(t, vm): t.info("Forcing kcc runs, and replication") t.run_cmd('bin/samba-tool drs kcc ${HOSTNAME} -uadministra...@${win_realm}%${win_pass}') - t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME} -uadministra...@${win_realm}%${win_pass}') + t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME}.${WIN_REALM} -uadministra...@${win_realm}%${win_pass}') t.kinit("administra...@${win_realm}", "${WIN_PASS}") for nc in [ '${WIN_BASEDN}', 'CN=Configuration,${WIN_BASEDN}', 'CN=Schema,CN=Configuration,${WIN_BASEDN}' ]: - t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME} ${WIN_HOSTNAME} %s -k yes" % nc, ["was successful"]) + t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME} ${WIN_HOSTNAME}.${WIN_REALM} %s -k yes" % nc, ["was successful"]) child.sendline("net use t: \\\\${HOSTNAME}.${WIN_REALM}\\test") child.expect("The command completed successfully") @@ -608,13 +623,13 @@ def test_howto(t): build_s4(t) if not t.skip("provision"): - provision_s4(t, interface='${INTERFACE_IP}') + provision_s4(t) if not t.skip("create-shares"): create_shares(t) if not t.skip("starts4"): - start_s4(t, interface='${INTERFACE_IP}') + start_s4(t) if not t.skip("smbclient"): test_smbclient(t) if not t.skip("startbind"): @@ -652,9 +667,9 @@ def test_howto(t): if t.have_var('W2K3B_VM') and not t.skip("dcpromo_w2k3"): t.info("Testing w2k3 dcpromo") t.info("Changing to 2003 functional level") - provision_s4(t, func_level='2003', interfaces='${INTERFACES}') + provision_s4(t, func_level='2003') create_shares(t) - start_s4(t, interfaces='${INTERFACES}') + start_s4(t) test_smbclient(t) restart_bind(t) test_dns(t) @@ -666,21 +681,21 @@ def test_howto(t): if t.have_var('W2K8R2A_VM') and not t.skip("join_w2k8r2"): join_as_dc(t, "W2K8R2A") create_shares(t) - start_s4(t, interfaces='${INTERFACES}') + start_s4(t) test_dyndns(t) test_join_as_dc(t, "W2K8R2A") if t.have_var('W2K8R2A_VM') and not t.skip("join_rodc"): join_as_rodc(t, "W2K8R2A") create_shares(t) -- Samba Shared Repository