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

Mosquitto_pub/_sub cryptic protocol error message on invalid server certificate #2746

Closed
axos88 opened this issue Feb 6, 2023 · 2 comments
Closed

Comments

@axos88
Copy link
Contributor

axos88 commented Feb 6, 2023

Repro:

  1. Check out the develop branch
  2. Create a server offering a certificate with CN foo.example.com
  3. Open a connection via mosquitto_sub with another address pointing to the machine, such as:

./client/mosquitto_sub -t topic -i clientid -h bar.example.com -p 8883 --capath /etc/ssl/certs

Expectation:

  • Some kind of error message specifying that the server provided an invalid certificate / a valid certificate with the incorrect CN.

Actual: Error: Protocol error

Super confusing, because I thought there was an actual mismatch of TLS versions, or the server not accepting TLS connections or the client not trying to start a TLS connection.

@axos88
Copy link
Contributor Author

axos88 commented Feb 6, 2023

More info: turning on the debug mode with -d does provide the information, but I'd not expect to need that to be presented with a comprehensible error message:

client/mosquitto_sub  -t topid -i clientid -h bar.example.com -p 8883 --capath /etc/ssl/certs -d
Client bar sending CONNECT
Error: host name verification failed.
OpenSSL Error[0]: error:0A000086:SSL routines::certificate verify failed
Error: Protocol error

@ralight
Copy link
Contributor

ralight commented Apr 1, 2023

Thank you. This was a regression from a previous error that correctly mentioned a TLS problem. I have made the fix in the fixes branch, which will become 2.0.16, and then be merged to the develop branch.

ralight added a commit that referenced this issue Apr 1, 2023
@ralight ralight closed this as completed Apr 1, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 2, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants