summaryrefslogtreecommitdiff
path: root/wintest/test-s4-howto.py
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2010-11-24 17:48:39 +1100
committerAndrew Tridgell <tridge@samba.org>2010-11-24 11:34:30 +0100
commitea1889d4b58e80c12de87f3987da49e4da1e9717 (patch)
treee212e9438c5a100bdcbb3727a8029ebe96138b84 /wintest/test-s4-howto.py
parent6ead7fbae534b7cc25310d8ea2875fc2e737a2b7 (diff)
downloadsamba-ea1889d4b58e80c12de87f3987da49e4da1e9717.tar.gz
samba-ea1889d4b58e80c12de87f3987da49e4da1e9717.tar.bz2
samba-ea1889d4b58e80c12de87f3987da49e4da1e9717.zip
wintest: added an IPv6 address, and use fully qualified hostname
this also makes the resolv.conf handling more robust Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Wed Nov 24 11:34:30 CET 2010 on sn-devel-104
Diffstat (limited to 'wintest/test-s4-howto.py')
-rwxr-xr-xwintest/test-s4-howto.py64
1 files changed, 37 insertions, 27 deletions
diff --git a/wintest/test-s4-howto.py b/wintest/test-s4-howto.py
index ef4f75d761..d12968c50f 100755
--- a/wintest/test-s4-howto.py
+++ b/wintest/test-s4-howto.py
@@ -4,7 +4,7 @@
import sys, os
import optparse
-import wintest
+import wintest, pexpect
def check_prerequesites(t):
t.info("Checking prerequesites")
@@ -13,6 +13,8 @@ def check_prerequesites(t):
raise Exception("You must run this script as root")
t.putenv("KRB5_CONFIG", '${PREFIX}/private/krb5.conf')
t.run_cmd('ifconfig ${INTERFACE} ${INTERFACE_NET} up')
+ t.run_cmd('ifconfig ${INTERFACE} inet6 del ${INTERFACE_IPV6}/64', checkfail=False)
+ t.run_cmd('ifconfig ${INTERFACE} inet6 add ${INTERFACE_IPV6}/64 up')
def build_s4(t):
@@ -33,8 +35,8 @@ def provision_s4(t, func_level="2008"):
t.del_files(["var", "private"])
t.run_cmd("rm -f etc/smb.conf")
options=' --function-level=%s -d${DEBUGLEVEL}' % func_level
- options += ' --option=interfaces=${INTERFACE}'
- options += ' --host-ip=${INTERFACE_IP} --host-ip6="::"'
+ options += ' --option=interfaces="${INTERFACE} ${INTERFACE_IPV6}"'
+ options += ' --host-ip=${INTERFACE_IP} --host-ip6=${INTERFACE_IPV6}'
options += ' --option=bindinterfacesonly=yes'
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}')
@@ -88,16 +90,21 @@ def create_shares(t):
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", '''
+ t.write_file("/etc/resolv.conf.wintest", '''
# 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')
+ child = t.pexpect_spawn("cat /etc/resolv.conf", crlf=False)
+ i = child.expect(['your original resolv.conf appears below:', pexpect.EOF])
+ if i == 0:
+ child.expect(pexpect.EOF)
+ contents = child.before.replace('\r', '')
+ t.write_file('/etc/resolv.conf.wintest', contents, mode='a')
+ t.write_file('/etc/resolv.conf.wintest-bak', contents)
+ t.run_cmd("mv -f /etc/resolv.conf.wintest /etc/resolv.conf")
t.resolv_conf_backup = '/etc/resolv.conf.wintest-bak';
@@ -123,21 +130,24 @@ def restart_bind(t):
nameserver = t.get_nameserver()
if nameserver == t.getvar('INTERFACE_IP'):
- raise RuntimeError("old /etc/resolv.conf must not contain %s as a nameserver, this will create loops with the generated dns configuration")
+ raise RuntimeError("old /etc/resolv.conf must not contain %s as a nameserver, this will create loops with the generated dns configuration" % nameserver)
t.setvar('DNSSERVER', nameserver)
t.write_file("etc/named.conf", '''
options {
- listen-on port 53 { ${INTERFACE_IP}; };
+ listen-on port 53 { ${INTERFACE_IP}; };
+ listen-on-v6 port 53 { ${INTERFACE_IPV6}; };
directory "${PREFIX}/var/named";
dump-file "${PREFIX}/var/named/data/cache_dump.db";
pid-file "${PREFIX}/var/named/named.pid";
statistics-file "${PREFIX}/var/named/data/named_stats.txt";
memstatistics-file "${PREFIX}/var/named/data/named_mem_stats.txt";
- allow-query { ${INTERFACE_NET}; 127.0.0.0/8; };
+ allow-query { any; };
recursion yes;
- tkey-gssapi-credential "DNS/${LCREALM}";
+ tkey-gssapi-credential "DNS/${HOSTNAME}.${LCREALM}";
tkey-domain "${REALM}";
+ max-cache-ttl 10;
+ max-ncache-ttl 10;
forward only;
forwarders {
@@ -153,7 +163,7 @@ key "rndc-key" {
controls {
inet ${INTERFACE_IP} port 953
- allow { 127.0.0.0/8; ${INTERFACE_NET}; } keys { "rndc-key"; };
+ allow { any; } keys { "rndc-key"; };
};
include "${PREFIX}/private/named.conf";
@@ -484,7 +494,7 @@ def join_as_dc(t, vm):
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 join ${WIN_REALM} DC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL} --option=interfaces="${INTERFACE} ${INTERFACE_IPV6"')
t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
@@ -498,12 +508,12 @@ def test_join_as_dc(t, vm):
t.info("Forcing kcc runs, and replication")
t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
- t.run_cmd('bin/samba-tool drs kcc ${HOSTNAME} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
+ t.run_cmd('bin/samba-tool drs kcc ${HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
t.kinit("administrator@${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}.${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"])
+ t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME}.${WIN_REALM} ${WIN_HOSTNAME}.${WIN_REALM} %s -k yes" % nc, ["was successful"])
+ t.cmd_contains("bin/samba-tool drs replicate ${WIN_HOSTNAME}.${WIN_REALM} ${HOSTNAME}.${WIN_REALM} %s -k yes" % nc, ["was successful"])
child.sendline("net use t: \\\\${HOSTNAME}.${WIN_REALM}\\test")
child.expect("The command completed successfully")
@@ -525,8 +535,8 @@ def test_join_as_dc(t, vm):
t.info("Checking if new users on windows propogate to samba")
child.sendline("net user test3 ${PASSWORD3} /add")
child.expect("The command completed successfully")
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['Sharename', 'IPC'])
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['Sharename', 'IPC'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k no", ['Sharename', 'IPC'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k yes", ['Sharename', 'IPC'])
t.info("Checking propogation of user deletion")
t.run_cmd('bin/samba-tool user delete test2 -Uadministrator@${WIN_REALM}%${WIN_PASS}')
@@ -534,9 +544,9 @@ def test_join_as_dc(t, vm):
child.expect("The command completed successfully")
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 ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k no", ['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.retry_cmd("bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k yes", ['LOGON_FAILURE'])
t.vm_poweroff("${WIN_VM}")
@@ -553,7 +563,7 @@ def join_as_rodc(t, vm):
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 join ${WIN_REALM} RODC -Uadministrator%${WIN_PASS} -d${DEBUGLEVEL} --option=interfaces="${INTERFACE} ${INTERFACE_IPV6}"')
t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
@@ -566,12 +576,12 @@ def test_join_as_rodc(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 ${HOSTNAME} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
+ t.run_cmd('bin/samba-tool drs kcc ${HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
t.run_cmd('bin/samba-tool drs kcc ${WIN_HOSTNAME}.${WIN_REALM} -Uadministrator@${WIN_REALM}%${WIN_PASS}')
t.kinit("administrator@${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}.${WIN_REALM} %s -k yes" % nc, ["was successful"])
+ t.cmd_contains("bin/samba-tool drs replicate ${HOSTNAME}.${WIN_REALM} ${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")
@@ -595,8 +605,8 @@ def test_join_as_rodc(t, vm):
t.info("Checking if new users on windows propogate to samba")
child.sendline("net user test3 ${PASSWORD3} /add")
child.expect("The command completed successfully")
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['Sharename', 'IPC'])
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['Sharename', 'IPC'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k no", ['Sharename', 'IPC'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k yes", ['Sharename', 'IPC'])
# should this work?
t.info("Checking if new users propogate to windows")
@@ -606,8 +616,8 @@ def test_join_as_rodc(t, vm):
child.sendline("net user test3 /del")
child.expect("The command completed successfully")
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k no", ['LOGON_FAILURE'])
- t.retry_cmd("bin/smbclient -L ${HOSTNAME} -Utest3%${PASSWORD3} -k yes", ['LOGON_FAILURE'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k no", ['LOGON_FAILURE'])
+ t.retry_cmd("bin/smbclient -L ${HOSTNAME}.${WIN_REALM} -Utest3%${PASSWORD3} -k yes", ['LOGON_FAILURE'])
t.vm_poweroff("${WIN_VM}")