2010-06-24 03:42:40 +04:00
#!/bin/sh
# Blackbox tests for kinit and kerberos integration with smbclient etc
2022-03-24 03:04:54 +03:00
#
2010-06-24 03:42:40 +04:00
# Copyright (C) 2006-2007 Jelmer Vernooij <jelmer@samba.org>
# Copyright (C) 2006-2008 Andrew Bartlett <abartlet@samba.org>
2022-03-24 03:04:54 +03:00
# Copyright (C) 2022 Andreas Schneider <asn@samba.org>
2010-06-24 03:42:40 +04:00
2022-03-24 03:04:54 +03:00
if [ $# -lt 7 ] ; then
2022-03-18 12:20:27 +03:00
cat <<EOF
2023-09-05 07:22:01 +03:00
Usage: test_pkinit_simple.sh SERVER USERNAME PASSWORD REALM DOMAIN PREFIX SMBCLIENT
2010-06-24 03:42:40 +04:00
EOF
2022-03-18 12:20:27 +03:00
exit 1
2010-06-24 03:42:40 +04:00
fi
2022-03-24 02:53:28 +03:00
SERVER = " ${ 1 } "
USERNAME = " ${ 2 } "
PASSWORD = " ${ 3 } "
REALM = " ${ 4 } "
DOMAIN = " ${ 5 } "
PREFIX = " ${ 6 } "
2022-03-24 03:04:54 +03:00
smbclient = " ${ 7 } "
shift 7
2010-06-24 03:42:40 +04:00
failed = 0
2022-03-24 03:04:54 +03:00
samba_bindir = " ${ BINDIR } "
2014-02-21 18:55:22 +04:00
2022-03-24 03:04:54 +03:00
samba_tool = " ${ PYTHON } ${ samba_bindir } /samba-tool "
wbinfo = " ${ samba_bindir } /wbinfo "
2014-02-21 18:55:22 +04:00
2022-03-24 03:04:54 +03:00
. " $( dirname " $0 " ) " /subunit.sh
. " $( dirname " $0 " ) " /common_test_fns.inc
2010-06-24 03:42:40 +04:00
2022-12-22 16:32:59 +03:00
samba_kinit = $( system_or_builddir_binary kinit " ${ BINDIR } " samba4kinit)
2022-03-24 03:04:54 +03:00
unc = " // ${ SERVER } /tmp "
2010-06-24 03:42:40 +04:00
2016-06-03 19:19:40 +03:00
KRB5CCNAME_PATH = " $PREFIX /tmpccache "
2022-03-24 03:04:54 +03:00
rm -f " ${ KRB5CCNAME_PATH } "
2016-06-03 19:19:40 +03:00
KRB5CCNAME = " FILE: $KRB5CCNAME_PATH "
2010-06-24 03:42:40 +04:00
export KRB5CCNAME
2016-06-02 19:24:18 +03:00
2022-03-24 03:04:54 +03:00
USER_PRINCIPAL_NAME = " $( echo " ${ USERNAME } @ ${ REALM } " | tr "[:upper:]" "[:lower:]" ) "
kbase = " $( basename " ${ samba_kinit } " ) "
if [ " ${ kbase } " = "samba4kinit" ] ; then
# HEIMDAL
X509_USER_IDENTITY = " --pk-user=FILE: ${ PREFIX } /pkinit/USER- ${ USER_PRINCIPAL_NAME } -cert.pem, ${ PREFIX } /pkinit/USER- ${ USER_PRINCIPAL_NAME } -private-key.pem "
OPTION_RENEWABLE = "--renewable"
OPTION_RENEW_TICKET = "--renew"
OPTION_ENTERPRISE_NAME = "--enterprise"
else
# MIT
X509_USER_IDENTITY = " -X X509_user_identity=FILE: ${ PREFIX } /pkinit/USER- ${ USER_PRINCIPAL_NAME } -cert.pem, ${ PREFIX } /pkinit/USER- ${ USER_PRINCIPAL_NAME } -private-key.pem "
OPTION_RENEWABLE = "-r 1h"
OPTION_RENEW_TICKET = "-R"
OPTION_ENTERPRISE_NAME = "-E"
fi
OPTION_REQUEST_PAC = "--request-pac"
2016-06-02 19:24:18 +03:00
2022-03-24 03:04:54 +03:00
# STEP0:
2016-06-02 19:24:18 +03:00
# Now we set the UF_SMARTCARD_REQUIRED bit
# This means we have a normal enabled account *without* a known password
2022-03-24 03:04:54 +03:00
testit " STEP0 samba-tool user create ${ USERNAME } --smartcard-required " \
" ${ samba_tool } " user create " ${ USERNAME } " --smartcard-required ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP1 kinit with password" \
2022-03-24 03:04:54 +03:00
kerberos_kinit " ${ samba_kinit } " " ${ USERNAME } @ ${ REALM } " " ${ PASSWORD } " \
2022-04-22 16:46:05 +03:00
" ${ OPTION_REQUEST_PAC } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP1 Test login with NTLM" \
2022-03-24 02:53:28 +03:00
" ${ smbclient } " " ${ unc } " -c 'ls' " -U ${ USERNAME } % ${ PASSWORD } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP1 Test wbinfo with password" \
2022-03-24 02:53:28 +03:00
" ${ wbinfo } " " --authenticate= $DOMAIN / $USERNAME % $PASSWORD " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2022-03-24 03:04:54 +03:00
testit " STEP1 kinit with pkinit (name specified: ${ USERNAME } ) " \
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ USERNAME } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2022-03-24 03:04:54 +03:00
2022-03-18 12:26:46 +03:00
testit "STEP1 kinit renew ticket (name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEW_TICKET } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP1 Test login with kerberos ccache (name specified)" \
2022-03-24 02:53:28 +03:00
'ls' " $unc " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2022-03-24 03:04:54 +03:00
# OK
testit_expect_failure "STEP1 kinit with pkinit (wrong name specified)" \
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " not ${ USERNAME } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2022-03-24 03:04:54 +03:00
testit_expect_failure "STEP1 kinit with pkinit (wrong name specified 2)" \
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ SERVER } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP1 kinit with pkinit (enterprise name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ OPTION_ENTERPRISE_NAME } " \
" ${ USERNAME } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP1 kinit renew ticket (enterprise name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEW_TICKET } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP1 Test login with kerberos ccache (enterprise name specified)" \
2022-03-24 02:53:28 +03:00
'ls' " ${ unc } " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2022-03-24 03:04:54 +03:00
testit_expect_failure "STEP1 kinit with pkinit (wrong enterprise name specified)" \
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ OPTION_ENTERPRISE_NAME } " \
" not ${ USERNAME } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2022-03-24 03:04:54 +03:00
testit_expect_failure "STEP1 kinit with pkinit (wrong enterprise name specified 2)" \
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ OPTION_ENTERPRISE_NAME } " \
" ${ SERVER } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP1 kinit with pkinit (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ OPTION_ENTERPRISE_NAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP1 kinit renew ticket (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEW_TICKET } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP1 Test login with kerberos ccache (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
'ls' " ${ unc } " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2016-06-02 19:24:18 +03:00
# STEP2:
# We still have UF_SMARTCARD_REQUIRED, but with a known password
2022-03-24 03:04:54 +03:00
testit " STEP2 samba-tool user setpassword ${ USERNAME } --newpassword " \
" ${ samba_tool } " user setpassword " ${ USERNAME } " \
2022-04-22 16:46:05 +03:00
--newpassword= " ${ PASSWORD } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP2 kinit with password" \
2022-03-24 03:04:54 +03:00
kerberos_kinit " ${ samba_kinit } " " ${ USERNAME } @ ${ REALM } " " ${ PASSWORD } " \
2022-04-22 16:46:05 +03:00
" ${ OPTION_REQUEST_PAC } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP2 Test login with NTLM" \
2022-03-24 02:53:28 +03:00
'ls' " $unc " -U" ${ USERNAME } % ${ PASSWORD } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP2 Test wbinfo with password" \
2022-03-24 02:53:28 +03:00
" ${ wbinfo } " --authenticate= " ${ DOMAIN } / ${ USERNAME } % ${ PASSWORD } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP2 kinit with pkinit (name specified) " \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ USERNAME } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP2 kinit renew ticket (name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEW_TICKET } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP2 Test login with kerberos ccache (name specified)" \
2022-03-24 02:53:28 +03:00
'ls' " $unc " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP2 kinit with pkinit (enterprise name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ OPTION_ENTERPRISE_NAME } " \
" ${ USERNAME } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP2 kinit renew ticket (enterprise name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEW_TICKET } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP2 Test login with kerberos ccache (enterprise name specified)" \
2022-03-24 02:53:28 +03:00
'ls' " $unc " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP2 kinit with pkinit (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ OPTION_ENTERPRISE_NAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP2 kinit renew ticket (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEW_TICKET } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP2 Test login with kerberos ccache (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
'ls' " $unc " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2016-06-02 19:24:18 +03:00
# STEP3:
# The account is a normal account without the UF_SMARTCARD_REQUIRED bit set
2022-03-24 03:04:54 +03:00
testit " STEP3 samba-tool user setpassword ${ USERNAME } --clear-smartcard-required " \
" ${ samba_tool } " user setpassword " ${ USERNAME } " \
2022-04-22 16:46:05 +03:00
--newpassword= " ${ PASSWORD } " --clear-smartcard-required ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP3 kinit with password" \
2022-03-24 03:04:54 +03:00
kerberos_kinit " ${ samba_kinit } " " ${ USERNAME } @ ${ REALM } " " ${ PASSWORD } " \
2022-04-22 16:46:05 +03:00
" ${ OPTION_REQUEST_PAC } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP3 Test login with user kerberos ccache" \
2022-03-24 02:53:28 +03:00
'ls' " $unc " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP3 Test login with NTLM" \
2022-03-24 02:53:28 +03:00
'ls' " $unc " -U" ${ USERNAME } % ${ PASSWORD } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP3 Test wbinfo with password" \
2022-03-24 02:53:28 +03:00
" ${ wbinfo } " --authenticate= " ${ DOMAIN } / ${ USERNAME } % ${ PASSWORD } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP3 kinit with pkinit (name specified) " \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ USERNAME } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP3 kinit renew ticket (name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEW_TICKET } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP3 Test login with kerberos ccache (name specified)" \
2022-03-24 03:04:54 +03:00
'ls' " ${ unc } " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP3 kinit with pkinit (enterprise name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ OPTION_ENTERPRISE_NAME } " \
" ${ USERNAME } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP3 kinit renew ticket (enterprise name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEW_TICKET } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP3 Test login with kerberos ccache (enterprise name specified)" \
2022-03-24 03:04:54 +03:00
'ls' " ${ unc } " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP3 kinit with pkinit (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ OPTION_ENTERPRISE_NAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP3 kinit renew ticket (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEW_TICKET } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP3 Test login with kerberos ccache (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
'ls' " ${ unc } " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2016-06-02 19:24:18 +03:00
# STEP4:
# Now we set the UF_SMARTCARD_REQUIRED bit
# This means we have a normal enabled account *without* a known password
2022-03-18 12:26:46 +03:00
testit " STEP4 samba-tool user setpassword $USERNAME --smartcard-required " \
2022-03-24 03:04:54 +03:00
" ${ samba_tool } " user setpassword " ${ USERNAME } " --smartcard-required ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP4 kinit with password" \
2022-03-24 03:04:54 +03:00
kerberos_kinit " ${ samba_kinit } " " ${ USERNAME } @ ${ REALM } " " ${ PASSWORD } " \
2022-04-22 16:46:05 +03:00
" ${ OPTION_REQUEST_PAC } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP4 Test login with NTLM" \
2022-03-24 02:53:28 +03:00
" ${ smbclient } " " ${ unc } " -c 'ls' -U" ${ USERNAME } % ${ PASSWORD } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP4 Test wbinfo with password" \
2022-03-24 02:53:28 +03:00
" ${ wbinfo } " --authenticate= " ${ DOMAIN } / ${ USERNAME } % ${ PASSWORD } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2022-03-24 03:04:54 +03:00
testit "STEP4 kinit with pkinit (name specified)" \
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ USERNAME } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP4 kinit renew ticket (name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEW_TICKET } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP4 Test login with kerberos ccache (name specified)" \
2022-03-24 02:53:28 +03:00
'ls' " $unc " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP4 kinit with pkinit (enterprise name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ OPTION_ENTERPRISE_NAME } " \
" ${ USERNAME } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP4 kinit renew ticket (enterprise name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEW_TICKET } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP4 Test login with kerberos ccache (enterprise name specified)" \
2022-03-24 03:04:54 +03:00
'ls' " ${ unc } " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP4 kinit with pkinit (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ OPTION_ENTERPRISE_NAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit "STEP4 kinit renew ticket (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEW_TICKET } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
test_smbclient "STEP4 Test login with kerberos ccache (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
'ls' " ${ unc } " --use-krb5-ccache= " ${ KRB5CCNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2016-06-02 19:24:18 +03:00
# STEP5:
# disable the account
2022-03-18 12:26:46 +03:00
testit " STEP5 samba-tool user disable $USERNAME " \
2022-03-24 03:04:54 +03:00
" ${ samba_tool } " user disable " ${ USERNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP5 kinit with password" \
2022-03-24 03:04:54 +03:00
kerberos_kinit " ${ samba_kinit } " " ${ USERNAME } @ ${ REALM } " " ${ PASSWORD } " \
2022-04-22 16:46:05 +03:00
" ${ OPTION_REQUEST_PAC } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP5 Test login with NTLM" \
2022-03-24 02:53:28 +03:00
" ${ smbclient } " " ${ unc } " -c 'ls' -U" ${ USERNAME } % ${ PASSWORD } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP5 Test wbinfo with password" \
2022-03-24 02:53:28 +03:00
" ${ wbinfo } " --authenticate= " ${ DOMAIN } / ${ USERNAME } % ${ PASSWORD } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2022-03-24 03:04:54 +03:00
testit_expect_failure "STEP5 kinit with pkinit (name specified)" \
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ USERNAME } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP5 kinit with pkinit (enterprise name specified)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ OPTION_ENTERPRISE_NAME } " \
" ${ USERNAME } @ ${ REALM } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
testit_expect_failure "STEP5 kinit with pkinit (enterprise name in cert)" \
2022-03-24 03:04:54 +03:00
" ${ samba_kinit } " " ${ OPTION_REQUEST_PAC } " " ${ OPTION_RENEWABLE } " \
2022-04-22 16:46:05 +03:00
" ${ X509_USER_IDENTITY } " " ${ OPTION_ENTERPRISE_NAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2010-06-24 03:42:40 +04:00
2016-06-02 19:24:18 +03:00
# STEP6:
# cleanup
2022-03-24 03:04:54 +03:00
testit " STEP6 samba-tool user delete ${ USERNAME } " \
" ${ samba_tool } " user delete " ${ USERNAME } " ||
2022-03-18 12:26:46 +03:00
failed = $(( failed + 1 ))
2010-06-24 03:42:40 +04:00
2022-03-24 03:04:54 +03:00
rm -f " ${ KRB5CCNAME_PATH } "
exit ${ failed }