sshportal
sshportal copied to clipboard
Remote port forwarding is failed
When I try to connect using remote port forward, I get an error.
ssh -R 8000:localhost:8000 myusername@sshportalhost -p 2222 -i private_key
Warning: remote port forwarding failed for listen port 8000
ssh connection is worked, but curl localhost:8000 from a remote server is not.
Can you help me, what I should do for using remote portforward?
Does this problem occur when not using sshportal?
(To clarify the purpose of asking, I'm wondering if it's possible this problem is related to something else, eg, that port already being bound by something)
I can verify that sshportal causes the failure in remote port forwarding. Connecting directly to the system allows remote port forwarding whereas connecting through sshportal results in a failed forward.
I have the same issue. Did you find the cause?
I think I was able to trace this down into gliderlabs/ssh/server.go handleRequests(), there is no handler registered on the connection. By default we only register a ChannelHandler not a RequestHandler in server.go server() ssh.Server() (boy I learned a lot about ssh today).
func (srv *Server) handleRequests(ctx Context, in <-chan *gossh.Request) {
for req := range in {
handler := srv.RequestHandlers[req.Type]
if handler == nil {
fmt.Printf("USING DEFAULT HANDLER for %s\n", req.Type)
handler = srv.RequestHandlers["default"]
}
if handler == nil {
fmt.Printf("DEFAULT HANDLER EMPTY\n")
req.Reply(false, nil)
continue
}
/*reqCtx, cancel := context.WithCancel(ctx)
defer cancel() */
ret, payload := handler(ctx, srv, req)
req.Reply(ret, payload)
}
}
I get the following printout:
USING DEFAULT HANDLER for tcpip-forward
DEFAULT HANDLER EMPTY
"tcpip-forward" is the "global request" for remote port forwards (https://www.rfc-editor.org/rfc/rfc4254#section-7.1)