0 votes
by (120 points)

when i run tlsproxy in a ssh session, it has the unusual property of detaching from the shell when the session is terminated. this means its ports will stay open and the process will run in the background. running tlsproxy in a command window in the desktop environment behaves differently, as closing the window simply terminates the process. i noticed the ssh tlsproxy will appear with a "services" field when i run tasklist, even if tlsproxy isn't installed as a windows service on that machine (see pic).

what's causing tlsproxy to behave this way and how might i prevent it?

thank

mrunderhill

Applies to: Rebex TLS

1 Answer

0 votes
by (70.4k points)
edited by

Please note that if you start the proxy using command tlsproxy.exe run the application runs as a standard .NET 6 executable. There is no logic for detaching from a shell or binding as a service.

The "Services" field is listed because it runs under the SSH server's service process.

You can try this:
1. On your server, open Powershell window and run tasklist | findstr powershell. You should see something like this:

powershell.exe               25828 Console                    1     79?592 K

2. Connect to your server using SSH and run powershell.exe command (within the SSH session). Run the tasklist | findstr powershell command again and you should see something like this:

powershell.exe               25828 Console                    1     82?392 K
powershell.exe                3256 Services                   0     73?544 K

As you can see, the second powershell.exe process is listed as "Services", but it does not mean there is a powershell.exe service installed on your machine.


Unfortunately, we are not able to reproduce the second issue (with OpenSSH server and client). Can you please share what are you using to establish the SSH session (SSH server, SSH client, issued commands, settings to provoke the behavior)?


UPDATE:
From version 1.8.1 the TLS Proxy reacts to closure of standard input, which solves the reported issue.

by (120 points)
certainly...on my linux machine i run

ssh -n joe@polka "tlsproxy.exe run" > /dev/null &

polka runs windows and an openssh server. the command executes and goes into the background as expected. when i'm done i just kill the ssh process, but tlsproxy still hangs around on polka!
by (70.4k points)
OK, so you are starting the tlsproxy.exe as an SSH remote command. Now, I am able to reproduce the issue as well.

Please note that the "tlsproxy.exe run" command waits for CTRL+C to exit. It behaves exactly same as for example the "ping localhost -t" command, which also waits for CTRL+C to exit.

You can try to run:

ssh -n joe@polka "ping localhost -t" > /dev/null &

Then close the SSH client window. You will see that the PING.exe (and cmd.exe) is listed in active processes (labeled as "Services").

PS> tasklist | findstr "cmd PING"
cmd.exe                      17888 Services                   0      4?612 K
PING.EXE                     43704 Services                   0      4?552 K

To handle SSH client window closure, the tlsproxy would detect end-of-input, which it currently not implemented. However, it seems to be an easy task, so we will add this feature. I will post download link here when new version is ready.
by (70.4k points)
You can download new version 1.8.1 from https://www.rebex.net/tls-proxy/
And try it like this:

  ssh joe@polka "tlsproxy.exe run" > /dev/null &

Please note that -n (or -f) options cannot be used. Those options close the stdin, so the tlsproxy.exe will exit immediately in such case.
by (120 points)
you sir, are a gentleman and a scholar...i tip my fedora!!
...