-
-
Notifications
You must be signed in to change notification settings - Fork 482
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
MQTT TLS issue #1960
Comments
What logs / status message do you get in the app? |
Hello, I have the output from owntracks app below. I have also tried with a different crt key pair and its doing the same thing. There may be an issue of how I make the p12 file or how it works with my cellphone which is a anroid oppo. `
|
SSLPeerUnverifiedException means you're either not trusting the right CA in your device root store, or the leaf cert presented by the server doesn't have your hostname in the SAN field. |
Thank you. I noticed it is probably the same issue as #1694. I think I am having trouble generating a proper certificate and key that works. I created a new server.crt and server.key based on this script generate-CA.sh but getting the below error message in mosquitto_pub
My server certificate is as follows, mosquitto is running fine
|
I have also just ran the generate-CA.sh script uncommenting the hostlist and IP list and adding my local ip and mqtt.domainname.com to these variables. Restarted mosquiito using the updated files and its presenting the same error message when I run mosquitto pub. |
please either obfuscate correctly or show us the real values. If these really differ that will cause trouble |
You've also not indicated whether the CA is in your device. |
Are these values important? As I understand only the CN has to match my domain host pointing to the mqtt server (it does). The SAN is configured to DNS:mqtt.mydomainname.org |
Yes I both imported the .p12 file as well as the ca.crt file to the android app. FYI for the time being I have set "require_certificate false" in mosquitto so only the CA is checked. Its working however would still would like to use the client certificates. |
That is wrong. Start reading here |
Thank you, I have somewhat sorted it out by butchering the generateCA.sh script. I failed to mention I was trying to use the server.crt and server.key produced by the script to test in mosquitto_sub/pub however these wont work. I then generated the client.cert and tested it and it works just fine. Being not that well versed in certificates I was relying on tutorials on internet (owntracks + mosquitto) and I believe all of these tutorials out of date in terms of generating proper certificates. |
I have a working MQTT server and can run the command:
mosquitto_pub -h -p 8883 -t test -m test --cafile ca.crt --cert client.crt --key client.key -u dummyuser P dummypass
This works as expected and I receive a test message on the test topic.
I have then converted it to a pl12 file using:
openssl pkcs12
-legacy
-export
-in client.crt
-inkey client.key
-name "Jane's certificate/key"
-out jjolie.p12
I then import ca.cert and jjolie.p12 into my cellphone. The ca.cert is showing "Trusted Certificates" and User Certificates.
On the owntracks app 2.5.3 i install the jjolie.p12 client certificate through "Install client certificate" button and "Allow" this certificate in the "Client certificate section".
I set "Credentials" to dummyuser and dummypass.
On my MQTT server I am getting only New connection message (from device and "Client closed its connection message"
I am unsure why I am getting this error and I have tried on two android devices. I think I am missing something in the pkcs12 conversion. I have tried with and without legacy.
The text was updated successfully, but these errors were encountered: