[jira] [Commented] (SSHD-1055) Remote port forwarding mode does not handle EOF properly
[ https://issues.apache.org/jira/browse/SSHD-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17624564#comment-17624564 ] Alexander Amador commented on SSHD-1055: We were able to download the link you provided and tested and so far not a single error in an environment I would have expected somewhere over a hundred errors. I would call the fix a success. Thank you very much for the quick responses. So, now the next question, is there a way to get this code as part of a release or how is this handled when a fix is needed in short order ? Thanks, Alex > Remote port forwarding mode does not handle EOF properly > > > Key: SSHD-1055 > URL: https://issues.apache.org/jira/browse/SSHD-1055 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: Feng Jiajie >Assignee: Thomas Wolf >Priority: Major > Fix For: 2.9.0 > > Attachments: image001.png > > Time Spent: 1h 10m > Remaining Estimate: 0h > > I want to call the remote server's gRPC service locally through an SSH > tunnel. > MyApp -> MINA SSHD -> \{Internet} -> gRPC Server > It works just fine with OpenSSH, but there is a small problem(no problems > with core functions, only in unusual circumstances) with Mina SSHD. > I think the problem is Mina SSHD's handling of EOF. > Here is the example: > Step 1. Start a gRPC server: > Because we only need a gRPC server to reproduce the problem, so I write a > simple version without any service: > {code:java} > > io.grpc > grpc-netty-shaded > 1.27.2 > > > io.grpc > grpc-protobuf > 1.27.2 > > > io.grpc > grpc-stub > 1.27.2 > > {code} > main: > {code:java} > import io.grpc.Server; > import io.grpc.ServerBuilder; > public class EmptyGrpcServer { > public static void main(String[] args) throws Exception { > Server server = ServerBuilder.forPort(23645).build().start(); > server.awaitTermination(); > } > } > {code} > Full example can be fond here: > [https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java] > > Step 2. Start a MINA SSHD server: > {code:java} > import org.apache.sshd.server.SshServer; > import org.apache.sshd.server.forward.AcceptAllForwardingFilter; > import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; > import java.nio.file.Paths; > public class Example1 { > public static void main(String[] args) throws Exception { > SshServer sshd = SshServer.setUpDefaultServer(); > sshd.setPort(12133); > sshd.setKeyPairProvider(new > SimpleGeneratorHostKeyProvider(Paths.get("/tmp/a.ser"))); > sshd.setPasswordAuthenticator((username, password, session) -> true); > sshd.setForwardingFilter(AcceptAllForwardingFilter.INSTANCE); > sshd.start(); > Thread.sleep(1000); > } > } > {code} > Step 3. Create a channel using ssh client > {code:java} > ssh -o 'ExitOnForwardFailure yes' -vvv -p 12133 -f -x -N -T -R > 0.0.0.0:0:127.0.0.1:23645 test5@127.0.0.1 > {code} > Step 4. Reproduce > If I connect directly to the gRPC server using curl, cause gRPC using http/2, > I would get error output like this: > {code:java} > $ curl 127.0.0.1:23645 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > Then if I do step 3 with an OpenSSH server, I would get same error output: > {code:java} > $ ssh -o 'ExitOnForwardFailure yes' -f -x -N -T -R 0.0.0.0:0:127.0.0.1:23645 > w...@dev.kbyte.cn > Allocated port 13525 for remote forward to 127.0.0.1:23645 > $ > $ curl dev.kbyte.cn:13525 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > But when I do step 3 with MINA SSHD, curl would stuck without any output: > {code:java} > $ curl 127.0.0.1:55604 > {code} > I found MINA SSHD had already got and wrote the package with the string > "Unexpected.HTTP/1.x.request:.GET", and received SSH_MSG_CHANNEL_EOF. > So I think handleEof should do more? like send SSH_MSG_CHANNEL_EOF to curl? > -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-1055) Remote port forwarding mode does not handle EOF properly
[ https://issues.apache.org/jira/browse/SSHD-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17622689#comment-17622689 ] Thomas Wolf commented on SSHD-1055: --- Though perhaps I was mistaken with my quick analysis. Thread #8 does the {{{}shutdownOutputStream(){}}}, but thread #6 gets the exception. I missed that on my first look. So it's unlikely that commit [277563e26|https://github.com/apache/mina-sshd/commit/277563e26] fixed this. I've opened SSHD-1307 for this. Let's continue the discussion there. > Remote port forwarding mode does not handle EOF properly > > > Key: SSHD-1055 > URL: https://issues.apache.org/jira/browse/SSHD-1055 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: Feng Jiajie >Assignee: Thomas Wolf >Priority: Major > Fix For: 2.9.0 > > Attachments: image001.png > > Time Spent: 1h 10m > Remaining Estimate: 0h > > I want to call the remote server's gRPC service locally through an SSH > tunnel. > MyApp -> MINA SSHD -> \{Internet} -> gRPC Server > It works just fine with OpenSSH, but there is a small problem(no problems > with core functions, only in unusual circumstances) with Mina SSHD. > I think the problem is Mina SSHD's handling of EOF. > Here is the example: > Step 1. Start a gRPC server: > Because we only need a gRPC server to reproduce the problem, so I write a > simple version without any service: > {code:java} > > io.grpc > grpc-netty-shaded > 1.27.2 > > > io.grpc > grpc-protobuf > 1.27.2 > > > io.grpc > grpc-stub > 1.27.2 > > {code} > main: > {code:java} > import io.grpc.Server; > import io.grpc.ServerBuilder; > public class EmptyGrpcServer { > public static void main(String[] args) throws Exception { > Server server = ServerBuilder.forPort(23645).build().start(); > server.awaitTermination(); > } > } > {code} > Full example can be fond here: > [https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java] > > Step 2. Start a MINA SSHD server: > {code:java} > import org.apache.sshd.server.SshServer; > import org.apache.sshd.server.forward.AcceptAllForwardingFilter; > import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; > import java.nio.file.Paths; > public class Example1 { > public static void main(String[] args) throws Exception { > SshServer sshd = SshServer.setUpDefaultServer(); > sshd.setPort(12133); > sshd.setKeyPairProvider(new > SimpleGeneratorHostKeyProvider(Paths.get("/tmp/a.ser"))); > sshd.setPasswordAuthenticator((username, password, session) -> true); > sshd.setForwardingFilter(AcceptAllForwardingFilter.INSTANCE); > sshd.start(); > Thread.sleep(1000); > } > } > {code} > Step 3. Create a channel using ssh client > {code:java} > ssh -o 'ExitOnForwardFailure yes' -vvv -p 12133 -f -x -N -T -R > 0.0.0.0:0:127.0.0.1:23645 test5@127.0.0.1 > {code} > Step 4. Reproduce > If I connect directly to the gRPC server using curl, cause gRPC using http/2, > I would get error output like this: > {code:java} > $ curl 127.0.0.1:23645 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > Then if I do step 3 with an OpenSSH server, I would get same error output: > {code:java} > $ ssh -o 'ExitOnForwardFailure yes' -f -x -N -T -R 0.0.0.0:0:127.0.0.1:23645 > w...@dev.kbyte.cn > Allocated port 13525 for remote forward to 127.0.0.1:23645 > $ > $ curl dev.kbyte.cn:13525 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > But when I do step 3 with MINA SSHD, curl would stuck without any output: > {code:java} > $ curl 127.0.0.1:55604 > {code} > I found MINA SSHD had already got and wrote the package with the string > "Unexpected.HTTP/1.x.request:.GET", and received SSH_MSG_CHANNEL_EOF. > So I think handleEof should do more? like send SSH_MSG_CHANNEL_EOF to curl? > -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-1055) Remote port forwarding mode does not handle EOF properly
[ https://issues.apache.org/jira/browse/SSHD-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17622672#comment-17622672 ] Thomas Wolf commented on SSHD-1055: --- Yes. It's also available on GitHub: [https://github.com/apache/mina-sshd]. > Remote port forwarding mode does not handle EOF properly > > > Key: SSHD-1055 > URL: https://issues.apache.org/jira/browse/SSHD-1055 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: Feng Jiajie >Assignee: Thomas Wolf >Priority: Major > Fix For: 2.9.0 > > Attachments: image001.png > > Time Spent: 1h 10m > Remaining Estimate: 0h > > I want to call the remote server's gRPC service locally through an SSH > tunnel. > MyApp -> MINA SSHD -> \{Internet} -> gRPC Server > It works just fine with OpenSSH, but there is a small problem(no problems > with core functions, only in unusual circumstances) with Mina SSHD. > I think the problem is Mina SSHD's handling of EOF. > Here is the example: > Step 1. Start a gRPC server: > Because we only need a gRPC server to reproduce the problem, so I write a > simple version without any service: > {code:java} > > io.grpc > grpc-netty-shaded > 1.27.2 > > > io.grpc > grpc-protobuf > 1.27.2 > > > io.grpc > grpc-stub > 1.27.2 > > {code} > main: > {code:java} > import io.grpc.Server; > import io.grpc.ServerBuilder; > public class EmptyGrpcServer { > public static void main(String[] args) throws Exception { > Server server = ServerBuilder.forPort(23645).build().start(); > server.awaitTermination(); > } > } > {code} > Full example can be fond here: > [https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java] > > Step 2. Start a MINA SSHD server: > {code:java} > import org.apache.sshd.server.SshServer; > import org.apache.sshd.server.forward.AcceptAllForwardingFilter; > import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; > import java.nio.file.Paths; > public class Example1 { > public static void main(String[] args) throws Exception { > SshServer sshd = SshServer.setUpDefaultServer(); > sshd.setPort(12133); > sshd.setKeyPairProvider(new > SimpleGeneratorHostKeyProvider(Paths.get("/tmp/a.ser"))); > sshd.setPasswordAuthenticator((username, password, session) -> true); > sshd.setForwardingFilter(AcceptAllForwardingFilter.INSTANCE); > sshd.start(); > Thread.sleep(1000); > } > } > {code} > Step 3. Create a channel using ssh client > {code:java} > ssh -o 'ExitOnForwardFailure yes' -vvv -p 12133 -f -x -N -T -R > 0.0.0.0:0:127.0.0.1:23645 test5@127.0.0.1 > {code} > Step 4. Reproduce > If I connect directly to the gRPC server using curl, cause gRPC using http/2, > I would get error output like this: > {code:java} > $ curl 127.0.0.1:23645 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > Then if I do step 3 with an OpenSSH server, I would get same error output: > {code:java} > $ ssh -o 'ExitOnForwardFailure yes' -f -x -N -T -R 0.0.0.0:0:127.0.0.1:23645 > w...@dev.kbyte.cn > Allocated port 13525 for remote forward to 127.0.0.1:23645 > $ > $ curl dev.kbyte.cn:13525 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > But when I do step 3 with MINA SSHD, curl would stuck without any output: > {code:java} > $ curl 127.0.0.1:55604 > {code} > I found MINA SSHD had already got and wrote the package with the string > "Unexpected.HTTP/1.x.request:.GET", and received SSH_MSG_CHANNEL_EOF. > So I think handleEof should do more? like send SSH_MSG_CHANNEL_EOF to curl? > -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-1055) Remote port forwarding mode does not handle EOF properly
[ https://issues.apache.org/jira/browse/SSHD-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17622669#comment-17622669 ] Alexander Amador commented on SSHD-1055: Yes, I agree, that is where the problems appear to start. I will give the master a shot. I am new to using a forum like this, so please bear with me. I downloaded the snapshot labeled master from this page... https://gitbox.apache.org/repos/asf?p=mina-sshd.git This is what you were meaning right ? > Remote port forwarding mode does not handle EOF properly > > > Key: SSHD-1055 > URL: https://issues.apache.org/jira/browse/SSHD-1055 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: Feng Jiajie >Assignee: Thomas Wolf >Priority: Major > Fix For: 2.9.0 > > Attachments: image001.png > > Time Spent: 1h 10m > Remaining Estimate: 0h > > I want to call the remote server's gRPC service locally through an SSH > tunnel. > MyApp -> MINA SSHD -> \{Internet} -> gRPC Server > It works just fine with OpenSSH, but there is a small problem(no problems > with core functions, only in unusual circumstances) with Mina SSHD. > I think the problem is Mina SSHD's handling of EOF. > Here is the example: > Step 1. Start a gRPC server: > Because we only need a gRPC server to reproduce the problem, so I write a > simple version without any service: > {code:java} > > io.grpc > grpc-netty-shaded > 1.27.2 > > > io.grpc > grpc-protobuf > 1.27.2 > > > io.grpc > grpc-stub > 1.27.2 > > {code} > main: > {code:java} > import io.grpc.Server; > import io.grpc.ServerBuilder; > public class EmptyGrpcServer { > public static void main(String[] args) throws Exception { > Server server = ServerBuilder.forPort(23645).build().start(); > server.awaitTermination(); > } > } > {code} > Full example can be fond here: > [https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java] > > Step 2. Start a MINA SSHD server: > {code:java} > import org.apache.sshd.server.SshServer; > import org.apache.sshd.server.forward.AcceptAllForwardingFilter; > import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; > import java.nio.file.Paths; > public class Example1 { > public static void main(String[] args) throws Exception { > SshServer sshd = SshServer.setUpDefaultServer(); > sshd.setPort(12133); > sshd.setKeyPairProvider(new > SimpleGeneratorHostKeyProvider(Paths.get("/tmp/a.ser"))); > sshd.setPasswordAuthenticator((username, password, session) -> true); > sshd.setForwardingFilter(AcceptAllForwardingFilter.INSTANCE); > sshd.start(); > Thread.sleep(1000); > } > } > {code} > Step 3. Create a channel using ssh client > {code:java} > ssh -o 'ExitOnForwardFailure yes' -vvv -p 12133 -f -x -N -T -R > 0.0.0.0:0:127.0.0.1:23645 test5@127.0.0.1 > {code} > Step 4. Reproduce > If I connect directly to the gRPC server using curl, cause gRPC using http/2, > I would get error output like this: > {code:java} > $ curl 127.0.0.1:23645 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > Then if I do step 3 with an OpenSSH server, I would get same error output: > {code:java} > $ ssh -o 'ExitOnForwardFailure yes' -f -x -N -T -R 0.0.0.0:0:127.0.0.1:23645 > w...@dev.kbyte.cn > Allocated port 13525 for remote forward to 127.0.0.1:23645 > $ > $ curl dev.kbyte.cn:13525 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > But when I do step 3 with MINA SSHD, curl would stuck without any output: > {code:java} > $ curl 127.0.0.1:55604 > {code} > I found MINA SSHD had already got and wrote the package with the string > "Unexpected.HTTP/1.x.request:.GET", and received SSH_MSG_CHANNEL_EOF. > So I think handleEof should do more? like send SSH_MSG_CHANNEL_EOF to curl? > -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-1055) Remote port forwarding mode does not handle EOF properly
[ https://issues.apache.org/jira/browse/SSHD-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17622629#comment-17622629 ] Thomas Wolf commented on SSHD-1055: --- [~alexander.ama...@oracle.com] : I suspect the real problem is not the exception backtrace at 09:16:42.883. That one appears to be a follow-up error of an earlier problem: {code:java} 09:16:42.873 [sshd-SshClient[477424ca]-nio2-thread-8] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - shudownOutputStream(Nio2Session[local=/127.0.0.1:9000, remote=/127.0.0.1:62027]) 09:16:42.875 [sshd-SshClient[477424ca]-nio2-thread-6] DEBUG org.apache.sshd.common.io.nio2.Nio2Session - handleWriteCycleFailure(Nio2Session[local=/127.0.0.1:9000, remote=/127.0.0.1:62027]) failed (ClosedChannelException) to write 115 bytes at write cycle=17 afer 987500 nanos: null {code} (The log message at 09:16:42.875 has a typo :-/ ) Apparently {{shutdownOutputStream()}} got a {{{}ClosedChannelException{}}}. This looks suspiciously like the problem fixed in commit [277563e26|https://github.com/apache/mina-sshd/commit/277563e26]. Can you try running with current master and see if the problem still occurs? > Remote port forwarding mode does not handle EOF properly > > > Key: SSHD-1055 > URL: https://issues.apache.org/jira/browse/SSHD-1055 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: Feng Jiajie >Assignee: Thomas Wolf >Priority: Major > Fix For: 2.9.0 > > Attachments: image001.png > > Time Spent: 1h 10m > Remaining Estimate: 0h > > I want to call the remote server's gRPC service locally through an SSH > tunnel. > MyApp -> MINA SSHD -> \{Internet} -> gRPC Server > It works just fine with OpenSSH, but there is a small problem(no problems > with core functions, only in unusual circumstances) with Mina SSHD. > I think the problem is Mina SSHD's handling of EOF. > Here is the example: > Step 1. Start a gRPC server: > Because we only need a gRPC server to reproduce the problem, so I write a > simple version without any service: > {code:java} > > io.grpc > grpc-netty-shaded > 1.27.2 > > > io.grpc > grpc-protobuf > 1.27.2 > > > io.grpc > grpc-stub > 1.27.2 > > {code} > main: > {code:java} > import io.grpc.Server; > import io.grpc.ServerBuilder; > public class EmptyGrpcServer { > public static void main(String[] args) throws Exception { > Server server = ServerBuilder.forPort(23645).build().start(); > server.awaitTermination(); > } > } > {code} > Full example can be fond here: > [https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java] > > Step 2. Start a MINA SSHD server: > {code:java} > import org.apache.sshd.server.SshServer; > import org.apache.sshd.server.forward.AcceptAllForwardingFilter; > import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; > import java.nio.file.Paths; > public class Example1 { > public static void main(String[] args) throws Exception { > SshServer sshd = SshServer.setUpDefaultServer(); > sshd.setPort(12133); > sshd.setKeyPairProvider(new > SimpleGeneratorHostKeyProvider(Paths.get("/tmp/a.ser"))); > sshd.setPasswordAuthenticator((username, password, session) -> true); > sshd.setForwardingFilter(AcceptAllForwardingFilter.INSTANCE); > sshd.start(); > Thread.sleep(1000); > } > } > {code} > Step 3. Create a channel using ssh client > {code:java} > ssh -o 'ExitOnForwardFailure yes' -vvv -p 12133 -f -x -N -T -R > 0.0.0.0:0:127.0.0.1:23645 test5@127.0.0.1 > {code} > Step 4. Reproduce > If I connect directly to the gRPC server using curl, cause gRPC using http/2, > I would get error output like this: > {code:java} > $ curl 127.0.0.1:23645 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > Then if I do step 3 with an OpenSSH server, I would get same error output: > {code:java} > $ ssh -o 'ExitOnForwardFailure yes' -f -x -N -T -R 0.0.0.0:0:127.0.0.1:23645 > w...@dev.kbyte.cn > Allocated port 13525 for remote forward to 127.0.0.1:23645 > $ > $ curl dev.kbyte.cn:13525 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > But when I do step 3 with MINA SSHD, curl would stuck without any output: > {code:java} > $ curl 127.0.0.1:55604 > {code} > I found MINA SSHD had already got and wrote the package with the string > "Unexpected.HTTP/1.x.request:.GET", and received SSH_MSG_CHANNEL_EOF. > So I think handleEof should do more? like send SSH_MSG_CHANNEL_EOF to curl? > -- This message was sent by Atlassian Jira (v8.20.10#820010) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail:
[jira] [Commented] (SSHD-1055) Remote port forwarding mode does not handle EOF properly
[ https://issues.apache.org/jira/browse/SSHD-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17553338#comment-17553338 ] Thomas Wolf commented on SSHD-1055: --- In SSHD-964, it was claimed that {quote}When a SSH_MSG_CHANNEL_EOF is received In TcpipClientChannel.handleEof() serverSession.shudownOutputStream() causes the socket between SSH client and SSH server to be closed, and this is not the right behaviour. {code} @Override public void handleEof() throws IOException { super.handleEof(); serverSession.shudownOutputStream(); } {code} {quote} That is wrong. "Between SSH client and SSH server" would be the tunnel. This does _not_ shut down output on the tunnel; it shuts down output on the forwarded port's socket on that end. I.e., it propagates the EOF out to the whatever is connected on that socket. In the diagrams shown at https://github.com/apache/mina-sshd/blob/b91a424/docs/technical/tcpip-forwarding.md , this shuts down output on "A", not on the tunnel. > Remote port forwarding mode does not handle EOF properly > > > Key: SSHD-1055 > URL: https://issues.apache.org/jira/browse/SSHD-1055 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: Feng Jiajie >Assignee: Thomas Wolf >Priority: Major > Time Spent: 0.5h > Remaining Estimate: 0h > > I want to call the remote server's gRPC service locally through an SSH > tunnel. > MyApp -> MINA SSHD -> \{Internet} -> gRPC Server > It works just fine with OpenSSH, but there is a small problem(no problems > with core functions, only in unusual circumstances) with Mina SSHD. > I think the problem is Mina SSHD's handling of EOF. > Here is the example: > Step 1. Start a gRPC server: > Because we only need a gRPC server to reproduce the problem, so I write a > simple version without any service: > {code:java} > > io.grpc > grpc-netty-shaded > 1.27.2 > > > io.grpc > grpc-protobuf > 1.27.2 > > > io.grpc > grpc-stub > 1.27.2 > > {code} > main: > {code:java} > import io.grpc.Server; > import io.grpc.ServerBuilder; > public class EmptyGrpcServer { > public static void main(String[] args) throws Exception { > Server server = ServerBuilder.forPort(23645).build().start(); > server.awaitTermination(); > } > } > {code} > Full example can be fond here: > [https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java] > > Step 2. Start a MINA SSHD server: > {code:java} > import org.apache.sshd.server.SshServer; > import org.apache.sshd.server.forward.AcceptAllForwardingFilter; > import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; > import java.nio.file.Paths; > public class Example1 { > public static void main(String[] args) throws Exception { > SshServer sshd = SshServer.setUpDefaultServer(); > sshd.setPort(12133); > sshd.setKeyPairProvider(new > SimpleGeneratorHostKeyProvider(Paths.get("/tmp/a.ser"))); > sshd.setPasswordAuthenticator((username, password, session) -> true); > sshd.setForwardingFilter(AcceptAllForwardingFilter.INSTANCE); > sshd.start(); > Thread.sleep(1000); > } > } > {code} > Step 3. Create a channel using ssh client > {code:java} > ssh -o 'ExitOnForwardFailure yes' -vvv -p 12133 -f -x -N -T -R > 0.0.0.0:0:127.0.0.1:23645 test5@127.0.0.1 > {code} > Step 4. Reproduce > If I connect directly to the gRPC server using curl, cause gRPC using http/2, > I would get error output like this: > {code:java} > $ curl 127.0.0.1:23645 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > Then if I do step 3 with an OpenSSH server, I would get same error output: > {code:java} > $ ssh -o 'ExitOnForwardFailure yes' -f -x -N -T -R 0.0.0.0:0:127.0.0.1:23645 > w...@dev.kbyte.cn > Allocated port 13525 for remote forward to 127.0.0.1:23645 > $ > $ curl dev.kbyte.cn:13525 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > But when I do step 3 with MINA SSHD, curl would stuck without any output: > {code:java} > $ curl 127.0.0.1:55604 > {code} > I found MINA SSHD had already got and wrote the package with the string > "Unexpected.HTTP/1.x.request:.GET", and received SSH_MSG_CHANNEL_EOF. > So I think handleEof should do more? like send SSH_MSG_CHANNEL_EOF to curl? > -- This message was sent by Atlassian Jira (v8.20.7#820007) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-1055) Remote port forwarding mode does not handle EOF properly
[ https://issues.apache.org/jira/browse/SSHD-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17553292#comment-17553292 ] Thomas Wolf commented on SSHD-1055: --- [PR 227|https://github.com/apache/mina-sshd/pull/227] re-adds shutting down the output on the forwarded socket when we get an EOF in the tunnel. It includes [~fengjiajie]'s manual test case as an automated test, using OpenSSH 9.0 in a testcontainer for the remote port forwarding. The test exhibits the same behavior as reported here: if we don't shut down the socket output on EOF, the client connected to the forwarded port just hangs. If we _do_ shut down the output, the test succeeds: the client does get the error message, and then the connection is closed. Unfortunately I do not see any automated tests for SSHD-902 or SSHD-964. So I'm inclined to merge this PR to fix SSHD-1055, and if that re-introduces SSHD-964, I'd consider fixing it only if we _first_ get a unit test showing what exactly the problem in SSHD-964 is. > Remote port forwarding mode does not handle EOF properly > > > Key: SSHD-1055 > URL: https://issues.apache.org/jira/browse/SSHD-1055 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: Feng Jiajie >Assignee: Thomas Wolf >Priority: Major > Time Spent: 10m > Remaining Estimate: 0h > > I want to call the remote server's gRPC service locally through an SSH > tunnel. > MyApp -> MINA SSHD -> \{Internet} -> gRPC Server > It works just fine with OpenSSH, but there is a small problem(no problems > with core functions, only in unusual circumstances) with Mina SSHD. > I think the problem is Mina SSHD's handling of EOF. > Here is the example: > Step 1. Start a gRPC server: > Because we only need a gRPC server to reproduce the problem, so I write a > simple version without any service: > {code:java} > > io.grpc > grpc-netty-shaded > 1.27.2 > > > io.grpc > grpc-protobuf > 1.27.2 > > > io.grpc > grpc-stub > 1.27.2 > > {code} > main: > {code:java} > import io.grpc.Server; > import io.grpc.ServerBuilder; > public class EmptyGrpcServer { > public static void main(String[] args) throws Exception { > Server server = ServerBuilder.forPort(23645).build().start(); > server.awaitTermination(); > } > } > {code} > Full example can be fond here: > [https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java] > > Step 2. Start a MINA SSHD server: > {code:java} > import org.apache.sshd.server.SshServer; > import org.apache.sshd.server.forward.AcceptAllForwardingFilter; > import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; > import java.nio.file.Paths; > public class Example1 { > public static void main(String[] args) throws Exception { > SshServer sshd = SshServer.setUpDefaultServer(); > sshd.setPort(12133); > sshd.setKeyPairProvider(new > SimpleGeneratorHostKeyProvider(Paths.get("/tmp/a.ser"))); > sshd.setPasswordAuthenticator((username, password, session) -> true); > sshd.setForwardingFilter(AcceptAllForwardingFilter.INSTANCE); > sshd.start(); > Thread.sleep(1000); > } > } > {code} > Step 3. Create a channel using ssh client > {code:java} > ssh -o 'ExitOnForwardFailure yes' -vvv -p 12133 -f -x -N -T -R > 0.0.0.0:0:127.0.0.1:23645 test5@127.0.0.1 > {code} > Step 4. Reproduce > If I connect directly to the gRPC server using curl, cause gRPC using http/2, > I would get error output like this: > {code:java} > $ curl 127.0.0.1:23645 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > Then if I do step 3 with an OpenSSH server, I would get same error output: > {code:java} > $ ssh -o 'ExitOnForwardFailure yes' -f -x -N -T -R 0.0.0.0:0:127.0.0.1:23645 > w...@dev.kbyte.cn > Allocated port 13525 for remote forward to 127.0.0.1:23645 > $ > $ curl dev.kbyte.cn:13525 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > But when I do step 3 with MINA SSHD, curl would stuck without any output: > {code:java} > $ curl 127.0.0.1:55604 > {code} > I found MINA SSHD had already got and wrote the package with the string > "Unexpected.HTTP/1.x.request:.GET", and received SSH_MSG_CHANNEL_EOF. > So I think handleEof should do more? like send SSH_MSG_CHANNEL_EOF to curl? > -- This message was sent by Atlassian Jira (v8.20.7#820007) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-1055) Remote port forwarding mode does not handle EOF properly
[ https://issues.apache.org/jira/browse/SSHD-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17551764#comment-17551764 ] Thomas Wolf commented on SSHD-1055: --- This is still reproducible on current master, using OpenSSH 7.9. Though I have to start the SSH client (with remote port forwarding) as {code:java} ssh -o 'ExitOnForwardFailure yes' -o 'StrictHostKeyChecking off' -vvv -p 12133 -f -x -N -T -R 127.0.0.1:4567:127.0.0.1:23645 test5@127.0.0.1 {code} and then {code:java} curl 127.0.0.1:4567 {code} to get the example to work. The hang is indeed caused by not shutting down the output when an EOF is received in {{{}TcpipClientChannel{}}}. If the code removed in [https://github.com/apache/mina-sshd/commit/385f63731e74d0c73b6624170bfd1ad385ebffc6] is re-instatiated, behavior is as expected. I see the gRPC server logging: {code:java} 20:50:30.079 [grpc-nio-worker-ELG-3-1] DEBUG io.grpc.netty.shaded.io.grpc.netty.NettyServerHandler - [id: 0xe7c489a5, L:/127.0.0.1:23645 - R:/127.0.0.1:58972] OUTBOUND GO_AWAY: lastStreamId=0 errorCode=1 length=35 bytes=556e657870656374656420485454502f312e7820726571756573743a20474554202f20 20:50:30.081 [grpc-nio-worker-ELG-3-1] DEBUG io.grpc.netty.shaded.io.netty.handler.codec.http2.Http2ConnectionHandler - [id: 0xe7c489a5, L:/127.0.0.1:23645 - R:/127.0.0.1:58972] Sent GOAWAY: lastStreamId '0', errorCode '1', debugData 'Unexpected HTTP/1.x request: GET / '. Forcing shutdown of the connection. {code} In response to that, the OpenSSH client sends the EOF, which in the Apache MINA sshd server's {{TcpipClientChannel}} only sets a flag. It seems to me propagating this EOF to whatever is connected on the socket on that end ({{{}curl{}}} in the example case) by calling {{serverSession.shutdownOutputStream()}} might not be totally wrong. (But see below: should we get not only an EOF but also a CLOSE?) Note that if {{TcpipClientChannel}} needs to have this {{shutDownOutputStream()}} re-added, then probably {{TcpipServerChannel}} also needs to do so to handle the inverse case properly. The removal of this code in SSHD-964 was accompanied by much uncertainty, and unfortunately SSHD-964 doesn't explain why it was removed. The issue itself was about EOF not being sent... why exactly was it removed?? (Or phrased differently: what breaks if it is re-added?) OTOH: can someone try this example with a modern OpenSSH (9.0)? Maybe OpenSSH should not only send an EOF but also a SSH_MSG_CHANNEL_CLOSE? That would be a somewhat more logical moment to shut down the socket output. > Remote port forwarding mode does not handle EOF properly > > > Key: SSHD-1055 > URL: https://issues.apache.org/jira/browse/SSHD-1055 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: Feng Jiajie >Priority: Major > > I want to call the remote server's gRPC service locally through an SSH > tunnel. > MyApp -> MINA SSHD -> \{Internet} -> gRPC Server > It works just fine with OpenSSH, but there is a small problem(no problems > with core functions, only in unusual circumstances) with Mina SSHD. > I think the problem is Mina SSHD's handling of EOF. > Here is the example: > Step 1. Start a gRPC server: > Because we only need a gRPC server to reproduce the problem, so I write a > simple version without any service: > {code:java} > > io.grpc > grpc-netty-shaded > 1.27.2 > > > io.grpc > grpc-protobuf > 1.27.2 > > > io.grpc > grpc-stub > 1.27.2 > > {code} > main: > {code:java} > import io.grpc.Server; > import io.grpc.ServerBuilder; > public class EmptyGrpcServer { > public static void main(String[] args) throws Exception { > Server server = ServerBuilder.forPort(23645).build().start(); > server.awaitTermination(); > } > } > {code} > Full example can be fond here: > [https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java] > > Step 2. Start a MINA SSHD server: > {code:java} > import org.apache.sshd.server.SshServer; > import org.apache.sshd.server.forward.AcceptAllForwardingFilter; > import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; > import java.nio.file.Paths; > public class Example1 { > public static void main(String[] args) throws Exception { > SshServer sshd = SshServer.setUpDefaultServer(); > sshd.setPort(12133); > sshd.setKeyPairProvider(new > SimpleGeneratorHostKeyProvider(Paths.get("/tmp/a.ser"))); > sshd.setPasswordAuthenticator((username, password, session) -> true); > sshd.setForwardingFilter(AcceptAllForwardingFilter.INSTANCE); > sshd.start(); > Thread.sleep(1000); > } > } > {code} > Step 3. Create a channel using ssh client > {code:java} > ssh -o 'ExitOnForwardFailure yes' -vvv -p
[jira] [Commented] (SSHD-1055) Remote port forwarding mode does not handle EOF properly
[ https://issues.apache.org/jira/browse/SSHD-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17189083#comment-17189083 ] Feng Jiajie commented on SSHD-1055: --- Hi [~lgoldstein], [~roberto.deandrea] I got some log using openssh server debug mode: {code:java} debug1: Connection to port 15678 forwarding to 0.0.0.0 port 0 requested. debug2: fd 12 setting TCP_NODELAY debug2: fd 12 setting O_NONBLOCK debug3: fd 12 is O_NONBLOCK debug1: channel 2: new [forwarded-tcpip] debug3: send packet: type 90 debug3: receive packet: type 91 debug2: channel 2: open confirm rwindow 2097152 rmax 32768 debug3: receive packet: type 96 debug2: channel 2: rcvd eof // = begin eof handle debug2: channel 2: output open -> drain debug2: channel 2: obuf empty debug2: channel 2: chan_shutdown_write (i0 o1 sock 12 wfd 12 efd -1 [closed]) debug2: channel 2: output drain -> closed debug2: channel 2: read<=0 rfd 12 len 0 debug2: channel 2: read failed debug2: channel 2: chan_shutdown_read (i0 o3 sock 12 wfd 12 efd -1 [closed]) debug2: channel 2: input open -> drain debug2: channel 2: ibuf empty debug2: channel 2: send eof debug3: send packet: type 96 debug2: channel 2: input drain -> closed debug2: channel 2: send close debug3: send packet: type 97 debug3: channel 2: will not send data after close debug3: receive packet: type 97 debug2: channel 2: rcvd close debug3: channel 2: will not send data after close debug2: channel 2: is dead debug2: channel 2: garbage collecting debug1: channel 2: free: forwarded-tcpip: listening port 15678 for 0.0.0.0 port 0, connect from ::1 port 40480 to ::1 port 15678, nchannels 3 debug3: channel 2: status: The following connections are open: #2 forwarded-tcpip: listening port 15678 for 0.0.0.0 port 0, connect from ::1 port 40480 to ::1 port 15678 (t4 r0 i3/0 o3/0 e[closed]/0 fd 12/12/-1 sock 12 cc -1) {code} [https://github.com/openssh/openssh-portable/blob/V_7_9_P1/serverloop.c#L906] {code:java} ssh_dispatch_set(ssh, SSH2_MSG_CHANNEL_EOF, _input_ieof); // = call channel_input_ieof {code} [https://github.com/openssh/openssh-portable/blob/V_7_9_P1/channels.c#L3095] {code:java} int channel_input_ieof(int type, u_int32_t seq, struct ssh *ssh) { Channel *c = channel_from_packet_id(ssh, __func__, "ieof"); ssh_packet_check_eom(ssh); if (channel_proxy_upstream(c, type, seq, ssh)) return 0; chan_rcvd_ieof(ssh, c); // === call chan_rcvd_ieof /* XXX force input close */ if (c->force_drain && c->istate == CHAN_INPUT_OPEN) { debug("channel %d: FORCE input drain", c->self); c->istate = CHAN_INPUT_WAIT_DRAIN; if (sshbuf_len(c->input) == 0) chan_ibuf_empty(ssh, c); } return 0; } {code} [https://github.com/openssh/openssh-portable/blob/V_7_9_P1/nchan.c] {code:java} void chan_rcvd_ieof(struct ssh *ssh, Channel *c) { debug2("channel %d: rcvd eof", c->self);// === log debug2: channel 2: rcvd eof c->flags |= CHAN_EOF_RCVD; if (c->ostate == CHAN_OUTPUT_OPEN) chan_set_ostate(c, CHAN_OUTPUT_WAIT_DRAIN); // = log debug2: channel 2: output open -> drain if (c->ostate == CHAN_OUTPUT_WAIT_DRAIN && sshbuf_len(c->output) == 0 && !CHANNEL_EFD_OUTPUT_ACTIVE(c)) chan_obuf_empty(ssh, c); // === call chan_obuf_empty }{code} [https://github.com/openssh/openssh-portable/blob/V_7_9_P1/nchan.c#L147] {code:java} void chan_obuf_empty(struct ssh *ssh, Channel *c) { debug2("channel %d: obuf empty", c->self); // = debug2: channel 2: obuf empty if (sshbuf_len(c->output)) { error("channel %d: chan_obuf_empty for non empty buffer", c->self); return; } switch (c->ostate) { case CHAN_OUTPUT_WAIT_DRAIN: chan_shutdown_write(ssh, c); // == call chan_shutdown_write chan_set_ostate(c, CHAN_OUTPUT_CLOSED); // log debug2: channel 2: output drain -> closed break; default: error("channel %d: internal error: obuf_empty for ostate %d", c->self, c->ostate); break; } }{code} [https://github.com/openssh/openssh-portable/blob/V_7_9_P1/nchan.c#L373] {code:java} static void chan_shutdown_write(struct ssh *ssh, Channel *c) { sshbuf_reset(c->output); if (c->type == SSH_CHANNEL_LARVAL) return; /* shutdown failure is allowed if write failed already */ debug2("channel %d: %s (i%d o%d sock %d wfd %d efd %d [%s])", // log debug2: channel 2: chan_shutdown_write (i0 o1 sock 12 wfd 12 efd -1 [closed]) c->self, __func__, c->istate, c->ostate, c->sock, c->wfd, c->efd, channel_format_extended_usage(c)); if (c->sock != -1) { if (shutdown(c->sock, SHUT_WR) < 0) { // call shutdown fd SHUT_WR debug2("channel %d: %s: shutdown() failed for " "fd %d [i%d o%d]: %.100s", c->self, __func__, c->sock, c->istate,
[jira] [Commented] (SSHD-1055) Remote port forwarding mode does not handle EOF properly
[ https://issues.apache.org/jira/browse/SSHD-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17185759#comment-17185759 ] Feng Jiajie commented on SSHD-1055: --- Maybe it is related to this: [https://github.com/apache/mina-sshd/commit/385f63731e74d0c73b6624170bfd1ad385ebffc6] > Remote port forwarding mode does not handle EOF properly > > > Key: SSHD-1055 > URL: https://issues.apache.org/jira/browse/SSHD-1055 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: Feng Jiajie >Priority: Major > > I want to call the remote server's gRPC service locally through an SSH > tunnel. > MyApp -> MINA SSHD -> \{Internet} -> gRPC Server > It works just fine with OpenSSH, but there is a small problem(no problems > with core functions, only in unusual circumstances) with Mina SSHD. > I think the problem is Mina SSHD's handling of EOF. > Here is the example: > Step 1. Start a gRPC server: > Because we only need a gRPC server to reproduce the problem, so I write a > simple version without any service: > {code:java} > > io.grpc > grpc-netty-shaded > 1.27.2 > > > io.grpc > grpc-protobuf > 1.27.2 > > > io.grpc > grpc-stub > 1.27.2 > > {code} > main: > {code:java} > import io.grpc.Server; > import io.grpc.ServerBuilder; > public class EmptyGrpcServer { > public static void main(String[] args) throws Exception { > Server server = ServerBuilder.forPort(23645).build().start(); > server.awaitTermination(); > } > } > {code} > Full example can be fond here: > [https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java] > > Step 2. Start a MINA SSHD server: > {code:java} > import org.apache.sshd.server.SshServer; > import org.apache.sshd.server.forward.AcceptAllForwardingFilter; > import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; > import java.nio.file.Paths; > public class Example1 { > public static void main(String[] args) throws Exception { > SshServer sshd = SshServer.setUpDefaultServer(); > sshd.setPort(12133); > sshd.setKeyPairProvider(new > SimpleGeneratorHostKeyProvider(Paths.get("/tmp/a.ser"))); > sshd.setPasswordAuthenticator((username, password, session) -> true); > sshd.setForwardingFilter(AcceptAllForwardingFilter.INSTANCE); > sshd.start(); > Thread.sleep(1000); > } > } > {code} > Step 3. Create a channel using ssh client > {code:java} > ssh -o 'ExitOnForwardFailure yes' -vvv -p 12133 -f -x -N -T -R > 0.0.0.0:0:127.0.0.1:23645 test5@127.0.0.1 > {code} > Step 4. Reproduce > If I connect directly to the gRPC server using curl, cause gRPC using http/2, > I would get error output like this: > {code:java} > $ curl 127.0.0.1:23645 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > Then if I do step 3 with an OpenSSH server, I would get same error output: > {code:java} > $ ssh -o 'ExitOnForwardFailure yes' -f -x -N -T -R 0.0.0.0:0:127.0.0.1:23645 > w...@dev.kbyte.cn > Allocated port 13525 for remote forward to 127.0.0.1:23645 > $ > $ curl dev.kbyte.cn:13525 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > But when I do step 3 with MINA SSHD, curl would stuck without any output: > {code:java} > $ curl 127.0.0.1:55604 > {code} > I found MINA SSHD had already got and wrote the package with the string > "Unexpected.HTTP/1.x.request:.GET", and received SSH_MSG_CHANNEL_EOF. > So I think handleEof should do more? like send SSH_MSG_CHANNEL_EOF to curl? > -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org
[jira] [Commented] (SSHD-1055) Remote port forwarding mode does not handle EOF properly
[ https://issues.apache.org/jira/browse/SSHD-1055?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17178181#comment-17178181 ] Lyor Goldstein commented on SSHD-1055: -- {quote} So I think handleEof should do more? like send SSH_MSG_CHANNEL_EOF to curl? {quote} I don't think that would work - it would create a ping-pong/storming {{SSH_MSG_CHANNEL_EOF}}. Furthermore, {{SSH_MSG_CHANNEL_EOF}} is not sent "to curl" - it is an internal SSH message that is unaware of the data being transmitted through the tunnel. > Remote port forwarding mode does not handle EOF properly > > > Key: SSHD-1055 > URL: https://issues.apache.org/jira/browse/SSHD-1055 > Project: MINA SSHD > Issue Type: Bug >Affects Versions: 2.5.1 >Reporter: Feng Jiajie >Priority: Major > > I want to call the remote server's gRPC service locally through an SSH > tunnel. > MyApp -> MINA SSHD -> \{Internet} -> gRPC Server > It works just fine with OpenSSH, but there is a small problem(no problems > with core functions, only in unusual circumstances) with Mina SSHD. > I think the problem is Mina SSHD's handling of EOF. > Here is the example: > Step 1. Start a gRPC server: > Because we only need a gRPC server to reproduce the problem, so I write a > simple version without any service: > {code:java} > > io.grpc > grpc-netty-shaded > 1.27.2 > > > io.grpc > grpc-protobuf > 1.27.2 > > > io.grpc > grpc-stub > 1.27.2 > > {code} > main: > {code:java} > import io.grpc.Server; > import io.grpc.ServerBuilder; > public class EmptyGrpcServer { > public static void main(String[] args) throws Exception { > Server server = ServerBuilder.forPort(23645).build().start(); > server.awaitTermination(); > } > } > {code} > Full example can be fond here: > [https://github.com/grpc/grpc-java/blob/master/examples/src/main/java/io/grpc/examples/helloworld/HelloWorldServer.java] > > Step 2. Start a MINA SSHD server: > {code:java} > import org.apache.sshd.server.SshServer; > import org.apache.sshd.server.forward.AcceptAllForwardingFilter; > import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; > import java.nio.file.Paths; > public class Example1 { > public static void main(String[] args) throws Exception { > SshServer sshd = SshServer.setUpDefaultServer(); > sshd.setPort(12133); > sshd.setKeyPairProvider(new > SimpleGeneratorHostKeyProvider(Paths.get("/tmp/a.ser"))); > sshd.setPasswordAuthenticator((username, password, session) -> true); > sshd.setForwardingFilter(AcceptAllForwardingFilter.INSTANCE); > sshd.start(); > Thread.sleep(1000); > } > } > {code} > Step 3. Create a channel using ssh client > {code:java} > ssh -o 'ExitOnForwardFailure yes' -vvv -p 12133 -f -x -N -T -R > 0.0.0.0:0:127.0.0.1:23645 test5@127.0.0.1 > {code} > Step 4. Reproduce > If I connect directly to the gRPC server using curl, cause gRPC using http/2, > I would get error output like this: > {code:java} > $ curl 127.0.0.1:23645 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > Then if I do step 3 with an OpenSSH server, I would get same error output: > {code:java} > $ ssh -o 'ExitOnForwardFailure yes' -f -x -N -T -R 0.0.0.0:0:127.0.0.1:23645 > w...@dev.kbyte.cn > Allocated port 13525 for remote forward to 127.0.0.1:23645 > $ > $ curl dev.kbyte.cn:13525 > ���+Unexpected HTTP/1.x request: GET / > $ > {code} > But when I do step 3 with MINA SSHD, curl would stuck without any output: > {code:java} > $ curl 127.0.0.1:55604 > {code} > I found MINA SSHD had already got and wrote the package with the string > "Unexpected.HTTP/1.x.request:.GET", and received SSH_MSG_CHANNEL_EOF. > So I think handleEof should do more? like send SSH_MSG_CHANNEL_EOF to curl? > -- This message was sent by Atlassian Jira (v8.3.4#803005) - To unsubscribe, e-mail: dev-unsubscr...@mina.apache.org For additional commands, e-mail: dev-h...@mina.apache.org