MichaĆ Wadas
2019-Mar-18 08:32 UTC
ExitOnForwardFailure=yes doesn't exit if adress is already in use and no binding adress is specified
First, let's setup some process that binds to port that we intend to use: python -m SimpleHTTPServer 8000 Then try few commands: ssh -N -L 5000:localhost:5432 foobar # Fails and hangs ssh -o ExitOnForwardFailure=yes -N -L 5000:localhost:5432 foobar # Fails and hangs ssh -N -L 127.0.0.1:5000:localhost:5432 foobar # Fails and hangs ssh -o ExitOnForwardFailure=yes -N -L 127.0.0.1:5000:localhost:5432 foobar # Fails and exits I'm running OpenSSH_7.9p1, OpenSSL 1.0.2n on Ubuntu 18.04 (16.04 + 7.9 fails too).
Damien Miller
2019-Mar-18 22:49 UTC
ExitOnForwardFailure=yes doesn't exit if adress is already in use and no binding adress is specified
On Mon, 18 Mar 2019, Micha? Wadas wrote:> First, let's setup some process that binds to port that we intend to use: > > python -m SimpleHTTPServer 8000This binds to 0.0.0.0:8000 (I presume you meant port 5000 instead)> Then try few commands: > > ssh -N -L 5000:localhost:5432 foobar # Fails and hangs > > ssh -o ExitOnForwardFailure=yes -N -L 5000:localhost:5432 foobar # Fails > and hangs > > ssh -N -L 127.0.0.1:5000:localhost:5432 foobar # Fails and hangs > > ssh -o ExitOnForwardFailure=yes -N -L 127.0.0.1:5000:localhost:5432 foobar > # Fails and exitsThese all bind to 127.0.0.1:5000, a distinct host:port as far as your TCP/IP stack is concerned. There is no collision here. Here's a better test: nc -l ::1 5000 & nc -l 127.0.0.1 5000 & ssh -o ExitOnForwardFailure=yes -N -L 5000:localhost:5432 foo -d