postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.78k stars 837 forks source link

WebSockets and mTLS #12910

Open iliyan85 opened 3 weeks ago

iliyan85 commented 3 weeks ago

Is there an existing issue for this?

Describe the Issue

Based on the previous issue WebSockets and mTLS #11865,

I conducted several tests about using of TLS client certificates for wss connection and as a result, the connection didn't establish. The err log file of nginx says:

client sent no required SSL certificate while reading client request headers

I tested with Postman v11.1.14 for Windows and Postman v11.1.13 for Linux and unfortunately the situation was the same for both.

Steps To Reproduce

  1. Import p12 file in Postman for the given domain
  2. Create an websocket request to wss endpoint
  3. Configure https server for the given domain (nginx for example) to websocket location
  4. Try to connect

Screenshots or Videos

No response

Operating System

Windows

Postman Version

11.1.14

Postman Platform

Postman App

User Account Type

Signed In User

Additional Context?

No response

parthverma1 commented 3 weeks ago

Hi @iliyan85, I understand that you are having trouble connecting to websocket servers using mTLS and understand how frustrating it can be. I tried replicating this on the latest version of the desktop app on mac v11.1.4.

image

I was able to successfully connect to a websocket server running behind a nginx server with self signed certificates. I tested the connection using both a p12 file as well as using the cert + key file combination.

In order to diagnose the issue it would be helpful if you could:

listen 8080 ssl;
ssl_certificate /etc/nginx/server.crt;
ssl_certificate_key /etc/nginx/server.key;
ssl_client_certificate /etc/nginx/ca.crt;
ssl_verify_client on;

I suspect there could be one of the following reasons for a failed connection

  1. The hostname/port combination being used don't match the address the server is running on. In this case, you should not be seeing the certificates being listed in the console.
  2. There is a mismatch in the certificates that are configured on the proxy (nginx etc) that is being used in front of the websocket server and what is configured in postman. In this case, the http request should also return an error with a similar message to what you are receiving when making the websocket connection indicating that the certificates setup in Postman don't match the ones configured on nginx.

It would be helpful if you can share any additional steps/information that are specific to your setup that might help us reproduce the issue so that we could investigate further.

iliyan85 commented 3 weeks ago

First of all, I don't have any problem with nginx. :) Postman works fine for https locations with client certificate.

Also Postman works fine for this one and can establish wss connection If I turn ssl_verify_client off. image

In otherwise (ssl_verify_client on) nginx returns 400. image

parthverma1 commented 2 weeks ago

Hi @iliyan85,

It would be helpful if you could share a demo-repo or dummy certificates with which we can replicate the issue and fix it.