From: Pavel Filipenský Date: Mon, 15 Jul 2024 15:07:59 +0000 (+0200) Subject: selftest: Add tests for keytab update in clustered samba X-Git-Tag: tdb-1.4.11~11 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6a97f8e16d888ac16069dcccccb81541520f6e5e;p=thirdparty%2Fsamba.git selftest: Add tests for keytab update in clustered samba BUG: https://bugzilla.samba.org/show_bug.cgi?id=6750 Signed-off-by: Pavel Filipenský Reviewed-by: Stefan Metzmacher --- diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 77ad661189c..8d7f690ecf6 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -551,6 +551,7 @@ sub setup_clusteredmember include = registry dbwrap_tdb_mutexes:* = yes ${require_mutexes} + sync machine password to keytab = $node_prefix/keytab0:account_name:machine_password:sync_kvno "; my $node_ret = $self->provision( diff --git a/source3/script/tests/test_update_keytab_clustered.sh b/source3/script/tests/test_update_keytab_clustered.sh new file mode 100755 index 00000000000..a0016139db5 --- /dev/null +++ b/source3/script/tests/test_update_keytab_clustered.sh @@ -0,0 +1,165 @@ +#!/bin/sh + +if [ $# -lt 1 ]; then +cat <$global_inject_conf +UID_WRAPPER_ROOT=1 $smbcontrol winbindd reload-config + +# To have both old and older password we do one unnecessary password change: +testit "wbinfo_change_secret_initial" \ + "$samba_wbinfo" --change-secret --domain="${DOMAIN}" \ + || failed=$((failed + 1)) + +testit "wbinfo_check_secret_initial" \ + "$samba_wbinfo" --check-secret --domain="${DOMAIN}" \ + || failed=$((failed + 1)) + +# Create/sync all keytabs +testit "net_ads_keytab_sync" test_keytab_create || failed=$((failed + 1)) + +testit "wbinfo_change_secret" \ + test_pwd_change "wbinfo_changesecret" \ + "$samba_wbinfo --change-secret --domain=${DOMAIN}" \ + || failed=$((failed + 1)) + +testit "wbinfo_check_secret" \ + "$samba_wbinfo" --check-secret --domain="${DOMAIN}" \ + || failed=$((failed + 1)) + +test_smbclient "Test machine login with the changed secret" \ + "ls" "${SMBCLIENT_UNC}" \ + --machine-pass || + failed=$((failed + 1)) + +echo "" >$global_inject_conf +UID_WRAPPER_ROOT=1 $smbcontrol winbindd reload-config + +testok "$0" "$failed" diff --git a/source3/script/updatekeytab_test.sh b/source3/script/updatekeytab_test.sh new file mode 100755 index 00000000000..19a197b501e --- /dev/null +++ b/source3/script/updatekeytab_test.sh @@ -0,0 +1,3 @@ +#!/bin/sh + + ./ctdb/tests/local_daemons.sh "$PREFIX_ABS/clusteredmember" onnode all 'net ads keytab create --option="sync machine password script=" --configfile=$CTDB_BASE/lib/server.conf' diff --git a/source3/selftest/tests.py b/source3/selftest/tests.py index 2474b36325f..2de6c8ecd45 100755 --- a/source3/selftest/tests.py +++ b/source3/selftest/tests.py @@ -679,6 +679,15 @@ plantestsuite( configuration, ], ) +plantestsuite( + "samba3.blackbox.update_keytab_clustered", + "clusteredmember:local", + [ + os.path.join(samba3srcdir, "script/tests/test_update_keytab_clustered.sh"), + "$DOMAIN", + configuration, + ], +) env = "ad_member" t = "--krb5auth=$DOMAIN/$DC_USERNAME%$DC_PASSWORD"