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

Non-HTTP TLS connection middleware #12809

Open
ReubenBond opened this issue Aug 1, 2019 · 7 comments
Open

Non-HTTP TLS connection middleware #12809

ReubenBond opened this issue Aug 1, 2019 · 7 comments
Labels
affected-few This issue impacts only small number of customers area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions 🥌 Bedrock enhancement This issue represents an ask for new feature or an enhancement to an existing one help candidate Indicates that the issues may be a good fit for community to help with. Requires work from eng. team severity-nice-to-have This label is used by an internal tool
Milestone

Comments

@ReubenBond
Copy link
Member

Are there any plans for a general-purpose TLS connection middleware? I'm looking to add TLS support to Orleans (which uses sockets). I saw #11109, but it's specific to HTTPS.

(Related to Bedrock / #4772)

@analogrelay
Copy link
Contributor

We don't have a plan as of yet. It's certainly something we could do if there was value in it. Ideally we'd also re-base our Https logic on top of a more general-purpose TLS middleware. From what I can tell, the main thing coupling the existing middleware to HTTPS is ALPN support. We could generalize the middleware so that instead of taking options specifying the HTTP version, it could just take ALPN protocols to negotiate.

@analogrelay analogrelay added this to the Backlog milestone Aug 6, 2019
@analogrelay analogrelay added 5.0-candidate help wanted Up for grabs. We would accept a PR to help resolve this issue labels Aug 6, 2019
@analogrelay
Copy link
Contributor

I think we can achieve this by refactoring the (internal 🎉) HttpsConnectionMiddleware like so:

  • Rename to TlsConnectionMiddleware and refactor to use ALPN-specific options with no HTTP stuff
  • Add a UseTls extension method and configuration.
  • Keep UseHttps extension method and HttpsConnectionAdaptorOptions and have them configure the TlsConnectionMiddleware

@analogrelay
Copy link
Contributor

@ReubenBond if you're passionate and excited, we'd take a PR. Otherwise we'll put it in our planning for 5.0 and see where it shakes out.

@ReubenBond
Copy link
Member Author

I took a quick stab at the first point (rename, refactor), pulling the bits into our repo. We're targeting netstandard2.0 right now & there're are a bunch of issues (lack of IAsyncDisposable & PipeWriter.Create(Stream, ...), among other things). I spoke with @sergeybykov earlier and we loosely agreed on the following w.r.t our Bedrock + TLS support:

  • Upgrade orleans/master to use the packages which we expect to GA alongside .NET Core 3.0 (eg, System.IO.Pipelines 4.6.0) - this means tying our 3.0 release until after Sept 23rd when .NET Core 3.0 GAs.
  • Exposing connection middleware configuration so that users can insert custom transports / middleware (rather than restricting them to the inbuilt socket transports)
  • Deleting most of our internal fork of Bedrock & related Kestrel pieces & running on public bedrock bits
  • Finally, creating a (hopefully temporary) separate package containing a TlsConnectionMiddleware which can target netcoreapp3.0 if needed - I assume (perhaps incorrectly) that the Stream change to implement IAsyncDisposable will not be made available on netstandard2.0 / .NET Framework in general.

After your above comments we may need to update our thinking, unless someone else in the community is available to follow your steps for a general-purpose TlsConnectionMiddleware.

@davidfowl
Copy link
Member

Putting this in 5.0

@ReubenBond
Copy link
Member Author

I've opened a PR on Orleans which adds a generic middleware (+ Orleans-specific configuration helpers) which I would like feedback on: dotnet/orleans#6035

It's based on the HTTPS middleware from ASP.NET Core but also adds support for client connections (in addition to the HTTPS middleware's support for server connections).

Ideally we can extract this & upstream it for 5.0 once it's polished and stable.

@analogrelay analogrelay modified the milestones: 5.0.0-preview1, Backlog Mar 11, 2020
@jkotalik jkotalik added affected-few This issue impacts only small number of customers enhancement This issue represents an ask for new feature or an enhancement to an existing one severity-nice-to-have This label is used by an internal tool labels Nov 12, 2020 — with ASP.NET Core Issue Ranking
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 2, 2023
@mkArtakMSFT mkArtakMSFT added help candidate Indicates that the issues may be a good fit for community to help with. Requires work from eng. team and removed help wanted Up for grabs. We would accept a PR to help resolve this issue labels Oct 28, 2023
@zeinali0
Copy link

Any new update for this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affected-few This issue impacts only small number of customers area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions 🥌 Bedrock enhancement This issue represents an ask for new feature or an enhancement to an existing one help candidate Indicates that the issues may be a good fit for community to help with. Requires work from eng. team severity-nice-to-have This label is used by an internal tool
Projects
None yet
Development

No branches or pull requests

8 participants