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

WebSocket-specific INFO #4255

Merged
merged 1 commit into from Jun 20, 2023
Merged

WebSocket-specific INFO #4255

merged 1 commit into from Jun 20, 2023

Conversation

neilalexander
Copy link
Member

This fixes #4252 by ensuring that tls_available, tls_required, host and port are populated based on the WebSocket listener rather than standard listeners.

Signed-off-by: Neil Twigg neil@nats.io

@neilalexander neilalexander requested a review from a team as a code owner June 20, 2023 10:33
This fixes #4252 by ensuring that `tls_available`, `tls_required`, `host` and `port`
are populated based on the WebSocket listener rather than standard listeners.

Signed-off-by: Neil Twigg <neil@nats.io>
@neilalexander
Copy link
Member Author

With this PR when connecting over WebSockets:

INFO {"server_id":"NC6QBQLCOMKQQLGYTWBTLNRFNTT3FAX2KGCWTI7OYGIUWOAPZTMKWATF","server_name":"local","version":"2.9.19-beta.1","proto":1,"go":"go1.20.3","host":"::","port":8443,"headers":true,"tls_required":true,"tls_available":true,"max_payload":1048576,"jetstream":true,"client_id":4,"client_ip":"127.0.0.1"}

@derekcollison derekcollison self-requested a review June 20, 2023 13:30
Copy link
Member

@derekcollison derekcollison left a comment

Choose a reason for hiding this comment

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

LGTM

@derekcollison derekcollison merged commit 04a79b9 into main Jun 20, 2023
2 checks passed
@derekcollison derekcollison deleted the neil/fix4252 branch June 20, 2023 13:33
kozlovic added a commit that referenced this pull request May 9, 2024
PR #4255 added code in generateClientInfoJSON to set the proper
info Host/Port/TLSAvailable/TLSRequired fields to send to clients.

However, this was requiring a lock but more importantly was computing
the listener's host/port everytime, which is not necessary since
this is immutable because we don't support the change during a config
reload.

Also, the TLSRequired field was set based on the server TLSConfig's
InsecureSkipVerify value, which is irrelevant for a server. The
mere presence of a TLSConfig (c.srv.websocket.tls being true) is
enough.

I have modified the TestWSReloadTLSConfig test to verify that the
tls block cannot be removed and no_tls set to true, which means
that tls value can't change. I also added check for the info's
Host/Port/TLSAvailable/TLSRequired values.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
derekcollison added a commit that referenced this pull request May 9, 2024
PR #4255 added code in generateClientInfoJSON to set the proper info
Host/Port/TLSAvailable/TLSRequired fields to send to clients.

However, this was requiring a lock but more importantly was computing
the listener's host/port everytime, which is not necessary since this is
immutable because we don't support the change during a config reload.

Also, the TLSRequired field was set based on the server TLSConfig's
InsecureSkipVerify value, which is irrelevant for a server. The mere
presence of a TLSConfig (c.srv.websocket.tls being true) is enough.

I have modified the TestWSReloadTLSConfig test to verify that the tls
block cannot be removed and no_tls set to true, which means that tls
value can't change. I also added check for the info's
Host/Port/TLSAvailable/TLSRequired values.

Signed-off-by: Ivan Kozlovic <ivan@synadia.com>
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.

No tls_required in INFO for TLS-only WebSocket connections
3 participants