-
Notifications
You must be signed in to change notification settings - Fork 307
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
TLS fingerprint checking? #42
Comments
Looking at BootNormal takes me here and depths I wouldn't normally be in... it appears to me as though it ought to work. |
As you just said, it is implemented and should work... Could you please add a |
The condition is evaluated: I see my
Buffer too small or something? |
There was an issue with the print config function, but the garbage issue seems to appear when printing value parsed by ArduinoJson, I don't know why... About the fingerprint issue, I'll investigate when I will have access to my ESP8266s. :) |
If I shorten the |
Weird. The buffer is not too small, otherwise the MQTT sending would also send garbage to the $name property. I think the problem is that the buffer is actually too big. If you look at |
I've found the reason, but not the cause. On L76, if I remove the |
That's what I meant when I told you to add a I have no idea... |
I believe the logic is wrong: verification should be performed if the fingerprint string is not empty. Addresses homieiot#42
In spite of the
|
Have you tried to enable Arduino for ESP8266 debugging? There is a lot of useful informations outputted. Maybe the problem comes from the domain name and not from the fingerprint? |
Forget what I just said, you said |
It's definitely not the domain name. Yet. (FWIW, this matches both the certificate subject CN as well as one of the subjectAltNames, but I am prepared to debug that too, once we get passed the fingerprint.) |
Alright, so we both agree, it seems to be an issue of esp8266/Arduino, not Homie? |
If I say 'yes', you're going to close this quickly and leave me to suffer alone, so I'll say 'maybe' 😆 |
No no, I won't, but if we fill an issue on the Arduino for ESP8266 issue tracker, I prefer to be sure the problem is not on Homie's side. 😉 Moreover, there is the garbage issue on Serial. |
The problem is definitely not on Homie's side. I'm now skipping I think I've reached an impasse. |
So the issue would come from the Espressif SDK? I think it's time to open an issue on esp8266/Arduino! |
I have not been taking a break, and I have not been having lunch, and no siesta either. ;-) Instead, I've been reading through a huge load of issues on esp8266/Arduino, and I stumbled over a pointer to this test sketch which, when I run it, produces this output:
Lines marked with
In other words, I think it is a Homie problem? Is some buffer being overwritten somewhere such that the |
If, in that same HTTP test sketch I replace host, port, and fingerprint to match my MQTT server, it also works!
(Obviously the HTTP request proper fails) Also, changing one octet of the fingerprint causes the fingerprint verification to fail. |
Thanks for the investigation! The client is only used for PubSubClient, so no there is nothing that overwrite the buffer. I will try to reproduce the issue with a simple sketch, it will be easier to debug. |
Okay, I got it. The |
That would mean having to pass a callback for verification to ::connect, wouldn't it? Ouch. |
Yes, or a new parameter to check in PubSubClient for a fingerprint... Which is not cross platform. So, we're facing an impasse. I'll open an issue in the PubSubClient repo, to discuss about it. |
But someone managed to make it work, so I am probably saying stupid things. |
FWIW I don't think it has anything to do with TLSv1.1 or higher: tests this morning made no difference. Also, to make quite sure, I tested the HTTP sketch I linked to above against a TLSv1.1 and a TLSv1.2 configured broker without noticeable difference. |
The problem was what I said:
As a workaround, I now connect to the server and check the fingerprint, then disconnect and let PubSubClient connect to the broker. So yes, an attack is possible during this tiny timeframe, but I can't do anything, this has to be fixed in PubSubClient. |
I think this is good enough. As reported in #46 this is working, so I will now close this. |
As per the JSON documentation I have uploaded a configuration which configures Homie to use TLS (the artist formerly known as SSL :-) and TLS connections are correctly established to a Mosquitto broker if I don't force the listener to
tlsv1.2
.I assumed the
fingerprint
element of the configuration would be to verify the server's certificate against some known good value. However, if I randomly modify thefingerprint
on the device, the connection succeeds anyway. Isfingerprint
checking actually implemented, or have I simply misunderstood the name of the element?(The real broker's CA certificate fingerprint obtained with
openssl x509 -in ca.crt -noout -fingerprint
has a2
at the end of the fingerprint instead of a3
.)The text was updated successfully, but these errors were encountered: