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

Issues with VSCode Extension #38

Open
mathmaniac43 opened this issue Apr 10, 2021 · 1 comment
Open

Issues with VSCode Extension #38

mathmaniac43 opened this issue Apr 10, 2021 · 1 comment

Comments

@mathmaniac43
Copy link

Hello,

First of all, thank you for maintaining this solution on so many platforms. I was very annoyed when I read about using it as a workaround for the Home Assistant Config Helper, but as you know better than I do, that is simply a Windows problem...

Anyway, I am having trouble getting my installation of the Home Assistant Config Helper VSCode extension to connect to my Home Assistant server via HTTPS. I have generated my own certificates, and I installed the Certificate Authority's public certificate into both the Windows certificate store (as a User under Trusted Root Certificate Authorities) and into my browsers (Firefox manually, Chrome automatically via Windows certificates).

The browsers work fine, but the Home Assistant extension in VSCode seems to be having trouble:

[Home Assistant Language Server(10460)] Started and initialize received
Connecting to Home Assistant...
[Auth phase] Initializing WebSocket connection to Home Assistant
[Auth Phase] Connecting to Home Assistant... Tries left: 3
WebSocket Connection to Home Assistant closed with an error: Disconnected from Home Assistant with a WebSocket error with message: unable to verify the first certificate
Applying schemas to 6 of your configuration files...
Schemas updated!
[Auth Phase] Connecting to Home Assistant... Tries left: 2
WebSocket Connection to Home Assistant closed with an error: Disconnected from Home Assistant with a WebSocket error with message: unable to verify the first certificate
[Auth Phase] Connecting to Home Assistant... Tries left: 1
WebSocket Connection to Home Assistant closed with an error: Disconnected from Home Assistant with a WebSocket error with message: unable to verify the first certificate
[Auth Phase] Connecting to Home Assistant... Tries left: 0
WebSocket Connection to Home Assistant closed with an error: Disconnected from Home Assistant with a WebSocket error with message: unable to verify the first certificate

When I enable the vscode-home-assistant.ignoreCertificates setting (which I do not think I should have to do, and defeats the purpose of trying to use win-ca), the connection succeeds:

Connecting to Home Assistant...
[Auth phase] Initializing WebSocket connection to Home Assistant
[Auth Phase] Connecting to Home Assistant... Tries left: 3
[Auth phase] Received a message of type auth_required
[Auth phase] Received a message of type auth_ok
Connected to Home Assistant

After a bit of research, I tried changing my Home Assistant server's certificate to include the Certificate Authority's public certificate as well as its own public certificate (in a combined file). This still works in my browsers, but produces a different error with the Home Assistant Config Helper:

Connecting to Home Assistant...
[Auth phase] Initializing WebSocket connection to Home Assistant
[Auth Phase] Connecting to Home Assistant... Tries left: 3
WebSocket Connection to Home Assistant closed with an error: Disconnected from Home Assistant with a WebSocket error with message: self signed certificate in certificate chain
[Auth Phase] Connecting to Home Assistant... Tries left: 2
WebSocket Connection to Home Assistant closed with an error: Disconnected from Home Assistant with a WebSocket error with message: self signed certificate in certificate chain
[Auth Phase] Connecting to Home Assistant... Tries left: 1
WebSocket Connection to Home Assistant closed with an error: Disconnected from Home Assistant with a WebSocket error with message: self signed certificate in certificate chain
[Auth Phase] Connecting to Home Assistant... Tries left: 0
WebSocket Connection to Home Assistant closed with an error: Disconnected from Home Assistant with a WebSocket error with message: self signed certificate in certificate chain

I am not 100% sure if this is a problem with win-ca, Home Assistant Config Helper, or some misunderstanding I have with how Windows is trying to validate SSL certificates... but I expected win-ca to make the certificate available and it does not seem able to do so. Do you have any thoughts or experiments I could try?

Thank you!

@ukoloff
Copy link
Owner

ukoloff commented Apr 22, 2021

Well. debugging certificate problems can be tricky task.

First, I see Websocket is mentioned. This can mean that standard https module is not used to connect. If so, you can try experimental method, see Settings of win-ca vscode extension and set Inject to Append.

Hope this helps.

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