1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-05 09:18:06 +03:00
samba-mirror/testprogs/blackbox/test_weak_disable_ntlmssp_ldap.sh
Stefan Metzmacher bb8b7be74a s3:libads: let ads_sasl_spnego_bind() really use spnego to negotiate krb5/ntlmssp
For now we still do the ads_kinit_password() in ads_legacy_creds()
for callers that rely on the global krb5ccache to be filled.

E.g. the dns update code and the kpasswd code.

But at least ads_connect_internal() and ads_sasl_spnego_bind()
will allow to do the kinit in the gensec layer only if needed...

We'll remove ads_legacy_creds() during the following commits.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Andreas Schneider <asn@samba.org>
2024-05-14 10:18:31 +00:00

45 lines
1.4 KiB
Bash
Executable File

#!/bin/sh
# Blackbox tests for diabing NTLMSSP for ldap client connections
# Copyright (c) 2022 Pavel Filipenský <pfilipen@redhat.com>
if [ $# -lt 2 ]; then
cat <<EOF
Usage: $0 USERNAME PASSWORD
EOF
exit 1
fi
USERNAME=$1
PASSWORD=$2
shift 2
failed=0
. $(dirname $0)/subunit.sh
samba_testparm="$BINDIR/testparm"
samba_net="$BINDIR/net"
unset GNUTLS_FORCE_FIPS_MODE
# Checks that testparm reports: Weak crypto is allowed
testit_grep "testparm.with-weak" "Weak crypto is allowed" $samba_testparm --suppress-prompt $SMB_CONF_PATH 2>&1 || failed=$(expr $failed + 1)
# We should be allowed to use NTLM for connecting
testit "net_ads_search.ntlm.with-weak" $samba_net ads search --use-kerberos=off '(objectCategory=group)' sAMAccountName -U${USERNAME}%${PASSWORD} || failed=$(expr $failed + 1)
GNUTLS_FORCE_FIPS_MODE=1
export GNUTLS_FORCE_FIPS_MODE
# Checks that testparm reports: Weak crypto is disallowed
testit_grep "testparm.without-weak" "Weak crypto is disallowed" $samba_testparm --suppress-prompt $SMB_CONF_PATH 2>&1 || failed=$(expr $failed + 1)
# We should not be allowed to use NTLM for connecting
testit_expect_failure_grep \
"net_ads_search.ntlm.without-weak" \
"ads_sasl_spnego_gensec_bind.*failed.for.ldap/.*user.*${USERNAME}.:.An.invalid.parameter." \
$samba_net ads search -d10 --use-kerberos=off '(objectCategory=group)' sAMAccountName -U${USERNAME}%${PASSWORD} || failed=$(expr $failed + 1)
unset GNUTLS_FORCE_FIPS_MODE
testok $0 $failed