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

TLS Handshake failure #240

Open
schungx opened this issue Aug 9, 2019 · 4 comments
Open

TLS Handshake failure #240

schungx opened this issue Aug 9, 2019 · 4 comments

Comments

@schungx
Copy link

schungx commented Aug 9, 2019

Using client.connect(None) to connect to a wss:// endpoint, but got TLS Handshake failure.

Connecting to ws:// endpoint works just fine.

Tool-chain: stable-i686-pc-windows-gnu
Environment: Windows 10 x64

Is there any way to diagnose the problem? Any pointers?

@vi
Copy link
Member

vi commented Aug 11, 2019

What environment are you connecting WebSocket from? Browser or Node?

Assuming it's browser, try pasting the websocket address, but with https:// instead of wss:// to address line and opening it. You would probably see "invalid self-signed certificate" page like "proceed, I know what I am doing / add to trusted certificates" about poor TLS setup. Once you force thgouh (you would probable see WebSocat's message "Only WebSocket connections are welcome here" or similar), client.connect may start working (at least until browser restart).

@schungx
Copy link
Author

schungx commented Aug 12, 2019

I'm opening up a WebSocket client connection on a Rust console program with websockets-rs. Not going thru a browser at all.

I am wondering, do I need to setup a certificate or some weird stuff to connect via wss://? The server uses a self-signed certificate (it is a testing server). So do you think the self-signed certificate is the problem?

If so, the error message of TLS Handshake failure is not very helpful at all...

@vi
Copy link
Member

vi commented Aug 12, 2019

Are you connecting one Websocat to the other Websocat?

Maybe you want --insecure (-k) option.

@schungx
Copy link
Author

schungx commented Aug 14, 2019

Nope. The other side is a standard WebSocket listener service. It just uses a self-signed certificate (it is a testing env).

Using a browser to connect and accepting the self-signed certificate works just fine.

With this lib, using connect_insecure of course works fine, but it will be connecting on ws:// protocol.

Using connect with wss:// protocol generates the handshake failure.

Main question is how to diagnose such a failure. Is there anywhere I can inspect the cause of this failure?

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

No branches or pull requests

2 participants