You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mina.apache.org by "Andreas Haufler (JIRA)" <ji...@apache.org> on 2018/01/07 18:32:03 UTC
[jira] [Comment Edited] (SSHD-792) Remote Port-Forwarding uses
invalid "original host" values
[ https://issues.apache.org/jira/browse/SSHD-792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16315415#comment-16315415 ]
Andreas Haufler edited comment on SSHD-792 at 1/7/18 6:31 PM:
--------------------------------------------------------------
Thanks for the fast reply. I have attached an example which is nothing more than a nacked SshServer running on port 2222.
1) Launch Forwarder.java
2) Fire up a terminal and invoke ssh -R10001:localhost:6379 localhost -p 2222 -N
Note that 6379 can be replaced by any port for which a server is running locally. For me this happens to be redis, therefore 6379
Also note: Use any Username+Password - won't be checked...
3) Fire up another terminal and invoke "telnet localhost 10001"
Now the 2nd terminal will say: Connection closed by foreign host.
and the 1st one: WARNING: Server requests forwarding for unknown listen_port 10001
*Now:*
4) Fire up a terminal and invoke ssh -R127.0.0.1:10001:localhost:6379 localhost -p 2222 -N
5) Fire up another terminal and invoke "telnet localhost 10001"
And all the sudden it will work.
was (Author: andyha):
Thanks for the fast reply. I have attached an example which is nothing more than a nacked SshServer running on port 2222.
1) Launch Forwarder.java
2) Fire up a terminal and invoke ssh -R10001:localhost:6379 localhost -p 2222 -N
Note that 6379 can be replaced by any port for which a server is running locally. For me this happens to be redis, therefore 6379
Also note: Use any Username+Password - won't be checked...
3) Fire up another terminal and invoke "telnet localhost 10001"
Now the 2nd terminal will say: Connection closed by foreign host.
and the 1st one: WARNING: Server requests forwarding for unknown listen_port 10001
*Now:*
4) Fire up a terminal and invoke ssh -R*127.0.0.1:*10001:localhost:6379 localhost -p 2222 -N
5) Fire up another terminal and invoke "telnet localhost 10001"
And all the sudden it will work.
> Remote Port-Forwarding uses invalid "original host" values
> ----------------------------------------------------------
>
> Key: SSHD-792
> URL: https://issues.apache.org/jira/browse/SSHD-792
> Project: MINA SSHD
> Issue Type: Bug
> Affects Versions: 1.6.0
> Environment: Java 8
> OSX
> Reporter: Andreas Haufler
> Attachments: Forwarder.java
>
>
> When starting a server which accepts all kinds of port forwarding:
> sshd.setTcpipForwardingFilter(new StaticDecisionForwardingFilter(true));
> remote port-forwarding doesn't work (at least when connecting from OSX) unless a specific address is given:
> ssh localhost -p 2222 -R10001:localhost:80 <- doesn't work
> ssh localhost -p 2222 -R127.0.0.1:10001:localhost:80 <- does work
> As far as I can tell, TcpipClientChannel.java:98 uses the underlying socket-address
> of the effective connection and transmit the host (which is either 127.0.0.1 or ::1) on OSX.
> However, the client (ssh) would want to see "localhost" as original host in order to permit tunneling.
> Is there anything I am missing? Otherwise I could provide a PR which fixes this (by remembering the originally requested host and reporting that back).
--
This message was sent by Atlassian JIRA
(v6.4.14#64029)