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

Why is the Certificate fingerprint needed for HTTPS POST requests? #3157

Closed
Juraci opened this issue Apr 21, 2017 · 10 comments
Closed

Why is the Certificate fingerprint needed for HTTPS POST requests? #3157

Juraci opened this issue Apr 21, 2017 · 10 comments

Comments

@Juraci
Copy link

Juraci commented Apr 21, 2017

Basic Infos

Hardware

Hardware: Nodemcu ESP-12E

Description

Problem description

Need to update the code from all Nodemcu ESP-12E devices whenever the SSL certificate of my endpoint changes, otherwise all devices that need to POST (over https) using the HTTPClient will start to get HTTPC_ERROR_CONNECTION_REFUSED response.

The URIs that I need my devices to communicate to change their SSL certificate every 3 months or so. It is extremely burdensome having to go to each device and update their certificate fingerprint.

My questions are:

  1. [Potentially dumb question] Why is the certificate fingerprint required for POST requests over https? I don't see this requirement in other libs, you just have to pass the URI of the endpoint and that is it.
  2. Is there a way to get around having to pass the certificate but still communicating through https?
@Potato-Matic
Copy link

I've had the same issue for a long time, and posted about it in the CA cert thread i think. It would be great if there were a way around this, since I do't know the status of that anymore...

@davisonja
Copy link

davisonja commented Apr 25, 2017 via email

@igrr
Copy link
Member

igrr commented Apr 26, 2017

That got me thinking... what if we include fingerprints of root certificates into the program and check them instead? SHA256 fingerprints of all the root certificates in a typical root cert store would amount to a few kB, so we can bundle them with every firmware without much trouble.
Then the application will not need to specify website fingerprint any more.

@davisonja
Copy link

davisonja commented Apr 26, 2017 via email

@Juraci
Copy link
Author

Juraci commented Apr 27, 2017

@igrr that would be awesome.

@igrr
Copy link
Member

igrr commented May 1, 2017

Unfortunately, my above suggestion/proposal about bundling root certificate fingerprints with the framework doesn't seem to be viable. Most web servers are configured to serve all the certificates in the certificate chain, excluding the root certificate. The last certificate in the chain references the root certificate, but it is assumed that the client has the actual certificate locally.

For example, api.github.com sends a chain consisting of two certificates:

 0 s:/C=US/ST=California/L=San Francisco/O=GitHub, Inc./CN=*.git.luolix.top
   i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA
 1 s:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 High Assurance Server CA
   i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA

and the client is supposed to have the 'DigiCert High Assurance EV Root CA' stored locally.

@igrr
Copy link
Member

igrr commented May 2, 2017

More thoughts about this... For each root certificate we really only need to store the public key, and subjectKeyInfo hash (SHA-1) as an index. That's about 300 — 600 bytes, depending on RSA key length used, per certificate. We can probably limit ourselves with 10-20 bundled certificates, choosing the most commonly used ones. Even 10k isn't that much in terms of flash size, and will only be used if one specifically requests this feature (for example, through client.useDefaultRootCerts() or similar function call).

@Jeroen88
Copy link
Contributor

Still it would be great if the verify() could be skipped on a secure connection. E.g. Microsoft's Azure-devices.net uses a secure (encrypted) connection optionally without a server certificate. Of course this is less secure, because the server is not authenticated, but at least the data is encrypted. Open e.g https://iotcampau.azure-devices.net/ in a browser. The connection is secure (encrypted) verfified by Microsoft, however, no server certificate is present. Using a non-encrypted connection is not possible, because azure-devices.net is not listening on http.

@AhmedAdelHosni
Copy link

Is there any updates regarding this ?
I have the same issue that i need to update the finger print every 3 months.
Any thoughts how could I do this in a good way ?
I thought of a workaround to save the finger print in a remote http server and if your another ssl server is failing then go check if the fingerprint was changed or not use it instead .

@devyte
Copy link
Collaborator

devyte commented May 29, 2018

BearSSL is merged in #4273 , with alternate BearSSL::WiFi* classes. Although axtls-based classes are still available and even the default, they are planned for deprecation and then retirement, hence won't be fixed. Any issues with BearSSL-based classes should be reported in new issues.
Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants