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

Due to an open issue with wsl, testrunner is not reachable in LAN #83

Open
mlasak opened this issue Feb 28, 2024 · 6 comments
Open

Due to an open issue with wsl, testrunner is not reachable in LAN #83

mlasak opened this issue Feb 28, 2024 · 6 comments
Assignees
Labels
documentation Improvements or additions to documentation

Comments

@mlasak
Copy link
Collaborator

mlasak commented Feb 28, 2024

microsoft/WSL#4983

open since 2020. only workaround for now is to start test runner without ssl and use a simple proxy on windows host machine to terminate ssl there.

example:

const fs = require('fs')
const path = require('path')
const hp = require('http-proxy')

const certFolder = 'certs'

hp.createServer({
    target: {
        host: '172.31.146.167',
        port: 8000
    },
    ssl: {
        key: fs.readFileSync(path.join(certFolder, 'key.pem'), 'utf8'),
        cert: fs.readFileSync(path.join(certFolder, 'cert.pem'), 'utf8'),
        ca: fs.readFileSync(path.join(certFolder, 'ca.pem'), 'utf8')
    }
}).listen(8443)


hp.createServer({
    target: {
        host: '172.31.146.167',
        port: 8000
    },
}).listen(8000)

whereas the "172.31.146.167" address should be replaced with the one you have on your setup:

outside wsl call:

 wsl hostname -I
@louaybassbouss
Copy link
Collaborator

@mlasak it is possible to replace Node.js proxy with something else like NGINX?

@mlasak
Copy link
Collaborator Author

mlasak commented Feb 29, 2024

@louaybassbouss yes, any proxy should work. NGINX as well. However, it must be running directly on host system.

@jpiesing
Copy link
Contributor

Don't forget that the documentation needs to be updated somewhere to describe this.

@mlasak
Copy link
Collaborator Author

mlasak commented Feb 29, 2024

@jpiesing a proxy is imo only a hack/workaround and should only be used in case of desperation. As well, it turns out, that it really depends on your local network setup and security measures (like firewalls, DNS rebind protection, etc). The question is how far a documentation should go and what level of knowledge can be expected from person setting up the test runner?

I have a running setup on

  • win10
  • using wsl2
  • without docker for desktop (instead docker installed inside wsl2)
  • with free DNS name and SSL certificates

And yes, we will share/update documentation on this

@jpiesing
Copy link
Contributor

@jpiesing a proxy is imo only a hack/workaround and should only be used in case of desperation. As well, it turns out, that it really depends on your local network setup and security measures (like firewalls, DNS rebind protection, etc). The question is how far a documentation should go and what level of knowledge can be expected from person setting up the test runner?

I have a running setup on

  • win10
  • using wsl2
  • without docker for desktop (instead docker installed inside wsl2)
  • with free DNS name and SSL certificates

And yes, we will share/update documentation on this

@mlasak IMHO we should provide limited documentation on using Windows + WSL2 without Docker Desktop.
We should just list things to watch out for and not go into proper depth on how to solve them at the same level as the main supported configurations of Linux and Windows+Docker Desktop.
We have a (old) document on Windows + WSL2 - https://github.com/cta-wave/dpctf-deploy/blob/master/WINDOWS_WSL.md. I think it's enough to review & update that document and perhaps add a few comments about new problems and the type of solution.

Does this sound reasonable?

@mlasak
Copy link
Collaborator Author

mlasak commented Feb 29, 2024

Yes, sounds good. pls close this issue @FritzHeiden once the doc has been updated. Such a documentation should simply point to relevant further sources, like https://learn.microsoft.com/en-us/windows/wsl/networking

Forwarding the traffic from Win -> wsl2 -> test runner in docker requires imo

powershell:

netsh.exe interface portproxy add v4tov4 listenport=8000 listenaddress=0.0.0.0 connectport=8000 connectaddress=(wsl hostname -I)
netsh.exe interface portproxy add v4tov4 listenport=8443 listenaddress=0.0.0.0 connectport=8443 connectaddress=(wsl hostname -I)
netsh.exe interface portproxy add v6tov4 listenport=8000 listenaddress=0.0.0.0 connectport=8000 connectaddress=(wsl hostname -I)
netsh.exe interface portproxy add v6tov4 listenport=8443 listenaddress=0.0.0.0 connectport=8443 connectaddress=(wsl hostname -I)

docker-compose.yml:

network_mode: "host"

Due to the fact that the same setup i tested yesterday in a corporate network in London, today simply work in my home network in Berlin without any additional proxy, i'm fine to close this issue right away. Nothing changed except networking.

Recommend to add info to doc: If you face connectivity issues then please check that firewall, DNS-rebind protection and other network related topics do not block connectivity between your local devices (DUT, test runner host, smartphone)

@jpiesing jpiesing added the documentation Improvements or additions to documentation label Feb 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

4 participants