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

lib/vtls/openssl.c Outdated Show resolved Hide resolved
@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 2 times, most recently 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.

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! Thank you for continued review.
Where would it be best to cache this? I am honestly not too familiar with this level of curl internals. I am primarily working this as a continuation of the great work done by @steffe-kiess (#7196) to add support for SPNEGO GSSAPI, as it is something we critically need from command-line usage due to some web servers now enforcing this. Any pointer in right direction of caching architecture would be greatly appreciated.

I have found little material online regarding the performance impact of repeatedly calling EVP_MD_fetch too much. The explicit fetching will only be done once per connection, during initial connect, so for most cases this function will only be called once. This is a also a completely new feature, as curl has been unable to ever connect to servers requiring secure channel binding. Therefore wondering if caching is something which could be done in a future patch if it turns out to be too much work.

Finally, regarding Explicit Fetching, I have not found any other usage of EVP_*_fetch in the entire curl source code... All other places use EVP_sha256() and similar implicit functions. I agree it could be a good idea to support explicit fetching, but I'd ideally not want this change to be a testing ground for this migration. Rather reverting back to the implicit-only implementation and then adding OpenSSL 3.x Explicit Fetching support in a separate PR as it touches many more areas outside of this scope. Thoughts?

Choose a reason for hiding this comment

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

Yup, separate PR.

Copy link
Author

Choose a reason for hiding this comment

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

OK! Do you wanna do explicit+caching in a separate PR, or only caching?

Choose a reason for hiding this comment

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

I’m not a curl developer, just someone who noticed this PR while reading about the mess that OpenSSL 3.x is causing for HAProxy.

SGA-max-faxalv and others added 6 commits April 30, 2024 16:27
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ß <947515+steffen-kiess@users.noreply.github.com>
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