#228064 ssh: remote port forwarding (-R) binds always to localhost (ignores -g)

Package:
ssh
Source:
openssh
Description:
secure shell client and server (metapackage)
Submitter:
wave++
Date:
2013-12-10 13:41:49 UTC
Severity:
normal
#228064#5
Date:
2004-01-16 11:23:47 UTC
From:
To:
ssh -g -R port:localhost:port remotehost

netstat -l on remotehost shows:
tcp        0      0 localhost:port          *:* LISTEN     22470/sshd: wavexx
tcp6       0      0 ip6-localhost:port      *:* LISTEN     22470/sshd: wavexx

Using -g should use INADDR_ANY, not localhost.

#228064#10
Date:
2004-04-24 18:39:31 UTC
From:
To:
Hello,
got the same problem today and readed some manpages
at first and used a little bit google also nerved some people on irc ;)

man ssh

#228064#15
Date:
2005-02-01 01:27:40 UTC
From:
To:
This should still be at least a wishlist to change the man page to
clarify that -g only works for -L port forwarding.  In the SSH docs,
"port forwarding" is pretty much described the same for -L and -R
forwarding, so the -g description in the manual should make clear that
it is only for -L forwarding.

Either that, or it should do as it says in the manual and allow remote
hosts to connect to the forwarded port during a -R forwarded port.

#228064#20
Date:
2005-02-01 01:31:02 UTC
From:
To:
(Sorry for two messages instead of one)

The other issue is that with the solution above (change the sshd_config
GatewayPorts setting) it is all or nothing.  With the -g option
combined with the -L option, you can choose to allow remote hosts to
access some forwarded ports but not others.  With the solution above,
there is no way to do this except firewall rules.

#228064#25
Date:
2005-05-20 09:32:16 UTC
From:
To:
+1 for thig bug. Fix, please, -g is very desirable option.
#228064#30
Date:
2006-05-02 00:04:49 UTC
From:
To:
The problem does not occur if one uses
GatewayPorts yes  (server enforces bind to any interface)
GatewayPorts no  (server enforces bind to loopback device)

If using 'clientspecified' on the server (server does what client says)
and issuing (on the client:)

   ssh -g -R 1234:bla:234 blubb

ssh should bind to all interfaces on blubb, as the docs say.
But it only connects to the loopback device.

But using

   ssh -g -R :1234:bla:234 blubb

works as expected.

When using -L instead of -R this problem does not occur.

regards
   --lars

#228064#33
Date:
2013-12-10 13:41:49 UTC
From:
To:
Are you using control sockets by any chance?