Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spnego_gssapi: implement TLS channel bindings for openssl #13098

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Foorack
Copy link

@Foorack Foorack commented Mar 11, 2024

Channel Bindings are used to tie the session context to a specific TLS channel. This is to provide additional proof of valid identity, mitigating authentication relay attacks.

Major web servers have the ability to require (None/Accept/Require) GSSAPI channel binding, rendering Curl unable to connect to such websites unless support for channel bindings is implemented.

IIS calls this feature Extended Protection (EPA), which is used in Enterprise environments using Kerberos for authentication.

This change require krb5 >= 1.19, otherwise channel bindings won't be forwarded through SPNEGO.

@Foorack
Copy link
Author

Foorack commented Mar 12, 2024

"Linux / hyper" CI failed during install hyper step, due to compile error in Hyper and was fixed in hyperium/hyper@4d0c184

Comment on lines 4817 to 5193
algo_type = EVP_sha256();
}
else {
algo_type = EVP_get_digestbynid(algo_nid);
if(!algo_type) {
algo_name = OBJ_nid2sn(algo_nid);
failf(data, "Could not find digest algorithm %s (NID %d)",
algo_name ? algo_name : "(null)", algo_nid);
return CURLE_SSL_INVALIDCERTSTATUS;
}
}

if(!X509_digest(cert, algo_type, buf, &length)) {
failf(data, "X509_digest() failed");
return CURLE_SSL_INVALIDCERTSTATUS;
}

*binding = malloc(sizeof(prefix) - 1 + length);
if(!*binding)
return CURLE_OUT_OF_MEMORY;
memcpy(*binding, prefix, sizeof(prefix) - 1);
memcpy(*binding + sizeof(prefix) - 1, buf, length);
*len = sizeof(prefix) - 1 + length;

return CURLE_OK;
#else
/* No X509_get_signature_nid support */
(void)data; /* unused */
(void)sockindex; /* unused */
*binding = NULL;
*len = 0;
return CURLE_OK;
#endif
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to avoid APIs that perform implicit fetching?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @DemiMarie! Sorry, but what do you mean by "implicit fetching"? Do you have an alternative API in mind?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @DemiMarie 👋 Please let me know if there is any outstanding requested changes on this; either if you have any alternative API's in mind, or if I can mark this conversation as resolved.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

“Implicit fetching” means calls like EVP_sha256(), as opposed to explicitly looking up the algorithm in a provider.

@Foorack Foorack force-pushed the openssl-spnego-channel-binding branch from 7acadc0 to 5b8c0eb Compare April 23, 2024 13:11
@Foorack
Copy link
Author

Foorack commented Apr 23, 2024

Rebased to bring PR up-to-date with master due to time passed.

Minor changes

  • ossl_ssl_backend_data had in upstream been renamed to ossl_ctx, and ->handle to ->ssl
  • changed u_char* to unsigned char* to be in line with rest of project

@Foorack Foorack force-pushed the openssl-spnego-channel-binding branch from 43c7a44 to d916f49 Compare April 23, 2024 19:41
SGA-max-faxalv and others added 5 commits April 24, 2024 10:24
Channel Bindings are used to tie the session context to a specific
TLS channel. This is to provide additional proof of valid identity,
mitigating authentication relay attacks.

Major web servers have the ability to require (None/Accept/Require)
GSSAPI channel binding, rendering Curl unable to connect to such
websites unless support for channel bindings is implemented.

IIS calls this feature Extended Protection (EPA), which is used in
Enterprise environments using Kerberos for authentication.

This change require krb5 >= 1.19, otherwise channel bindings won't be
forwarded through SPNEGO.

Co-Authored-By: Steffen Kieß <[email protected]>
@Foorack Foorack force-pushed the openssl-spnego-channel-binding branch from d916f49 to d776382 Compare April 24, 2024 08:24
return CURLE_SSL_INVALIDCERTSTATUS;
}
}

#if OPENSSL_VERSION_NUMBER >= 0x30000000L
algo_type = EVP_MD_fetch(NULL, algo_name, NULL);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s best to cache the result of this, for performance reasons.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants