Self-signed certificate error when installing Python support in WSL in spite of custom root certificate correctly installed in WSL
See original GitHub issueDoes this issue occur when all extensions are disabled?: Yes/No
- VS Code Version: 1.59.1
- OS Version: Windows 10.0.19042, WSL 5.10.16.3-microsoft-standard-WSL2
- Python Language extension : v2021.8.1159798656
My company uses an SSL inspection on company devices and provides a custom root CA certificate. In Windows, this is already pre-installed in the system certificate store and VS Code works fine in Windows where there are no problems installing & using Python language support. For WSL, the certificates & a process to install them in the system certificate store are provided (below) However, when trying to setup Python Language support in WSL I get a self-signed certificate error in spite of following the process to install the custom root certificates in WSL.
Steps to Reproduce:
- Copy custom certificates to WSL CA-Certificates folder
sudo cp *.crt /usr/local/share/ca-certificates/
- Install
sudo update-ca-certificates
- Launch VS Code and connect to WSL project
- Try to install Python support in WSL
- Get error -
self signed certificate in certificate chain
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:16 (8 by maintainers)
Top Results From Across the Web
Self-signed certificate error when installing Python support in ...
Self-signed certificate error when installing Python support in WSL in spite of custom root certificate correctly installed in WSL #5524.
Read more >How do I get Visual Studio Code to trust our self-signed proxy ...
Then, go into VScode settings, Application, Proxy, and UNCHECK the "System certificates" option. Restart vscode and RE-CHECK it. Restart again, ...
Read more >debian - Certificates on WSL - Unix & Linux Stack Exchange
Running openssl s_client -connect someDomainHere.com:443 </dev/null would give me the root certificate name, then moving it to /usr/local/share/ ...
Read more >Add certificate into WSL | The Long Walk
The process turns out to be as follows ; For example, say your certificate was here: c:\tmp\mycert.cer ; You can copy this inside...
Read more >Troubleshooting — conda 22.11.1.post17+e3a05b6f5 ...
If the repository is signed by a private certificate authority (CA), the file needs to include the root certificate and any intermediate certificates....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hello! I’ve developed a work around.
The core issue here seems to be that the certificate store passed by NodeJS running the back-end server to the OpenSSL library it uses to deal with encryption is not the linux system certificate store updated by
update-ca-certificates
. However, NodeJS has an environment variable configuration optionNODE_EXTRA_CA_CERTS
in which we can pass it the custom certificate. We can setup this environment variable in~/.vscode-server/server-env-setup
in WSL.Something like this works
However, ideally the solution should be to have NodeJS use the system certificate store
@chrmarti and @sandy081 Can you again look into that. It seems to be pop up again with the 1.62 version of VS Code (tough with all extension, not just the python). I have tested it by rolling back to 1.61.2 and then I can install all extensions again in WSL. But then as soon as update to 1.62 the installation of any extension in WSL fails. (The version “Remote - WSL” extensions is in both cases still the same same version - 0.58.5) When looking into the log it is quite obvious what happens different:
In version 1.61.2 the cert error also happens but then it automatically downloads the extensions locally instead (line 1 & 2):
But now with version 1.62 the process just stops at the cert error:
I can workaround it for now by settings the
remote.downloadExtensionsLocally
setting totrue
or by using the method @gbeal-smsc has describe above. But while looking at the solution from @gbeal-smsc I think it would be the best if the vscode-server would somehow automatically inherit theNODE_EXTRA_CA_CERTS
environment variable if it is set in WSL already. Because of our corporate Proxy with TLS-Inspection I have to set theNODE_EXTRA_CA_CERTS
environment variable anyway in WSL but it is then not very intuitive that the vscode-server does not know anything about it by default.So not sure which one would actually be the “correct” solution but I think either the extension installation process should automatically fail back again to local download (as it was in 1.61.2) or the vscode-server should automatically pickup the
NODE_EXTRA_CA_CERTS
environment variable if it is set in WSL. But just fail with the cert error and leave the user with the problem, as it is now in 1.62, is IHMO the worst option. 😉Thanks!