Skip to content

ESP32 after a few days starts returning error Certificate is expired or not yet valid #27

Closed
@goseese

Description

@goseese

I have a sketch that runs on many ESP32 devices with a W5500.

All devices have been running fine for approx 1 month with no issues.

Recently all the devices have started reporting the following error when attempting to connect to my server.

20:53:51.515 -> (SSLClient)(SSL_WARN)(connect): Arduino client is already connected? Continuing anyway...
20:53:51.515 -> (SSLClient)(SSL_WARN)(m_run_until): Terminating because the ssl engine closed
20:53:51.515 -> (SSLClient)(SSL_ERROR)(m_start_ssl): Failed to initlalize the SSL layer
20:53:51.515 -> (SSLClient)(SSL_ERROR)(m_print_br_error): Certificate is expired or not yet valid.

The server ssl certificate is a letsencrypt certificate and is working properly. Double checking the certificate expire data is about 90 days from the current date. The certificates have recently renewed.

First I forced the certificate to renew again, and rebooted the devices, no change.

Then I re-uploaded firmware to one of the devices. No changes were made to the firmware. The trust anchor was not changed. - The device started working.

I then forced the certificate to renew again. This did not cause the problem to come back for that device and all other devices were un-changed.

As a check I exported the trust anchor again and compared to the existing trust anchor. The trust anchor content did not change.

So my problem is I have many devices that are failing with the stated error "Certificate is expired or not yet valid". The only fix seems to be re-uploading unchanged firmware to the device.

Perhaps there is something with timestamp that validates the certificate at compile time and I need some way to update that time stamp?

The devices do not have an RTC and I do not set the time on them. I Can make a code change to do that, however uploading new code temporarily solves the issue so it would be hard for me to verify that is a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions