0

I have the following topology:

  • Linux server (Ubuntu 20.04) with static ip
  • Windows server under NAT with no option to forward port to this machine

I need to access securely port of windows server from my linux server.

Currently I have plink.exe wrapped into windows service with nssm tool, configured as reverse proxy forwarding and in general it works - but in plink.exe there seems to be no keep-alive settings and it's very unreliable, connection drops every day and I have to restart the service. There's also no way to customize service in nssm.exe to have any kind of 'healthcheck' and restart logic.

I'm thinking about writing very simple tool on golang, which will observe the connection and restart it if it's lost, but it looks a bit hacky and maybe over-complicated, maybe I'm missing something and I wonder if there's simpler and more reliable way to achieve this kind of task?

Also I was thinking about installing msys2 on windows pc and try using openssh client instead of plink, but I'm not sure I will manage to wrap it as a service finally.

XZen
  • 101
  • 1

1 Answers1

0

Use Plink for non-interactive SSH session (aka "commands") to execute on remote linux maschines for automation purpose. Plink is in no way meant to pe persistent.

If I understand this right, your Windows machine is doing the NAT and is reachable from your connection source. And you are not able to enable port forwarding, like this:

netsh interface portproxy add v4tov4 listenport=22 listenaddress=<WAN IP> connectport=22 connectaddress=<DESTINATION IP>

If that's the case, I would recommend to setup the SSH Server on the windows machine and use the SSH tunnel feature.

bjoster
  • 4,423
  • 5
  • 22
  • 32