craftcms / nitro

Speedy local dev environment for @craftcms.
https://getnitro.sh
MIT License
178 stars 24 forks source link

Nitro SSL WSL (window subsystem Linux) - error on windows command #457

Closed wallythewebdev closed 2 years ago

wallythewebdev commented 2 years ago

I am trying to create a SSL cert using nitro trust - I am using WSL

The goal is to be able to use the https://.nitro instead of the http:// Some of the plugins I am using require HTTPS

This produces a message for WSL users:

Users on WSL will need to open an elevated (run as administrator) Command Prompt or terminal on Windows and run the following command:
certutil -addstore -f "Root" \\wsl$\Ubuntu\home\wally0s\.nitro\nitro.crt72 <nil>

Running this command ends with an error - and I have not managed to work out how to fix it yet so am asking for help.

Steps to reproduce

  1. run nitro trust output:

    wally0s@XXXXXXXXXXXXXXX:~$ nitro trust
    … getting Nitro’s root site certificate ✓
    Installing certificate (you might be prompted for your password)
    Users on WSL will need to open an elevated (run as administrator) Command Prompt or terminal on Windows and run the following command:
    certutil -addstore -f "Root" \\wsl$\Ubuntu\home\wally0s\.nitro\nitro.crt72 <nil>
    Nitro certificates are now trusted 🔒
  2. Open terminal as admin and run the above command: certutil -addstore -f "Root" \\wsl$\Ubuntu\home\wally0s\.nitro\nitro.crt72 <nil>. output: Error:

Running the same command minus the certutil -addstore -f "Root" \\wsl$\Ubuntu\home\wally0s\.nitro\nitro.crt72 Output:

Root "Trusted Root Certification Authorities" DecodeFile returned The system cannot find the file specified. 0x80070002 (WIN32: 2 ERROR_FILE_NOT_FOUND) CertUtil: -addstore command FAILED: 0x80070002 (WIN32: 2 ERROR_FILE_NOT_FOUND) CertUtil: The system cannot find the file specified.

Any help on next steps would be great - Thanks

angrybrad commented 2 years ago

Try it without the 72 - that doesn't look correct

certutil -addstore -f "Root" \wsl$\Ubuntu\home\wally0s.nitro\nitro.crt

wallythewebdev commented 2 years ago

Amazing - should have spotted that. Thanks for the quick reply 👊👊👊

From terminal - running as admin:

PS C:\Users\wally> certutil -addstore -f "Root" \\wsl$\Ubuntu\home\wally0s\.nitro\nitro.crt
Root "Trusted Root Certification Authorities"
Signature matches Public Key
Certificate "Caddy Local Authority - 2022 ECC Root" added to store.
CertUtil: -addstore command completed successfully.