Relying on the Lando certificate from WSL2

A little over a year ago I told you how to quickly install Lando in our WSL2 environment(Lando in WSL2: The right way), remember that first we must have enabled virtualization in our Windows:

virtualization enabled

Then execute the following command:

# curl -Ls https://github.com/lando/hyperdrive/releases/download/v0.6.1/hyperdrive > /tmp/hyperdrive \
  && chmod +x /tmp/hyperdrive \
  && /tmp/hyperdrive

Now we create the directory where we are going to have our projects, we create the directory of our project and initialize WordPress:

# mkdir lando-projects && cd lando-projects

# mkdir cursos-tabernawp && cd cursos-tabernawp

# lando init \
  --source remote \
  --remote-url https://wordpress.org/latest.tar.gz \
  --recipe wordpress \
  --webroot wordpress \
  --name cursos-tabernawp

# lando start

# lando info

We configure our .lando.yml file with the necessary services.

And if we have changed configurations, we reconstruct with lando rebuild

We are now ready to use our Lando installation. But using https domains will give us a certificate error and we will have to tell the browser that it must trust it every time:

lando site https

Relying on Lando’s certificate

The solution for our browser to trust the certificate issued by Lando can be found in the documentation: https://docs.lando.dev/core/v3/security.html#windows

Lando cert Windows

But the problem is that we are working with WSL2 and, therefore, our Lando certificate is not in that path, so we will have to change our command to the following one:

# certutil -addstore -f "ROOT" \\wsl.localhost\DISTIBUCION-LINUX-WSL\home\USER-LINUX-WSL2\.lando\certs\lndo.site.pem

As we can see in the following example executed from my computer:

Lando WSL2 Certificate for Windows

And as can be seen in the following screenshots, our browsers already trust the certificate issued by Lando, although Firefox tells us that it does not recognize its issuer:

trust-in-certificate-lando
Trusting the Lando certificate in Firefox

Join my superlist ;)

I won't share your details with anyone or bombard you with emails, only when I publish a new post or when I have something interesting to share with you.

Leave a Comment