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

Delayed client certificate #54692

Merged
merged 34 commits into from
Jul 13, 2021
Merged

Delayed client certificate #54692

merged 34 commits into from
Jul 13, 2021

Conversation

aik-jahoda
Copy link
Contributor

@aik-jahoda aik-jahoda commented Jun 24, 2021

Ads support for retrieve client certificate on secure connection.

  • Add support for linux
  • No support for mac
  • The Tls 1.3 PHA is not implemented in this PR
  • Currently works on the OpenSSL 1.1 and not 1.0

Contributes to #49346

@dotnet-issue-labeler
Copy link

Note regarding the new-api-needs-documentation label:

This serves as a reminder for when your PR is modifying a ref *.cs file and adding/modifying public APIs, to please make sure the API implementation in the src *.cs file is documented with triple slash comments, so the PR reviewers can sign off that change.

@ghost
Copy link

ghost commented Jun 24, 2021

Tagging subscribers to this area: @dotnet/ncl, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details
Author: aik-jahoda
Assignees: -
Labels:

area-System.Net.Security, new-api-needs-documentation

Milestone: -

@aik-jahoda aik-jahoda requested a review from wfurt June 24, 2021 16:15
@wfurt
Copy link
Member

wfurt commented Jun 26, 2021

I see lot of test failures when running locally on Windows 10 box.

@aik-jahoda aik-jahoda marked this pull request as ready for review June 29, 2021 11:32
@aik-jahoda
Copy link
Contributor Author

/azp run runtime-libraries-coreclr outerloop

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@aik-jahoda
Copy link
Contributor Author

/azp run runtime

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@aik-jahoda aik-jahoda requested a review from a team June 29, 2021 19:41
@aik-jahoda
Copy link
Contributor Author

cc @geoffkizer

// Issue empty read to get renegotiation going.
await ReadAsyncInternal(adapter, Memory<byte>.Empty, renegotiation: true).ConfigureAwait(false);
_handshakeBuffer = new ArrayBuffer(InitialHandshakeBufferSize);
ProtocolToken message = null!;
Copy link
Contributor

Choose a reason for hiding this comment

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

This seems similar to the existing logic in ForceAuthenticationAsync. Can we share the logic so it isn't duplicated?

I also wonder about some cases that ForceAuthenticationAsync is handling which aren't handled here, like transferring any additional buffered read data to the _internalBuffer.

Copy link
Member

Choose a reason for hiding this comment

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

I added the missing handling of _internalBuffer. I agree about the similarity but I would like to let re-factoring for and consolidation for follow up work so we can get the base functionality in.

Copy link
Contributor

@geoffkizer geoffkizer left a comment

Choose a reason for hiding this comment

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

Feedback above

@wfurt
Copy link
Member

wfurt commented Jul 9, 2021

contributes to #49346

I addressed all the functional feedback and this is ready for another pass @geoffkizer.
I'm proposing to hold on the refactoring/consolidation after the feature cutoff and after @aik-jahoda get back.

Currently this will work only with OpenSSL 1.1.1 and older versions have some problems.
We will probably investigate before 6.0 ships and I'm leaving #49346 open for now.

@aik-jahoda
Copy link
Contributor Author

@wfurt thanks for hand over, the changes LGTM

@karelz
Copy link
Member

karelz commented Jul 12, 2021

@wfurt we should create new tracking issue/bug for lower OpenSSL versions ...

@geoffkizer will you be able to finish code review to hit the checkin date tomorrow?

Copy link
Member

@wfurt wfurt left a comment

Choose a reason for hiding this comment

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

Core parts looks ok to.

@wfurt
Copy link
Member

wfurt commented Jul 13, 2021

We still have #49346 open so we can use it track the progress. I think we can investigate older version little bit more and either fix it if easy, leave the issue open or create new one or throw PNSP.

@aik-jahoda
Copy link
Contributor Author

aik-jahoda commented Jul 27, 2021

Tested following configuration:

  • .net SslStream authenticated as server - openssl 1.0.0t.
  • openssl s_clients (non .net): OpenSSL 1.0.0t, OpenSSL 1.1.1k, OpenSSL 3.0.0-beta1
    The above configuration works as expected.

I think we can investigate older version little bit more and either fix it if easy, leave the issue open or create new one or throw PNSP.

SslStream authenticated as client was without change, throwing PNSE (when using openssl version smaller than 1.1.1) would

  1. be breaking change
  2. not nice as the exception would be triggered by server (when requesting certificate) and would depends on server. Instead client shouldn't ignore server HELLO request.

@ghost ghost locked as resolved and limited conversation to collaborators Aug 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants