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

add initial drop of TLS parser #262

Merged
merged 6 commits into from
Jul 2, 2020
Merged

Conversation

wfurt
Copy link
Member

@wfurt wfurt commented Jun 24, 2020

this is port of parser from runtime with minimal changes to fit and build.

I think the biggest issue is the license.
The original code was touched by me, @krwq and tests by @stephentoub.
With that, I think there are no external contributors so it is OK to publish fork under new license. to be consistent with rest of the repo.

Alternatively we can preserve original .NET foundation license and release reverse-proxy under dual license.

Once this is resolved, I'll update this fork with missing features.

cc: @davidsh @stephentoub @krwq @samsp-msft @Tratcher @halter73

@Tratcher
Copy link
Member

This should be added to a sample. Something simple that checks the SNI value and disallows old TLS versions. Likely here:

.ConfigureWebHostDefaults(webBuilder =>

@Tratcher
Copy link
Member

Once this is resolved, I'll update this fork with missing features.

Does another copy of this code exist in runtime? What's the plan to keep them in sync? I have a bot we can use if the source files are expected to be identical.

Copy link
Contributor

@alnikola alnikola left a comment

Choose a reason for hiding this comment

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

Style-related comments.

src/ReverseProxy/Utilities/TlsFrameHelper.cs Outdated Show resolved Hide resolved
@wfurt
Copy link
Member Author

wfurt commented Jun 24, 2020

Does another copy of this code exist in runtime? What's the plan to keep them in sync? I have a bot we can use if the source files are expected to be identical.

Yes, there is copy here and it is primarily used for diagnostic.

My current plan is to let them diverge as I think the use case is different. For example, there is no need for ReadOnlySequence or detailed ALPN processing. So I expect new features/functions here while runtime would stay simple as it is now. If there are bugs in parsing or if there are new TLS versions needing updates, we can revisit this again. The SNI code existed for 2years without any additional change.

@wfurt
Copy link
Member Author

wfurt commented Jun 25, 2020

This should be added to a sample. Something simple that checks the SNI value and disallows old TLS versions.

I want to do little bit more work before hooking in. And I wanted to keep this one as close to the original so it is easier to track changes.

@wfurt
Copy link
Member Author

wfurt commented Jun 25, 2020

I moved visibility back to internal per our off-line discussion. I was also wondering about few enums outside of the TlsFrameHelper class. In runtime they lived in System.Net.Security namespace and they were used in few other places. But I'm not sure if Microsoft.ReverseProxy.Utilities is right home for them here. This can be also updated later e.g. land the migration and improve it over time.

cc: @davidfowl for any additional thought.

@Tratcher
Copy link
Member

Which enums?

@wfurt
Copy link
Member Author

wfurt commented Jun 25, 2020

TlsContentType and TlsHandshakeType for example. (there are few more)

@wfurt
Copy link
Member Author

wfurt commented Jun 25, 2020

For SslStream, thy represent the values from spec so I left them outside of the parser.

@Tratcher
Copy link
Member

They seem file where you have them for now, it doesn't matter much while they're internal. We can revisit if we decide they should be public.

@Tratcher
Copy link
Member

Unless you want to make a Utilities.Tls namespace for all of this?

@wfurt
Copy link
Member Author

wfurt commented Jun 28, 2020

I fixed up the copyright and added reference per off-line discussion. I think this should be good enough for initial drop.

Copy link
Member

@halter73 halter73 left a comment

Choose a reason for hiding this comment

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

I agree it would be nice to put these in a Utilities.Tls namespace.

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

Successfully merging this pull request may close these issues.

4 participants