Skip to content

Certificate validation routine fails with NotTimeValid when changing time zone on Linux while client app is still running #109039

@lukegeor

Description

@lukegeor

Description

While a .Net application is running, if you change the system time zone ahead (i.e. if your current time zone is US Pacific time and you change the system time zone to US Eastern time), if your server has a newly-created TLS certificate, if the age of the certificate (not valid before date) is smaller than the amount of time you changed your time zone, certificate validation fails with a NotTimeValid error in the certificate chain.

This only occurs on Linux. I tested on Oracle Linux 8. I'm using .Net SDK 8.0.303 and runtime 8.0.7.

Reproduction Steps

See https://github.com/lukegeor/HttpsValidationTimeZone for the full demo project. A simplified explanation follows.

  1. Create a new TLS cert where the not valid before date is now.
  2. Launch an HTTPS server that uses that certificate.
  3. Launch a HTTPS client app that repeatedly connects to this server. An important detail is that the HTTP client should be configured to re-establish its TLS connection on each request. The validation occurs during the TLS handshake, and if you re-use the HTTP connection, that handshake and thus the validation does not re-occur.
  4. Change your system time zone ahead (east) by at least the age of the TLS cert.

Expected behavior

HttpClient certificate validation should succeed (or at least not fail due to time validity).

Actual behavior

HttpClient validation fails with NotTimeValid as the status of the chain element.

Regression?

No response

Known Workarounds

No response

Configuration

This only occurs on Linux. I tested on Oracle Linux 8. I'm using .Net SDK 8.0.303 and runtime 8.0.7. x64 CPU architecture. OpenSSL openssl-1.1.1k-12.el8_9.x86_64. I don't know whether this is specific to this configuration. I did not test Ubuntu, nor did I test any other CPU architecture.

Other information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions