Connection problems using kerberos against EMC Celerra servers
Subsystems (2)
EMC Celerra server reject session setups with RPC_NT_INVALID_BINDING (0xc0020003) if the authenticator checksum uses CKSUMTYPE_HMAC_MD5(-138).
The correct fix for this is to use the GSSAPI checksum, see http://tools.ietf.org/html/rfc4121.
See also https://bugzilla.samba.org/show_bug.cgi?id=7890
metze
A message that is not in the archive (sent off-list or not yet received): 1293525693-11562-1-git-send-email-metze-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org
PATCH 1/3 cifs.upcall: fix memory and call krb5_auth_con_free()
metze
--- cifs.upcall.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-)
cifs.upcall.c +3 -1
@@ -313,13 +313,15 @@ cifs_krb5_get_req(const char *principal, const char *ccname,if (ret) {syslog (LOG_DEBUG ,"%s: unable to get session key for %s" , __func__, principal); - goto out_free_creds; + goto out_free_auth; } *mechtoken =data_blob (apreq_pkt.data, apreq_pkt.length); *sess_key =data_blob (KRB5_KEY_DATA (tokb),KRB5_KEY_LENGTH (tokb));krb5_free_keyblock (context, tokb); +out_free_auth: +krb5_auth_con_free (context, auth_context); out_free_creds:krb5_free_creds (context, out_creds); out_free_principal:
Signature · 1 line
1.7.0.4
PATCH 2/3 cifs.upcall: use krb5_auth_con_init() to create an explicit auth_context
In reply to a message not in the archivemetze
--- cifs.upcall.c | 14 ++++++++++++-- 1 files changed, 12 insertions(+), 2 deletions(-)
cifs.upcall.c +12 -2
@@ -299,14 +299,24 @@ cifs_krb5_get_req(const char *principal, const char *ccname, goto out_free_principal; } - apreq_pkt.data =NULL ; in_data.length =0 ; + in_data.data =NULL ; + + ret =krb5_auth_con_init (context, &auth_context); +if (ret) { +syslog (LOG_DEBUG ,"%s: unable to create auth_context: %d" , + __func__, ret); + goto out_free_creds; + } + + apreq_pkt.length =0 ; + apreq_pkt.data =NULL ; ret =krb5_mk_req_extended (context, &auth_context,AP_OPTS_USE_SUBKEY , &in_data, out_creds, &apreq_pkt);if (ret) {syslog (LOG_DEBUG ,"%s: unable to make AP-REQ for %s" , __func__, principal); - goto out_free_creds; + goto out_free_auth; } ret =krb5_auth_con_getsendsubkey (context, auth_context, &tokb);
Signature · 1 line
1.7.0.4
PATCH 3/3 cifs.upcall: use krb5_auth_con_set_req_cksumtype() and pass a GSSAPI checksum (bug #7890)
In reply to a message not in the archiveSome closed source SMB servers doesn't support all checksum types, so we should try to match windows clients.
This is almost the same logic which is used by Samba.
metze
--- cifs.upcall.c | 40 ++++++++++++++++++++++++++++++++++++++++ configure.ac | 1 + 2 files changed, 41 insertions(+), 0 deletions(-)
cifs.upcall.c +40 -0
@@ -261,6 +261,9 @@ cifs_krb5_get_req(const char *principal, const char *ccname,krb5_creds in_creds, *out_creds;krb5_data apreq_pkt, in_data;krb5_auth_context auth_context =NULL ; +#if defined(HAVE_KRB5_AUTH_CON_SETADDRS ) && defined(HAVE_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE ) +static const uint8_t gss_cksum[24 ] = {0x10 ,0x00 ,/* ... */ }; +#endif ret =krb5_init_context (&context);if (ret) {
@@ -309,6 +312,43 @@ cifs_krb5_get_req(const char *principal, const char *ccname, goto out_free_creds; } +#if defined(HAVE_KRB5_AUTH_CON_SETADDRS ) && defined(HAVE_KRB5_AUTH_CON_SET_REQ_CKSUMTYPE ) +/* Ensure we will get an addressless ticket. */ + ret =krb5_auth_con_setaddrs (context, auth_context,NULL ,NULL ); +if (ret) { +syslog (LOG_DEBUG ,"%s: unable to set NULL addrs: %d" , + __func__, ret); + goto out_free_auth; + } + +/* +* Create a GSSAPI checksum (0x8003), see RFC 4121. +* +* The current layout is +* +* 0x10, 0x00, 0x00, 0x00 - length = 16 +* 0x00, 0x00, 0x00, 0x00 - channel binding info - 16 zero bytes +* 0x00, 0x00, 0x00, 0x00 +* 0x00, 0x00, 0x00, 0x00 +* 0x00, 0x00, 0x00, 0x00 +* 0x00, 0x00, 0x00, 0x00 - flags +* +* GSS_C_NO_CHANNEL_BINDINGS means 16 zero bytes, +* this is needed to work against some closed source +* SMB servers. +* +* See https://bugzilla.samba.org/show_bug.cgi?id=7890 +*/ + in_data.data =discard_const_p (char, gss_cksum); + in_data.length =24 ; + ret =krb5_auth_con_set_req_cksumtype (context, auth_context,0x8003 ); +if (ret) { +syslog (LOG_DEBUG ,"%s: unable to set 0x8003 checksum" , + __func__); + goto out_free_auth; + } +#endif + apreq_pkt.length =0 ; apreq_pkt.data =NULL ; ret = krb5_mk_req_extended(context, &auth_context, AP_OPTS_USE_SUBKEY,
configure.ac +1 -0
@@ -133,6 +133,7 @@ fi # non-critical functions (we have workarounds for these) if test $enable_cifsupcall != "no"; then AC_CHECK_FUNCS([krb5_principal_get_realm krb5_free_unparsed_name]) + AC_CHECK_FUNCS([krb5_auth_con_setaddrs krb5_auth_con_set_req_cksumtype]) fi LIBS=$cu_saved_libs
Signature · 1 line
1.7.0.4
Quoted 11 lines · On Tue, 28 Dec 2010 09:41:30 +0100 Stefan Metzmacher…
EMC Celerra server reject session setups with
RPC_NT_INVALID_BINDING(0xc0020003) if the authenticator checksum usesCKSUMTYPE_HMAC_MD5(-138).The correct fix for this is to use the GSSAPI checksum, see http://tools.ietf.org/html/rfc4121.
See also https://bugzilla.samba.org/show_bug.cgi?id=7890
metze
Thanks Metze,
The patches look good to me at first glance. I'll plan to go over them in detail in the next few days, and commit them unless someone raises objections.
Cheers,
Signature · 1 line
Jeff Layton <[email protected]>
Quoted 11 lines · On Tue, 28 Dec 2010 09:41:30 +0100 Stefan Metzmacher…
EMC Celerra server reject session setups with
RPC_NT_INVALID_BINDING(0xc0020003) if the authenticator checksum usesCKSUMTYPE_HMAC_MD5(-138).The correct fix for this is to use the GSSAPI checksum, see http://tools.ietf.org/html/rfc4121.
See also https://bugzilla.samba.org/show_bug.cgi?id=7890
metze
These tested out fine for me. All 3 patches pushed to cifs-utils master branch. They should make the 4.8 release, which I'll plan to put out once I coordinate some manpage updates with Steve's plans for 2.6.38.
Thanks!
Signature · 1 line
Jeff Layton <[email protected]>