-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
WiFiClientSecure does connect when a root cert fingerprint is given #7394
Comments
Can you please run this and catch the logs with BearSSL debugging enabled (Tools->Debug Level->SSL). That will print any calculated fingerprints it's comparing your FP values to. By convention a cert is normalized before calculating the FP, but due to memory restrictions BearSSL will calculate a FP on a cert as-given. 99% of the time these match, but occasionally there is a difference. The dump would show this if that's the case here.
edit: It is actually against the individual cert in BSSL, but it's only compared against the lowest cert in the chain(i.e. the site cert) and not against intermediates. That said, though, fingerprints are definitely not a preferred way of checking certs. See the BearSSL examples for how to specify an actual trusted certificate for the root CA. It's not significantly slower or any more difficult than sending in a FP. |
You should use the signing root CA as trust anchor, which has a much longer validity. You can find all root certs of Let's encrypt here. I use this one, Valid From: March 17, 2016, Valid To: March 17, 2021, so five years in total (but expiring next year) I think you can use the ISRG Root X1 too, that is valid To: June 4, 2035, but I haven't tried it. |
As far as I can see, the certificate chain of Let'sEncrypt certificates ends in DST Root CA X3 valid to 2021-09-30 14:01:15 UTC. Edit: on second thought, I think using of the proposed Let's Encrypt X3 certificate is equivalent to the DST Root X3 because when Let's Encrypt company issues a new certificate it will surely be signed by another root CA with longer validity than 2021. |
Thanks for the plentiful feedback for my weekend project! I still don't know why the fingerprints don't validate, but I learned more about making my things safer in general! How I should make it betterFollow more in BearSSL Client Secure Class and use a foll certificate instead of fingerprints. The Arduino/libraries/ESP8266WiFi/examples/BearSSL_Validation/BearSSL_Validation.ino Line 109 in 448486a
Trying the different Let's Encrypt Root Certs:
An Internet of Trouble lies ahead as root certificates begin to expire en masse, warns security researcher is a recent (2020-06-10) article that covers this. The initial problem with fingerprints
This is the debug output for completeness if still relevant:
|
Yes, it could very well be. After the Microsoft acquisition, GitHub's main certificates seem to change every month or two. I couldn't say way, but that's just another reason to avoid using FPs of certs. We've updated that FP three times so far, I think, and it's a moving target.
Well, there's your FP (received).
There is also the CertStore which is similar to what your OS uses for verifying SSL connections. Throw both CA certs in a file and you're good to go. See the BearSSL_CertStore example which actually uses all the certs that the Mozilla org packages w/Firefox. You can pick and choose the ones you want yourself in your build setup, or throw the whole thing in and forget about it (it's not that big).
Yup, it will be a great opportunity to sell new IOT gadgets for companies to replace the older, orphaned ones that die because of this. Either use the CertStore or pick a specific LE cert root and set that manually is the best that I can suggest for you. I'm not really seeing any core issue (other than the darn GH FP changing yet again) here... |
The certificate was regenerated yet again, so update the FP in the SSL validation example. Fixes esp8266#7394
The certificate was regenerated yet again, so update the FP in the SSL validation example. Fixes #7394
Platform
Settings in IDE
Problem Description
Many old (2018) tutorials and articles describe that you can use a root certificate fingerprint to validate your connections. Is it true that BearSSL does not support this? This example shows that.
Expected behavior: Root certificate SHA-1 fingerprints can be used to verify connections.
Rationale: We are living in a world where Let's Encrypt certs are the norm. These have a very short lifetime (90 days). If we can only validate against these, an OTA update of connected devices will be needed all the time or the device needs to be reflashed to regain connectivity, after the cert has been invalidated.
MCVE Sketch
The text was updated successfully, but these errors were encountered: