Skip to content

Private.InternalDiagnostics.System.Net.Security.RemoteCertificateError TraceEvent Does Not Include the Underline TLS Error from macOS #89859

Open
@TingluoHuang

Description

@TingluoHuang

Description

#1513 supposes to help us identify underline TLS error when macOS verify server TLS cert.

I have a customer on macOS getting RemoteCertificateNameMismatch when making request to https://api.github.com.

The customer has proxy in their network to decrypt TLS traffic with self-signed CAs.

2023-08-02T13:51:34.9513820Z [START Private.InternalDiagnostics.System.Net.Security - ErrorMessage]
2023-08-02T13:51:34.9513850Z SafeDeleteSslContext#3038911
2023-08-02T13:51:34.9513850Z VerifyCertificateProperties
2023-08-02T13:51:34.9513860Z Cert name validation for 'api.github.com' failed with status '0'
2023-08-02T13:51:34.9513860Z [END Private.InternalDiagnostics.System.Net.Security - ErrorMessage]
2023-08-02T13:51:34.9515520Z [START Private.InternalDiagnostics.System.Net.Security - RemoteCertificateError]
2023-08-02T13:51:34.9515540Z 66166301
2023-08-02T13:51:34.9515550Z Remote certificate has errors:
2023-08-02T13:51:34.9515550Z [END Private.InternalDiagnostics.System.Net.Security - RemoteCertificateError]
2023-08-02T13:51:34.9515590Z [START Private.InternalDiagnostics.System.Net.Security - RemoteCertificateError]
2023-08-02T13:51:34.9515640Z 66166301
2023-08-02T13:51:34.9515640Z Certificate name mismatch.
2023-08-02T13:51:34.9515640Z [END Private.InternalDiagnostics.System.Net.Security - RemoteCertificateError]
2023-08-02T13:51:34.9525100Z [START System.Net.Security - HandshakeFailed]
2023-08-02T13:51:34.9525130Z False
2023-08-02T13:51:34.9525190Z 124.1869
2023-08-02T13:51:34.9525190Z The remote certificate is invalid according to the validation procedure: RemoteCertificateNameMismatch
2023-08-02T13:51:34.9525200Z [END System.Net.Security - HandshakeFailed]

I checked the self-signed cert, the CN seems match:

2023-08-02T13:51:34.9422770Z [Subject]
2023-08-02T13:51:34.9422770Z   CN=*.github.com, O="GitHub, Inc.", L=San Francisco, S=California, C=US
2023-08-02T13:51:34.9422770Z   Simple Name: *.github.com
2023-08-02T13:51:34.9422780Z   DNS Name: *.github.com

I think the issue might be caused by the customer's CA doesn't meet Apple requirement for TLS CA cert.
The intermediate CA doesn't have Server Authentication ( 1.3.6.1.5.5.7.3.1 )
Similar to #666

It would be nice that we can get some status code to tell us the issue with #1513
But right now we only get Cert name validation for 'api.github.com' failed with status '0', so i can't confirm the problem.

I am wondering whether #1513 can properly handle the case when there are a CA chain, ex: ROOT CA->Intermediate CA-> TLS cert

Reproduction Steps

N/A

Expected behavior

The trace message give back a non-zero code, so we can check Apple doc to match the error code.

ex: Cert name validation for 'api.github.com' failed with status '-2147408889'

Actual behavior

Cert name validation for 'api.github.com' failed with status '0'

Regression?

No response

Known Workarounds

No response

Configuration

Dotnet SDK: 6.0.405
OS: macOS 13.5

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-System.Net.SecurityenhancementProduct code improvement that does NOT require public API changes/additions

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions