print unreachable forwarding destinations?

Christian Kujau mindrot at
Thu Dec 21 01:29:39 AEDT 2023

When using LocalForward or DynamicForward sometimes the endpoint does no 
longer exist but I need to find out *which* endpoint exactly. For example:

 $ ssh -D 1234

On the client, maybe in another terminal:

 $ curl --socks5-hostname localhost:1234 http://does-not-exist.local
 curl: (97) connection to proxy closed
As expected. But on the server (OpenSSH 8.4), the following is printed on 

 channel 5: open failed: connect failed: Name or service not known

OK, now in this simple case I know that this is about 
"does-not-exist.local", which I know does not exist. But with multiple 
LocalForward directives specified, and with DynamicForward active too (the 
client is dictating the destination here), I'd like to find out *which* 
name cannot be resolved ("Name or service not known") or contacted.

Current scenario: my web browser is using localhost:1234 as its SOCKS 
proxy and I have some tab open which may send requests to some 
not-existing (or non-resolving) name and my SSH session is semi-flooded 
with these messages above. Why mildly annoying, I'm curious which browser 
tab to close :-)

I tried to strace(1) the sshd process on the remote side to find out, but 
I'm not allowed to ptrace() my own sshd process :(

Does anybody have an idea how to find out the culprit here?

Ideas welcome.

BOFH excuse #190:

Proprietary Information.

More information about the openssh-unix-dev mailing list