|
|
d738b9 |
From c9b74036064b7f3aebbd3c482703ce97ff868bb6 Mon Sep 17 00:00:00 2001
|
|
|
d738b9 |
From: Robbie Harwood <rharwood@redhat.com>
|
|
|
d738b9 |
Date: Thu, 15 Mar 2018 14:37:28 -0400
|
|
|
d738b9 |
Subject: [PATCH] Include preauth name in trace output if possible
|
|
|
d738b9 |
|
|
|
d738b9 |
Add a {patype} trace format specifier for a single pa-type value. Add
|
|
|
d738b9 |
a krb5_preauthtype to string conversion function to trace machinery
|
|
|
d738b9 |
and use it when formatting {patype} or {patypes}.
|
|
|
d738b9 |
|
|
|
d738b9 |
[ghudson@mit.edu: wrote conversion function; edited commit message]
|
|
|
d738b9 |
|
|
|
d738b9 |
ticket: 8653 (new)
|
|
|
d738b9 |
(cherry picked from commit 9c68fe39b018666eabe033b639c1f35d03ba51c7)
|
|
|
d738b9 |
[rharwood@redhat.com: freshness, expected_msg]
|
|
|
d738b9 |
---
|
|
|
d738b9 |
src/include/k5-trace.h | 17 +--
|
|
|
d738b9 |
src/lib/krb5/os/t_trace.ref | 2 +-
|
|
|
d738b9 |
src/lib/krb5/os/trace.c | 60 +++++++++-
|
|
|
d738b9 |
src/tests/t_pkinit.py | 36 +++---
|
|
|
d738b9 |
src/tests/t_preauth.py | 216 ++++++++++++++++++------------------
|
|
|
d738b9 |
5 files changed, 199 insertions(+), 132 deletions(-)
|
|
|
d738b9 |
|
|
|
d738b9 |
diff --git a/src/include/k5-trace.h b/src/include/k5-trace.h
|
|
|
d738b9 |
index e60ee0b75..49b1b6756 100644
|
|
|
d738b9 |
--- a/src/include/k5-trace.h
|
|
|
d738b9 |
+++ b/src/include/k5-trace.h
|
|
|
d738b9 |
@@ -75,6 +75,7 @@
|
|
|
d738b9 |
* {cksum} const krb5_checksum *, display cksumtype and hex checksum
|
|
|
d738b9 |
* {princ} krb5_principal, unparse and display
|
|
|
d738b9 |
* {ptype} krb5_int32, krb5_principal type, display name
|
|
|
d738b9 |
+ * {patype} krb5_preauthtype, a single padata type number
|
|
|
d738b9 |
* {patypes} krb5_pa_data **, display list of padata type numbers
|
|
|
d738b9 |
* {etype} krb5_enctype, display shortest name of enctype
|
|
|
d738b9 |
* {etypes} krb5_enctype *, display list of enctypes
|
|
|
d738b9 |
@@ -218,14 +219,14 @@ void krb5int_trace(krb5_context context, const char *fmt, ...);
|
|
|
d738b9 |
#define TRACE_INIT_CREDS_PREAUTH_DECRYPT_FAIL(c, code) \
|
|
|
d738b9 |
TRACE(c, "Decrypt with preauth AS key failed: {kerr}", code)
|
|
|
d738b9 |
#define TRACE_INIT_CREDS_PREAUTH_MORE(c, patype) \
|
|
|
d738b9 |
- TRACE(c, "Continuing preauth mech {int}", (int)patype)
|
|
|
d738b9 |
+ TRACE(c, "Continuing preauth mech {patype}", patype)
|
|
|
d738b9 |
#define TRACE_INIT_CREDS_PREAUTH_NONE(c) \
|
|
|
d738b9 |
TRACE(c, "Sending unauthenticated request")
|
|
|
d738b9 |
#define TRACE_INIT_CREDS_PREAUTH_OPTIMISTIC(c) \
|
|
|
d738b9 |
TRACE(c, "Attempting optimistic preauth")
|
|
|
d738b9 |
#define TRACE_INIT_CREDS_PREAUTH_TRYAGAIN(c, patype, code) \
|
|
|
d738b9 |
- TRACE(c, "Recovering from KDC error {int} using preauth mech {int}", \
|
|
|
d738b9 |
- (int)patype, (int)code)
|
|
|
d738b9 |
+ TRACE(c, "Recovering from KDC error {int} using preauth mech {patype}", \
|
|
|
d738b9 |
+ patype, (int)code)
|
|
|
d738b9 |
#define TRACE_INIT_CREDS_RESTART_FAST(c) \
|
|
|
d738b9 |
TRACE(c, "Restarting to upgrade to FAST")
|
|
|
d738b9 |
#define TRACE_INIT_CREDS_RESTART_PREAUTH_FAILED(c) \
|
|
|
d738b9 |
@@ -269,7 +270,7 @@ void krb5int_trace(krb5_context context, const char *fmt, ...);
|
|
|
d738b9 |
|
|
|
d738b9 |
#define TRACE_PREAUTH_CONFLICT(c, name1, name2, patype) \
|
|
|
d738b9 |
TRACE(c, "Preauth module {str} conflicts with module {str} for pa " \
|
|
|
d738b9 |
- "type {int}", name1, name2, (int) patype)
|
|
|
d738b9 |
+ "type {patype}", name1, name2, patype)
|
|
|
d738b9 |
#define TRACE_PREAUTH_COOKIE(c, len, data) \
|
|
|
d738b9 |
TRACE(c, "Received cookie: {lenstr}", (size_t) len, data)
|
|
|
d738b9 |
#define TRACE_PREAUTH_ENC_TS_KEY_GAK(c, keyblock) \
|
|
|
d738b9 |
@@ -281,8 +282,8 @@ void krb5int_trace(krb5_context context, const char *fmt, ...);
|
|
|
d738b9 |
TRACE(c, "Selected etype info: etype {etype}, salt \"{data}\", " \
|
|
|
d738b9 |
"params \"{data}\"", etype, salt, s2kparams)
|
|
|
d738b9 |
#define TRACE_PREAUTH_INFO_FAIL(c, patype, code) \
|
|
|
d738b9 |
- TRACE(c, "Preauth builtin info function failure, type={int}: {kerr}", \
|
|
|
d738b9 |
- (int) patype, code)
|
|
|
d738b9 |
+ TRACE(c, "Preauth builtin info function failure, type={patype}: {kerr}", \
|
|
|
d738b9 |
+ patype, code)
|
|
|
d738b9 |
#define TRACE_PREAUTH_INPUT(c, padata) \
|
|
|
d738b9 |
TRACE(c, "Processing preauth types: {patypes}", padata)
|
|
|
d738b9 |
#define TRACE_PREAUTH_OUTPUT(c, padata) \
|
|
|
d738b9 |
@@ -293,8 +294,8 @@ void krb5int_trace(krb5_context context, const char *fmt, ...);
|
|
|
d738b9 |
#define TRACE_PREAUTH_SAM_KEY_GAK(c, keyblock) \
|
|
|
d738b9 |
TRACE(c, "AS key obtained for SAM: {keyblock}", keyblock)
|
|
|
d738b9 |
#define TRACE_PREAUTH_SALT(c, salt, patype) \
|
|
|
d738b9 |
- TRACE(c, "Received salt \"{data}\" via padata type {int}", salt, \
|
|
|
d738b9 |
- (int) patype)
|
|
|
d738b9 |
+ TRACE(c, "Received salt \"{data}\" via padata type {patype}", salt, \
|
|
|
d738b9 |
+ patype)
|
|
|
d738b9 |
#define TRACE_PREAUTH_SKIP(c, name, patype) \
|
|
|
d738b9 |
TRACE(c, "Skipping previously used preauth module {str} ({int})", \
|
|
|
d738b9 |
name, (int) patype)
|
|
|
d738b9 |
diff --git a/src/lib/krb5/os/t_trace.ref b/src/lib/krb5/os/t_trace.ref
|
|
|
d738b9 |
index ca5818a1e..bd5d9b6b6 100644
|
|
|
d738b9 |
--- a/src/lib/krb5/os/t_trace.ref
|
|
|
d738b9 |
+++ b/src/lib/krb5/os/t_trace.ref
|
|
|
d738b9 |
@@ -38,7 +38,7 @@ int, krb5_principal type: Windows 2000 UPN and SID
|
|
|
d738b9 |
int, krb5_principal type: NT 4 style name
|
|
|
d738b9 |
int, krb5_principal type: NT 4 style name and SID
|
|
|
d738b9 |
int, krb5_principal type: ?
|
|
|
d738b9 |
-krb5_pa_data **, display list of padata type numbers: 3, 0
|
|
|
d738b9 |
+krb5_pa_data **, display list of padata type numbers: PA-PW-SALT (3), 0
|
|
|
d738b9 |
krb5_pa_data **, display list of padata type numbers: (empty)
|
|
|
d738b9 |
krb5_enctype, display shortest name of enctype: des-cbc-crc
|
|
|
d738b9 |
krb5_enctype *, display list of enctypes: 5, rc4-hmac-exp, 511
|
|
|
d738b9 |
diff --git a/src/lib/krb5/os/trace.c b/src/lib/krb5/os/trace.c
|
|
|
d738b9 |
index 8750b7650..5a80f5518 100644
|
|
|
d738b9 |
--- a/src/lib/krb5/os/trace.c
|
|
|
d738b9 |
+++ b/src/lib/krb5/os/trace.c
|
|
|
d738b9 |
@@ -123,6 +123,49 @@ principal_type_string(krb5_int32 type)
|
|
|
d738b9 |
}
|
|
|
d738b9 |
}
|
|
|
d738b9 |
|
|
|
d738b9 |
+static char *
|
|
|
d738b9 |
+padata_type_string(krb5_preauthtype type)
|
|
|
d738b9 |
+{
|
|
|
d738b9 |
+ switch (type) {
|
|
|
d738b9 |
+ case KRB5_PADATA_TGS_REQ: return "PA-TGS-REQ";
|
|
|
d738b9 |
+ case KRB5_PADATA_ENC_TIMESTAMP: return "PA-ENC-TIMESTAMP";
|
|
|
d738b9 |
+ case KRB5_PADATA_PW_SALT: return "PA-PW-SALT";
|
|
|
d738b9 |
+ case KRB5_PADATA_ENC_UNIX_TIME: return "PA-ENC-UNIX-TIME";
|
|
|
d738b9 |
+ case KRB5_PADATA_ENC_SANDIA_SECURID: return "PA-SANDIA-SECUREID";
|
|
|
d738b9 |
+ case KRB5_PADATA_SESAME: return "PA-SESAME";
|
|
|
d738b9 |
+ case KRB5_PADATA_OSF_DCE: return "PA-OSF-DCE";
|
|
|
d738b9 |
+ case KRB5_CYBERSAFE_SECUREID: return "PA-CYBERSAFE-SECUREID";
|
|
|
d738b9 |
+ case KRB5_PADATA_AFS3_SALT: return "PA-AFS3-SALT";
|
|
|
d738b9 |
+ case KRB5_PADATA_ETYPE_INFO: return "PA-ETYPE-INFO";
|
|
|
d738b9 |
+ case KRB5_PADATA_SAM_CHALLENGE: return "PA-SAM-CHALLENGE";
|
|
|
d738b9 |
+ case KRB5_PADATA_SAM_RESPONSE: return "PA-SAM-RESPONSE";
|
|
|
d738b9 |
+ case KRB5_PADATA_PK_AS_REQ_OLD: return "PA-PK-AS-REQ_OLD";
|
|
|
d738b9 |
+ case KRB5_PADATA_PK_AS_REP_OLD: return "PA-PK-AS-REP_OLD";
|
|
|
d738b9 |
+ case KRB5_PADATA_PK_AS_REQ: return "PA-PK-AS-REQ";
|
|
|
d738b9 |
+ case KRB5_PADATA_PK_AS_REP: return "PA-PK-AS-REP";
|
|
|
d738b9 |
+ case KRB5_PADATA_ETYPE_INFO2: return "PA-ETYPE-INFO2";
|
|
|
d738b9 |
+ case KRB5_PADATA_SVR_REFERRAL_INFO: return "PA-SVR-REFERRAL-INFO";
|
|
|
d738b9 |
+ case KRB5_PADATA_SAM_REDIRECT: return "PA-SAM-REDIRECT";
|
|
|
d738b9 |
+ case KRB5_PADATA_GET_FROM_TYPED_DATA: return "PA-GET-FROM-TYPED-DATA";
|
|
|
d738b9 |
+ case KRB5_PADATA_SAM_CHALLENGE_2: return "PA-SAM-CHALLENGE2";
|
|
|
d738b9 |
+ case KRB5_PADATA_SAM_RESPONSE_2: return "PA-SAM-RESPONSE2";
|
|
|
d738b9 |
+ case KRB5_PADATA_PAC_REQUEST: return "PA-PAC-REQUEST";
|
|
|
d738b9 |
+ case KRB5_PADATA_FOR_USER: return "PA-FOR_USER";
|
|
|
d738b9 |
+ case KRB5_PADATA_S4U_X509_USER: return "PA-FOR-X509-USER";
|
|
|
d738b9 |
+ case KRB5_PADATA_AS_CHECKSUM: return "PA-AS-CHECKSUM";
|
|
|
d738b9 |
+ case KRB5_PADATA_FX_COOKIE: return "PA-FX-COOKIE";
|
|
|
d738b9 |
+ case KRB5_PADATA_FX_FAST: return "PA-FX-FAST";
|
|
|
d738b9 |
+ case KRB5_PADATA_FX_ERROR: return "PA-FX-ERROR";
|
|
|
d738b9 |
+ case KRB5_PADATA_ENCRYPTED_CHALLENGE: return "PA-ENCRYPTED-CHALLENGE";
|
|
|
d738b9 |
+ case KRB5_PADATA_OTP_CHALLENGE: return "PA-OTP-CHALLENGE";
|
|
|
d738b9 |
+ case KRB5_PADATA_OTP_REQUEST: return "PA-OTP-REQUEST";
|
|
|
d738b9 |
+ case KRB5_PADATA_OTP_PIN_CHANGE: return "PA-OTP-PIN-CHANGE";
|
|
|
d738b9 |
+ case KRB5_PADATA_PKINIT_KX: return "PA-PKINIT-KX";
|
|
|
d738b9 |
+ case KRB5_ENCPADATA_REQ_ENC_PA_REP: return "PA-REQ-ENC-PA-REP";
|
|
|
d738b9 |
+ default: return NULL;
|
|
|
d738b9 |
+ }
|
|
|
d738b9 |
+}
|
|
|
d738b9 |
+
|
|
|
d738b9 |
static char *
|
|
|
d738b9 |
trace_format(krb5_context context, const char *fmt, va_list ap)
|
|
|
d738b9 |
{
|
|
|
d738b9 |
@@ -140,6 +183,8 @@ trace_format(krb5_context context, const char *fmt, va_list ap)
|
|
|
d738b9 |
krb5_key key;
|
|
|
d738b9 |
const krb5_checksum *cksum;
|
|
|
d738b9 |
krb5_pa_data **padata;
|
|
|
d738b9 |
+ krb5_preauthtype pa_type;
|
|
|
d738b9 |
+ const char *name;
|
|
|
d738b9 |
krb5_ccache ccache;
|
|
|
d738b9 |
krb5_keytab keytab;
|
|
|
d738b9 |
krb5_creds *creds;
|
|
|
d738b9 |
@@ -271,10 +316,23 @@ trace_format(krb5_context context, const char *fmt, va_list ap)
|
|
|
d738b9 |
if (padata == NULL || *padata == NULL)
|
|
|
d738b9 |
k5_buf_add(&buf, "(empty)");
|
|
|
d738b9 |
for (; padata != NULL && *padata != NULL; padata++) {
|
|
|
d738b9 |
- k5_buf_add_fmt(&buf, "%d", (int)(*padata)->pa_type);
|
|
|
d738b9 |
+ pa_type = (*padata)->pa_type;
|
|
|
d738b9 |
+ name = padata_type_string(pa_type);
|
|
|
d738b9 |
+ if (name != NULL)
|
|
|
d738b9 |
+ k5_buf_add_fmt(&buf, "%s (%d)", name, (int)pa_type);
|
|
|
d738b9 |
+ else
|
|
|
d738b9 |
+ k5_buf_add_fmt(&buf, "%d", (int)pa_type);
|
|
|
d738b9 |
+
|
|
|
d738b9 |
if (*(padata + 1) != NULL)
|
|
|
d738b9 |
k5_buf_add(&buf, ", ");
|
|
|
d738b9 |
}
|
|
|
d738b9 |
+ } else if (strcmp(tmpbuf, "patype") == 0) {
|
|
|
d738b9 |
+ pa_type = va_arg(ap, krb5_preauthtype);
|
|
|
d738b9 |
+ name = padata_type_string(pa_type);
|
|
|
d738b9 |
+ if (name != NULL)
|
|
|
d738b9 |
+ k5_buf_add_fmt(&buf, "%s (%d)", name, (int)pa_type);
|
|
|
d738b9 |
+ else
|
|
|
d738b9 |
+ k5_buf_add_fmt(&buf, "%d", (int)pa_type);
|
|
|
d738b9 |
} else if (strcmp(tmpbuf, "etype") == 0) {
|
|
|
d738b9 |
etype = va_arg(ap, krb5_enctype);
|
|
|
d738b9 |
if (krb5_enctype_to_name(etype, TRUE, tmpbuf, sizeof(tmpbuf)) == 0)
|
|
|
d738b9 |
diff --git a/src/tests/t_pkinit.py b/src/tests/t_pkinit.py
|
|
|
d738b9 |
index c25475096..64ff2393a 100755
|
|
|
d738b9 |
--- a/src/tests/t_pkinit.py
|
|
|
d738b9 |
+++ b/src/tests/t_pkinit.py
|
|
|
d738b9 |
@@ -161,10 +161,18 @@ realm.start_kdc()
|
|
|
d738b9 |
realm.run([kadminl, 'delprinc', 'WELLKNOWN/ANONYMOUS'])
|
|
|
d738b9 |
|
|
|
d738b9 |
# Run the basic test - PKINIT with FILE: identity, with no password on the key.
|
|
|
d738b9 |
-realm.run(['./responder', '-x', 'pkinit=',
|
|
|
d738b9 |
- '-X', 'X509_user_identity=%s' % file_identity, realm.user_princ])
|
|
|
d738b9 |
+msgs = ('Sending unauthenticated request',
|
|
|
d738b9 |
+ '/Additional pre-authentication required',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'PKINIT loading CA certs and CRLs from FILE',
|
|
|
d738b9 |
+ 'PKINIT client making DH request',
|
|
|
d738b9 |
+ ' preauth for next request: PA-FX-COOKIE (133), PA-PK-AS-REQ (16)',
|
|
|
d738b9 |
+ 'PKINIT client verified DH reply',
|
|
|
d738b9 |
+ 'PKINIT client found id-pkinit-san in KDC cert',
|
|
|
d738b9 |
+ 'PKINIT client matched KDC principal krbtgt/')
|
|
|
d738b9 |
realm.kinit(realm.user_princ,
|
|
|
d738b9 |
- flags=['-X', 'X509_user_identity=%s' % file_identity])
|
|
|
d738b9 |
+ flags=['-X', 'X509_user_identity=%s' % file_identity],
|
|
|
d738b9 |
+ expected_trace=msgs)
|
|
|
d738b9 |
realm.klist(realm.user_princ)
|
|
|
d738b9 |
realm.run([kvno, realm.host_princ])
|
|
|
d738b9 |
|
|
|
d738b9 |
@@ -181,19 +189,19 @@ minbits_kdc_conf = {'realms': {'$realm': {'pkinit_dh_min_bits': '4096'}}}
|
|
|
d738b9 |
minbits_env = realm.special_env('restrict', True, kdc_conf=minbits_kdc_conf)
|
|
|
d738b9 |
realm.stop_kdc()
|
|
|
d738b9 |
realm.start_kdc(env=minbits_env)
|
|
|
d738b9 |
-expected_trace = ('Sending unauthenticated request',
|
|
|
d738b9 |
- '/Additional pre-authentication required',
|
|
|
d738b9 |
- 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
- 'Preauth module pkinit (16) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, 16',
|
|
|
d738b9 |
- '/Key parameters not accepted',
|
|
|
d738b9 |
- 'Preauth tryagain input types (16): 109, 133',
|
|
|
d738b9 |
- 'trying again with KDC-provided parameters',
|
|
|
d738b9 |
- 'Preauth module pkinit (16) tryagain returned: 0/Success',
|
|
|
d738b9 |
- 'Followup preauth for next request: 16, 133')
|
|
|
d738b9 |
+msgs = ('Sending unauthenticated request',
|
|
|
d738b9 |
+ '/Additional pre-authentication required',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'Preauth module pkinit (16) (real) returned: 0/Success',
|
|
|
d738b9 |
+ ' preauth for next request: PA-FX-COOKIE (133), PA-PK-AS-REQ (16)',
|
|
|
d738b9 |
+ '/Key parameters not accepted',
|
|
|
d738b9 |
+ 'Preauth tryagain input types (16): 109, PA-FX-COOKIE (133)',
|
|
|
d738b9 |
+ 'trying again with KDC-provided parameters',
|
|
|
d738b9 |
+ 'Preauth module pkinit (16) tryagain returned: 0/Success',
|
|
|
d738b9 |
+ ' preauth for next request: PA-PK-AS-REQ (16), PA-FX-COOKIE (133)')
|
|
|
d738b9 |
realm.kinit(realm.user_princ,
|
|
|
d738b9 |
flags=['-X', 'X509_user_identity=%s' % file_identity],
|
|
|
d738b9 |
- expected_trace=expected_trace)
|
|
|
d738b9 |
+ expected_trace=msgs)
|
|
|
d738b9 |
realm.stop_kdc()
|
|
|
d738b9 |
realm.start_kdc()
|
|
|
d738b9 |
|
|
|
d738b9 |
diff --git a/src/tests/t_preauth.py b/src/tests/t_preauth.py
|
|
|
d738b9 |
index 7d4d299dc..b2b0983aa 100644
|
|
|
d738b9 |
--- a/src/tests/t_preauth.py
|
|
|
d738b9 |
+++ b/src/tests/t_preauth.py
|
|
|
d738b9 |
@@ -22,15 +22,15 @@ if 'no key' not in out:
|
|
|
d738b9 |
# PA-FX-COOKIE; 2 is encrypted timestamp.
|
|
|
d738b9 |
|
|
|
d738b9 |
# Test normal preauth flow.
|
|
|
d738b9 |
-expected_trace = ('Sending unauthenticated request',
|
|
|
d738b9 |
- '/Additional pre-authentication required',
|
|
|
d738b9 |
- 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
- 'Processing preauth types:',
|
|
|
d738b9 |
- 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, -123',
|
|
|
d738b9 |
- 'Decrypted AS reply')
|
|
|
d738b9 |
+msgs = ('Sending unauthenticated request',
|
|
|
d738b9 |
+ '/Additional pre-authentication required',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'Processing preauth types:',
|
|
|
d738b9 |
+ 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'Produced preauth for next request: PA-FX-COOKIE (133), -123',
|
|
|
d738b9 |
+ 'Decrypted AS reply')
|
|
|
d738b9 |
realm.run(['./icred', realm.user_princ, password('user')],
|
|
|
d738b9 |
- expected_msg='testval', expected_trace=expected_trace)
|
|
|
d738b9 |
+ expected_msg='testval', expected_trace=msgs)
|
|
|
d738b9 |
|
|
|
d738b9 |
# Test successful optimistic preauth.
|
|
|
d738b9 |
expected_trace = ('Attempting optimistic preauth',
|
|
|
d738b9 |
@@ -43,136 +43,136 @@ realm.run(['./icred', '-o', '-123', realm.user_princ, password('user')],
|
|
|
d738b9 |
|
|
|
d738b9 |
# Test optimistic preauth failing on client, followed by successful
|
|
|
d738b9 |
# preauth using the same module.
|
|
|
d738b9 |
-expected_trace = ('Attempting optimistic preauth',
|
|
|
d738b9 |
- 'Processing preauth types: -123',
|
|
|
d738b9 |
- '/induced optimistic fail',
|
|
|
d738b9 |
- 'Sending unauthenticated request',
|
|
|
d738b9 |
- '/Additional pre-authentication required',
|
|
|
d738b9 |
- 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
- 'Processing preauth types:',
|
|
|
d738b9 |
- 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, -123',
|
|
|
d738b9 |
- 'Decrypted AS reply')
|
|
|
d738b9 |
+msgs = ('Attempting optimistic preauth',
|
|
|
d738b9 |
+ 'Processing preauth types: -123',
|
|
|
d738b9 |
+ '/induced optimistic fail',
|
|
|
d738b9 |
+ 'Sending unauthenticated request',
|
|
|
d738b9 |
+ '/Additional pre-authentication required',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'Processing preauth types:',
|
|
|
d738b9 |
+ 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'Produced preauth for next request: PA-FX-COOKIE (133), -123',
|
|
|
d738b9 |
+ 'Decrypted AS reply')
|
|
|
d738b9 |
realm.run(['./icred', '-o', '-123', '-X', 'fail_optimistic', realm.user_princ,
|
|
|
d738b9 |
password('user')], expected_msg='testval',
|
|
|
d738b9 |
- expected_trace=expected_trace)
|
|
|
d738b9 |
+ expected_trace=msgs)
|
|
|
d738b9 |
|
|
|
d738b9 |
# Test optimistic preauth failing on KDC, followed by successful preauth
|
|
|
d738b9 |
# using the same module.
|
|
|
d738b9 |
realm.run([kadminl, 'setstr', realm.user_princ, 'failopt', 'yes'])
|
|
|
d738b9 |
-expected_trace = ('Attempting optimistic preauth',
|
|
|
d738b9 |
- 'Processing preauth types: -123',
|
|
|
d738b9 |
- 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: -123',
|
|
|
d738b9 |
- '/Preauthentication failed',
|
|
|
d738b9 |
- 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
- 'Processing preauth types:',
|
|
|
d738b9 |
- 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, -123',
|
|
|
d738b9 |
- 'Decrypted AS reply')
|
|
|
d738b9 |
+msgs = ('Attempting optimistic preauth',
|
|
|
d738b9 |
+ 'Processing preauth types: -123',
|
|
|
d738b9 |
+ 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'Produced preauth for next request: -123',
|
|
|
d738b9 |
+ '/Preauthentication failed',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'Processing preauth types:',
|
|
|
d738b9 |
+ 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'Produced preauth for next request: PA-FX-COOKIE (133), -123',
|
|
|
d738b9 |
+ 'Decrypted AS reply')
|
|
|
d738b9 |
realm.run(['./icred', '-o', '-123', realm.user_princ, password('user')],
|
|
|
d738b9 |
- expected_msg='testval', expected_trace=expected_trace)
|
|
|
d738b9 |
+ expected_msg='testval', expected_trace=msgs)
|
|
|
d738b9 |
realm.run([kadminl, 'delstr', realm.user_princ, 'failopt'])
|
|
|
d738b9 |
|
|
|
d738b9 |
# Test KDC_ERR_MORE_PREAUTH_DATA_REQUIRED and secure cookies.
|
|
|
d738b9 |
realm.run([kadminl, 'setstr', realm.user_princ, '2rt', 'secondtrip'])
|
|
|
d738b9 |
-expected_trace = ('Sending unauthenticated request',
|
|
|
d738b9 |
- '/Additional pre-authentication required',
|
|
|
d738b9 |
- 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
- 'Processing preauth types:',
|
|
|
d738b9 |
- 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, -123',
|
|
|
d738b9 |
- '/More preauthentication data is required',
|
|
|
d738b9 |
- 'Continuing preauth mech -123',
|
|
|
d738b9 |
- 'Processing preauth types: -123, 133',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, -123',
|
|
|
d738b9 |
- 'Decrypted AS reply')
|
|
|
d738b9 |
+msgs = ('Sending unauthenticated request',
|
|
|
d738b9 |
+ '/Additional pre-authentication required',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'Processing preauth types:',
|
|
|
d738b9 |
+ 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'Produced preauth for next request: PA-FX-COOKIE (133), -123',
|
|
|
d738b9 |
+ '/More preauthentication data is required',
|
|
|
d738b9 |
+ 'Continuing preauth mech -123',
|
|
|
d738b9 |
+ 'Processing preauth types: -123, PA-FX-COOKIE (133)',
|
|
|
d738b9 |
+ 'Produced preauth for next request: PA-FX-COOKIE (133), -123',
|
|
|
d738b9 |
+ 'Decrypted AS reply')
|
|
|
d738b9 |
realm.run(['./icred', realm.user_princ, password('user')],
|
|
|
d738b9 |
- expected_msg='2rt: secondtrip', expected_trace=expected_trace)
|
|
|
d738b9 |
+ expected_msg='2rt: secondtrip', expected_trace=msgs)
|
|
|
d738b9 |
|
|
|
d738b9 |
# Test client-side failure after KDC_ERR_MORE_PREAUTH_DATA_REQUIRED,
|
|
|
d738b9 |
# falling back to encrypted timestamp.
|
|
|
d738b9 |
-expected_trace = ('Sending unauthenticated request',
|
|
|
d738b9 |
- '/Additional pre-authentication required',
|
|
|
d738b9 |
- 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
- 'Processing preauth types:',
|
|
|
d738b9 |
- 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, -123',
|
|
|
d738b9 |
- '/More preauthentication data is required',
|
|
|
d738b9 |
- 'Continuing preauth mech -123',
|
|
|
d738b9 |
- 'Processing preauth types: -123, 133',
|
|
|
d738b9 |
- '/induced 2rt fail',
|
|
|
d738b9 |
- 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
- 'Processing preauth types:',
|
|
|
d738b9 |
- 'Encrypted timestamp (for ',
|
|
|
d738b9 |
- 'module encrypted_timestamp (2) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, 2',
|
|
|
d738b9 |
- 'Decrypted AS reply')
|
|
|
d738b9 |
+msgs = ('Sending unauthenticated request',
|
|
|
d738b9 |
+ '/Additional pre-authentication required',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'Processing preauth types:',
|
|
|
d738b9 |
+ 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'Produced preauth for next request: PA-FX-COOKIE (133), -123',
|
|
|
d738b9 |
+ '/More preauthentication data is required',
|
|
|
d738b9 |
+ 'Continuing preauth mech -123',
|
|
|
d738b9 |
+ 'Processing preauth types: -123, PA-FX-COOKIE (133)',
|
|
|
d738b9 |
+ '/induced 2rt fail',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'Processing preauth types:',
|
|
|
d738b9 |
+ 'Encrypted timestamp (for ',
|
|
|
d738b9 |
+ 'module encrypted_timestamp (2) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'preauth for next request: PA-FX-COOKIE (133), PA-ENC-TIMESTAMP (2)',
|
|
|
d738b9 |
+ 'Decrypted AS reply')
|
|
|
d738b9 |
realm.run(['./icred', '-X', 'fail_2rt', realm.user_princ, password('user')],
|
|
|
d738b9 |
- expected_msg='2rt: secondtrip', expected_trace=expected_trace)
|
|
|
d738b9 |
+ expected_msg='2rt: secondtrip', expected_trace=msgs)
|
|
|
d738b9 |
|
|
|
d738b9 |
# Test KDC-side failure after KDC_ERR_MORE_PREAUTH_DATA_REQUIRED,
|
|
|
d738b9 |
# falling back to encrypted timestamp.
|
|
|
d738b9 |
realm.run([kadminl, 'setstr', realm.user_princ, 'fail2rt', 'yes'])
|
|
|
d738b9 |
-expected_trace = ('Sending unauthenticated request',
|
|
|
d738b9 |
- '/Additional pre-authentication required',
|
|
|
d738b9 |
- 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
- 'Processing preauth types:',
|
|
|
d738b9 |
- 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, -123',
|
|
|
d738b9 |
- '/More preauthentication data is required',
|
|
|
d738b9 |
- 'Continuing preauth mech -123',
|
|
|
d738b9 |
- 'Processing preauth types: -123, 133',
|
|
|
d738b9 |
- 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, -123',
|
|
|
d738b9 |
- '/Preauthentication failed',
|
|
|
d738b9 |
- 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
- 'Processing preauth types:',
|
|
|
d738b9 |
- 'Encrypted timestamp (for ',
|
|
|
d738b9 |
- 'module encrypted_timestamp (2) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, 2',
|
|
|
d738b9 |
- 'Decrypted AS reply')
|
|
|
d738b9 |
+msgs = ('Sending unauthenticated request',
|
|
|
d738b9 |
+ '/Additional pre-authentication required',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'Processing preauth types:',
|
|
|
d738b9 |
+ 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'Produced preauth for next request: PA-FX-COOKIE (133), -123',
|
|
|
d738b9 |
+ '/More preauthentication data is required',
|
|
|
d738b9 |
+ 'Continuing preauth mech -123',
|
|
|
d738b9 |
+ 'Processing preauth types: -123, PA-FX-COOKIE (133)',
|
|
|
d738b9 |
+ 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'Produced preauth for next request: PA-FX-COOKIE (133), -123',
|
|
|
d738b9 |
+ '/Preauthentication failed',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'Processing preauth types:',
|
|
|
d738b9 |
+ 'Encrypted timestamp (for ',
|
|
|
d738b9 |
+ 'module encrypted_timestamp (2) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'preauth for next request: PA-FX-COOKIE (133), PA-ENC-TIMESTAMP (2)',
|
|
|
d738b9 |
+ 'Decrypted AS reply')
|
|
|
d738b9 |
realm.run(['./icred', realm.user_princ, password('user')],
|
|
|
d738b9 |
- expected_msg='2rt: secondtrip', expected_trace=expected_trace)
|
|
|
d738b9 |
+ expected_msg='2rt: secondtrip', expected_trace=msgs)
|
|
|
d738b9 |
realm.run([kadminl, 'delstr', realm.user_princ, 'fail2rt'])
|
|
|
d738b9 |
|
|
|
d738b9 |
# Test tryagain flow by inducing a KDC_ERR_ENCTYPE_NOSUPP error on the KDC.
|
|
|
d738b9 |
realm.run([kadminl, 'setstr', realm.user_princ, 'err', 'testagain'])
|
|
|
d738b9 |
-expected_trace = ('Sending unauthenticated request',
|
|
|
d738b9 |
- '/Additional pre-authentication required',
|
|
|
d738b9 |
- 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
- 'Processing preauth types:',
|
|
|
d738b9 |
- 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, -123',
|
|
|
d738b9 |
- '/KDC has no support for encryption type',
|
|
|
d738b9 |
- 'Recovering from KDC error 14 using preauth mech -123',
|
|
|
d738b9 |
- 'Preauth tryagain input types (-123): -123, 133',
|
|
|
d738b9 |
- 'Preauth module test (-123) tryagain returned: 0/Success',
|
|
|
d738b9 |
- 'Followup preauth for next request: -123, 133',
|
|
|
d738b9 |
- 'Decrypted AS reply')
|
|
|
d738b9 |
+msgs = ('Sending unauthenticated request',
|
|
|
d738b9 |
+ '/Additional pre-authentication required',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'Processing preauth types:',
|
|
|
d738b9 |
+ 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'Produced preauth for next request: PA-FX-COOKIE (133), -123',
|
|
|
d738b9 |
+ '/KDC has no support for encryption type',
|
|
|
d738b9 |
+ 'Recovering from KDC error 14 using preauth mech -123',
|
|
|
d738b9 |
+ 'Preauth tryagain input types (-123): -123, PA-FX-COOKIE (133)',
|
|
|
d738b9 |
+ 'Preauth module test (-123) tryagain returned: 0/Success',
|
|
|
d738b9 |
+ 'Followup preauth for next request: -123, PA-FX-COOKIE (133)',
|
|
|
d738b9 |
+ 'Decrypted AS reply')
|
|
|
d738b9 |
realm.run(['./icred', realm.user_princ, password('user')],
|
|
|
d738b9 |
- expected_msg='tryagain: testagain', expected_trace=expected_trace)
|
|
|
d738b9 |
+ expected_msg='tryagain: testagain', expected_trace=msgs)
|
|
|
d738b9 |
|
|
|
d738b9 |
# Test a client-side tryagain failure, falling back to encrypted
|
|
|
d738b9 |
# timestamp.
|
|
|
d738b9 |
-expected_trace = ('Sending unauthenticated request',
|
|
|
d738b9 |
- '/Additional pre-authentication required',
|
|
|
d738b9 |
- 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
- 'Processing preauth types:',
|
|
|
d738b9 |
- 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, -123',
|
|
|
d738b9 |
- '/KDC has no support for encryption type',
|
|
|
d738b9 |
- 'Recovering from KDC error 14 using preauth mech -123',
|
|
|
d738b9 |
- 'Preauth tryagain input types (-123): -123, 133',
|
|
|
d738b9 |
- '/induced tryagain fail',
|
|
|
d738b9 |
- 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
- 'Processing preauth types:',
|
|
|
d738b9 |
- 'Encrypted timestamp (for ',
|
|
|
d738b9 |
- 'module encrypted_timestamp (2) (real) returned: 0/Success',
|
|
|
d738b9 |
- 'Produced preauth for next request: 133, 2',
|
|
|
d738b9 |
- 'Decrypted AS reply')
|
|
|
d738b9 |
+msgs = ('Sending unauthenticated request',
|
|
|
d738b9 |
+ '/Additional pre-authentication required',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'Processing preauth types:',
|
|
|
d738b9 |
+ 'Preauth module test (-123) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'Produced preauth for next request: PA-FX-COOKIE (133), -123',
|
|
|
d738b9 |
+ '/KDC has no support for encryption type',
|
|
|
d738b9 |
+ 'Recovering from KDC error 14 using preauth mech -123',
|
|
|
d738b9 |
+ 'Preauth tryagain input types (-123): -123, PA-FX-COOKIE (133)',
|
|
|
d738b9 |
+ '/induced tryagain fail',
|
|
|
d738b9 |
+ 'Preauthenticating using KDC method data',
|
|
|
d738b9 |
+ 'Processing preauth types:',
|
|
|
d738b9 |
+ 'Encrypted timestamp (for ',
|
|
|
d738b9 |
+ 'module encrypted_timestamp (2) (real) returned: 0/Success',
|
|
|
d738b9 |
+ 'preauth for next request: PA-FX-COOKIE (133), PA-ENC-TIMESTAMP (2)',
|
|
|
d738b9 |
+ 'Decrypted AS reply')
|
|
|
d738b9 |
realm.run(['./icred', '-X', 'fail_tryagain', realm.user_princ,
|
|
|
d738b9 |
- password('user')], expected_trace=expected_trace)
|
|
|
d738b9 |
+ password('user')], expected_trace=msgs)
|
|
|
d738b9 |
|
|
|
d738b9 |
# Test that multiple stepwise initial creds operations can be
|
|
|
d738b9 |
# performed with the same krb5_context, with proper tracking of
|