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

how to specify server CA, client cert and client key when connecting to wss server? #44

Open
thediveo opened this issue Apr 26, 2019 · 5 comments

Comments

@thediveo
Copy link

In order to connect to a websocket service inside a pod in a minikube setup, I need to address the Kubernetes remote API which then demands a client certificate (~/.minikube/client.crt and ~/.minikube/client.key). I also have the server's CA ( ~/.minikube/ca.crt).

curl allows to use these certs with the --cert, --key, and --cacert options.

Does websocat also support specifying the client cert and the server CA when accessing a wss:// URL?

@thediveo
Copy link
Author

thediveo commented Apr 26, 2019

So I found that myself, may it be helpful to others (I have to disable server certificate verification at the moment, as I get an "E certificate is valid but its commonName does not match hostname"):

$ websocat --binary \
  --ws-c-uri=wss://192.168.99.100:8443/api/v1/namespaces/default/pods/mypod:8000/proxy/ \
  - \
  ws-c:cmd:'socat - ssl:192.168.99.100:8443,verify=0,\
  cafile=/home/foo/.minikube/ca.crt,\
  cert=/home/foo/.minikube/client.crt,key=/home/foo/.minikube/client.key'

@vi
Copy link
Owner

vi commented Apr 26, 2019

Yes, socat and openssl s_client are valid workarounds for websocat.

Anyway I'll count this issue as a vote to implement this feature natively.

@thediveo
Copy link
Author

When you might be getting at this in the future, please give some love also to the commonname option: I've found now out that I need to explicitly set this with newer socat versions which otherwise get tripped up by some servers...

@vi
Copy link
Owner

vi commented Apr 27, 2019

Do you mean the name for SNI or the name in the server certificate to check?

@thediveo
Copy link
Author

As far as I understand the situation with respect to the Kubernetes remote API, this is about the server certificate returned during SSL handshake and checking it against the server's CA certificate the client has.

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