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

Static HOST IP was ignored, with fix #190

Closed
tijldeneut opened this issue Mar 28, 2020 · 0 comments · May be fixed by #338
Closed

Static HOST IP was ignored, with fix #190

tijldeneut opened this issue Mar 28, 2020 · 0 comments · May be fixed by #338

Comments

@tijldeneut
Copy link

Tested on (but not related to the issue probably):

  • Node and NPM Version: (v13.12.0 & 6.14.4)
  • Server OS Version / Distribution / Processor Architecture: Windows 10 x64 b1909
  • WebSSH2 release version: 0.3.1-pre-release-0.0
  • OS and Version of SSH server connecting to: Debian10 x64
  • Browser Version and OS: tested with MS Edge & Firefox
  • Any log or messages from the WebSSH2 output

Issue

When entering a static SSH Host IP in config.json (ssh.host), this IP was ignored during HTTP requests (always tries to resolve whatever was behind '/host/'

Fix

Fixed by changing app/server/app.js and putting 'config.ssh.host' in front: when this is put at the default ("host:" null) in the config.json file, it will resolve whatever is after "/host/" in the URL:

Summary:

Potential fix below followed by opening http://localhost:2222/ssh/host/client will send you the IP address configured in json.conf.

app/server/app.js

146,149c146,149
< host: (validator.isIP(req.params.host + '') && req.params.host) ||
<      (validator.isFQDN(req.params.host) && req.params.host) ||
<      (/^(([a-z]|[A-Z]|[0-9]|[!^(){}\-_~])+)?\w$/.test(req.params.host) &&
<      req.params.host) || config.ssh.host,
---
> host: config.ssh.host || (validator.isIP(req.params.host + '') && req.params.host) ||
>      (validator.isFQDN(req.params.host) && req.params.host) ||
>      (/^(([a-z]|[A-Z]|[0-9]|[!^(){}\-_~])+)?\w$/.test(req.params.host) &&
>      req.params.host),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant