WSL icon indicating copy to clipboard operation
WSL copied to clipboard

wslc private registry login fail with TLS error

Open McMlok opened this issue 5 months ago • 6 comments

Windows Version

Microsoft Windows [Version 10.0.26100.8655]

WSL Version

2.9.3.0

Are you using WSL 1 or WSL 2?

  • [x] WSL 2
  • [ ] WSL 1

Kernel Version

6.18.35.2-1

Distro Version

No distro wslc CLI

Other Software

No response

Repro Steps

wslc registry login -u USERNAME -p PASSWORD https://private.registry.local

Registry on https://private.registry.local is secured with TLS certificate Issued by DigiCert Global Root G2. Certificate is in trusted root on machine and user level.

Expected Behavior

Login will succeed

Actual Behavior

Get "https://private.registry.local/v2/": tls: failed to verify certificate: x509: certificate signed by unknown authority

Diagnostic Logs

No response

McMlok avatar Jun 29 '26 17:06 McMlok

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'. Otherwise, please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The script will output the path of the log file once done.

If this is a networking issue, please use .\collect-wsl-logs.ps1 -LogProfile networking instead, following the instructions in Collect WSL logs for networking issues

Once completed please upload the output files to this GitHub issue.

See Collect WSL logs (recommended method).

If you choose to email these logs instead of attaching them to the bug, please send them to [email protected] with the GitHub issue number in the subject, and include a link to your GitHub issue comment in the message body, and reply with '/emailed-logs'.

github-actions avatar Jun 29 '26 17:06 github-actions

Hi @McMlok , The root CA is already in wslc's /etc/ssl/certs/ca-certificates.crt. Could you please dump the cert chain with the following command?

# Get a wslc VM shell
wslc system session shell
# Use openssl to dump the cert chain
openssl s_client -connect private.registry.local:443 -showcerts

I'm guessing you are doing custom DNS to resolve this address. If that's the case, please also check if the domain name resolves correctly inside the VM:

dig private.registry.local

Also, probably unrelated. How did you manage to get a cert for your .local domain name? I thought that's not allowed.

chemwolf6922 avatar Jun 30 '26 07:06 chemwolf6922

OK the correct registry URL is not on .local domain. I don't want to put the real name here. I run the command and here is the result. It looks like the problem is intermediate autority.

Now I have a question. I added intermediate autority to the Windows Cert store for machine and user. Which store is used Machine or User? And when the file wsl-windows-roots.pem is regenerated?

Thank you

McMlok avatar Jun 30 '26 08:06 McMlok

Hi @McMlok , WSLC currently does not mirror the intermediate CA cache to the Linux VM. Mirror those may or may not help depending on if Windows has created the cache. And AIA is something that many infrastructures do not support. In this case, go.

If the server is under your control, is it possible to configure it to return the full cert chain?

chemwolf6922 avatar Jun 30 '26 09:06 chemwolf6922

WSLC should mirror both CERT_SYSTEM_STORE_LOCAL_MACHINE and CERT_SYSTEM_STORE_CURRENT_USER to /etc/ssl/certs/wsl-windows-roots.pem in the VM.

chemwolf6922 avatar Jun 30 '26 09:06 chemwolf6922

I imported the intermediate certificate to trusted roots restart and now it works. Thank you for support

McMlok avatar Jun 30 '26 10:06 McMlok