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

Skip TLS SNI if host is IP address #1311

Merged
merged 1 commit into from
Dec 13, 2021
Merged

Skip TLS SNI if host is IP address #1311

merged 1 commit into from
Dec 13, 2021

Conversation

A3K
Copy link
Contributor

@A3K A3K commented Jul 29, 2021

This avoids showing a warning when the broker address is just an IP
[DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version.
Same fix as node-postgres has used brianc/node-postgres@d3c8eba

This avoids showing a warning when the broker address is just an IP
[DEP0123] DeprecationWarning: Setting the TLS ServerName to an IP address is not permitted by RFC 6066. This will be ignored in a future version.
Same fix as node-postgres has used brianc/node-postgres@d3c8eba
var debug = require('debug')('mqttjs:tls')

function buildBuilder (mqttClient, opts) {
var connection
opts.port = opts.port || 8883
opts.host = opts.hostname || opts.host || 'localhost'
opts.servername = opts.host

if(net.isIP(opts.host) === 0){
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so can you explain what is happening here in detail? You're checking if the passed in option on host is an IP address? And then the reason for this is because of something to do with TLS SNI?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the server doesn't have a name but only an IP Address in the config then this doesn't try set that IP as the servername for TLS purposes. This avoids a warning at startup

Copy link
Contributor

@YoDaMa YoDaMa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@YoDaMa YoDaMa merged commit 2679952 into mqttjs:master Dec 13, 2021
@A3K A3K deleted the patch-1 branch March 18, 2022 01:40
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

Successfully merging this pull request may close these issues.

2 participants