diff options
author | Andrew Bartlett <abartlet@samba.org> | 2010-12-14 10:53:34 +1100 |
---|---|---|
committer | Andrew Bartlett <abartlet@samba.org> | 2010-12-14 01:54:46 +0100 |
commit | 6510414ef0e48aaea9918cce87c0850d8f74fccd (patch) | |
tree | 1331137bd2f870bc16f05dbadb13a7bf750d4ab4 /wintest/test-s3.py | |
parent | d97492e42a65540febae93dd0255b91d034f9def (diff) | |
download | samba-6510414ef0e48aaea9918cce87c0850d8f74fccd.tar.gz samba-6510414ef0e48aaea9918cce87c0850d8f74fccd.tar.bz2 samba-6510414ef0e48aaea9918cce87c0850d8f74fccd.zip |
wintest Add testing of kerberos connections to Windows members of an AD domain
This improves the Samba3 wintest script to test against Windows7 and
WinXP domain members, and Windows7 standalone servers. To do this,
more of the samba4 script is put in common, and we splut up the
starting of the VMs from the preperation of the VM.
This also improves the nmblookup command parsing to cope with both the
samba3 and samba4 nmblookup commands.
A krb5.conf is now provided for both s3 and s4 tests.
Andrew Bartlett
Autobuild-User: Andrew Bartlett <abartlet@samba.org>
Autobuild-Date: Tue Dec 14 01:54:46 CET 2010 on sn-devel-104
Diffstat (limited to 'wintest/test-s3.py')
-rwxr-xr-x | wintest/test-s3.py | 65 |
1 files changed, 63 insertions, 2 deletions
diff --git a/wintest/test-s3.py b/wintest/test-s3.py index 33f4acaf12..30027773b0 100755 --- a/wintest/test-s3.py +++ b/wintest/test-s3.py @@ -9,6 +9,15 @@ import wintest def set_libpath(t): t.putenv("LD_LIBRARY_PATH", "${PREFIX}/lib") +def set_krb5_conf(t): + t.run_cmd("mkdir -p ${PREFIX}/etc") + t.write_file("${PREFIX}/etc/krb5.conf", + '''[libdefaults] + dns_lookup_realm = false + dns_lookup_kdc = true''') + + t.putenv("KRB5_CONFIG", '${PREFIX}/etc/krb5.conf') + def build_s3(t): '''build samba3''' t.info('Building s3') @@ -31,7 +40,6 @@ def start_s3(t): t.run_cmd(['sbin/smbd', "-D"]) t.port_wait("${INTERFACE_IP}", 139) - def test_wbinfo(t): t.info('Testing wbinfo') t.chdir('${PREFIX}') @@ -69,7 +77,18 @@ def test_smbclient(t): t.cmd_contains("bin/smbclient --version", ["Version 3."]) t.cmd_contains('bin/smbclient -L ${INTERFACE_IP} -U%', ["Domain=[${WIN_DOMAIN}]", "test", "IPC$", "Samba 3."], casefold=True) - child = t.pexpect_spawn('bin/smbclient //${HOSTNAME}.${WIN_REALM}/test -Uroot%${PASSWORD2}') + child = t.pexpect_spawn('bin/smbclient //${HOSTNAME}.${WIN_REALM}/test -Uroot@${WIN_REALM}%${PASSWORD2}') + child.expect("smb:") + child.sendline("dir") + child.expect("blocks available") + child.sendline("mkdir testdir") + child.expect("smb:") + child.sendline("cd testdir") + child.expect('testdir') + child.sendline("cd ..") + child.sendline("rmdir testdir") + + child = t.pexpect_spawn('bin/smbclient //${HOSTNAME}.${WIN_REALM}/test -Uroot@${WIN_REALM}%${PASSWORD2} -k') child.expect("smb:") child.sendline("dir") child.expect("blocks available") @@ -160,6 +179,7 @@ def test_join_as_member(t, vm): def test_s3(t): '''basic s3 testing''' + t.setvar("SAMBA_VERSION", "Version 3") t.check_prerequesites() set_libpath(t) @@ -173,12 +193,16 @@ def test_s3(t): if not t.skip("build"): build_s3(t) + set_krb5_conf(t) if not t.skip("configure_bind2"): t.configure_bind() if not t.skip("start_bind"): t.start_bind() + dc_started = False if t.have_var('W2K8R2A_VM') and not t.skip("join_w2k8r2"): + t.start_winvm('W2K8R2A') + dc_started = True prep_join_as_member(t, "W2K8R2A") t.run_dcpromo_as_first_dc("W2K8R2A", func_level='2008r2') join_as_member(t, "W2K8R2A") @@ -186,6 +210,43 @@ def test_s3(t): start_s3(t) test_join_as_member(t, "W2K8R2A") + if t.have_var('WINDOWS7_VM') and t.have_var('W2K8R2A_VM') and not t.skip("join_windows7_2008r2"): + if not dc_started: + t.start_winvm('W2K8R2A') + t.run_dcpromo_as_first_dc("W2K8R2A", func_level='2008r2') + dc_started = True + else: + t.setwinvars('W2K8R2A') + realm = t.getvar("WIN_REALM") + dom_username = t.getvar("WIN_USER") + dom_password = t.getvar("WIN_PASS") + dom_realm = t.getvar("WIN_REALM") + t.start_winvm('WINDOWS7') + t.test_remote_smbclient("WINDOWS7") + t.run_winjoin('WINDOWS7', realm, username=dom_username, password=dom_password) + t.test_remote_smbclient("WINDOWS7", dom_username, dom_password) + t.test_remote_smbclient('WINDOWS7', dom_username, dom_password, args='--option=clientntlmv2auth=no') + t.test_remote_smbclient('WINDOWS7', "%s@%s" % (dom_username, dom_realm), dom_password, args="-k") + t.test_remote_smbclient('WINDOWS7', "%s@%s" % (dom_username, dom_realm), dom_password, args="-k --option=clientusespnegoprincipal=yes") + + if t.have_var('WINXP_VM') and t.have_var('W2K8R2A_VM') and not t.skip("join_winxp_2008r2"): + if not dc_started: + t.start_winvm('W2K8R2A') + t.run_dcpromo_as_first_dc("W2K8R2A", func_level='2008r2') + dc_started = True + else: + t.setwinvars('W2K8R2A') + realm = t.getvar("WIN_REALM") + dom_username = t.getvar("WIN_USER") + dom_password = t.getvar("WIN_PASS") + dom_realm = t.getvar("WIN_REALM") + t.start_winvm('WINXP') + t.run_winjoin('WINXP', realm, username=dom_username, password=dom_password) + t.test_remote_smbclient('WINXP', dom_username, dom_password) + t.test_remote_smbclient('WINXP', dom_username, dom_password, args='--option=clientntlmv2auth=no') + t.test_remote_smbclient('WINXP', "%s@%s" % (dom_username, dom_realm), dom_password, args="-k") + t.test_remote_smbclient('WINXP', "%s@%s" % (dom_username, dom_realm), dom_password, args="-k --clientusespnegoprincipal=yes") + t.info("S3 test: All OK") |