mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Alberto Garcia <agarciaill...@gmail.com>
Subject Fwd: Socks proxy using Mina
Date Thu, 15 Jan 2015 23:38:22 GMT

I am using Mina to do start a ssh server. I am using it to establish a ssh
reverse connection. So the infrastructure that I have is:

1)* Server A* running a normal SSH server on port 22
2) A Java app that has two functionalities: *First one* is creating an SSH
server with the mina libraries. It just listen to localhost *Second one* is
doing a reverse SSH connection to the server with harcoded credentials.

Everything works fine and I get the connection in the server A and I can do
ssh localhost -p [LOCALPORT] and I get the shell.

But now what I want to use is set up a port in the server A to use SOCKS5
to browse the internet as being in the IP where the app has been executed.
To do so I do: ssh -vvv -f -D localhost -p 11707 -N (being
11707 the local port bind in Server A)

The port 8080 gets bind but I can't browse through it. I get this output in
the server A:

debug1: Connection to port 8080 forwarding to socks port 0 requested.
debug2: fd 5 setting TCP_NODELAY
debug2: fd 5 setting O_NONBLOCK
debug3: fd 5 is O_NONBLOCK
debug1: channel 1: new [dynamic-tcpip]
debug2: channel 1: pre_dynamic: have 0
debug2: channel 1: pre_dynamic: have 4
debug2: channel 1: decode socks5
debug2: channel 1: socks5 auth done
debug2: channel 1: pre_dynamic: need more
debug2: channel 1: pre_dynamic: have 0
debug2: channel 1: pre_dynamic: have 25
debug2: channel 1: decode socks5
debug2: channel 1: socks5 post auth
debug2: channel 1: dynamic request: socks5 host www.cualesmiip.com
port 80 command 1
channel 1: open failed: administratively prohibited: Connection denied
debug2: channel 1: zombie
debug2: channel 1: garbage collecting
debug1: channel 1: free: direct-tcpip: listening port 8080 for
www.cualesmiip.com port 80, connect from port 50879,
nchannels 2
debug3: channel 1: status: The following connections are open:

And I get this in the mina server that is running in the system where I
execute the app:
INFO: Receiving request for direct tcpip: hostToConnect=www.cualesmiip.com,
portToConnect=80, originatorIpAddress=, originatorPort=50879
ene 14, 2015 2:33:33 PM org.apache.sshd.common.forward.TcpipServerChannel

I guess that the problem is that the mina server is not finishing his part
because it seems that server A is correctly forwarding the info to the mina
I saw that some code something related to that:

Do I need to add something to my setup in the Java code to have that
working? I am using mina version sshd-core-0.12.0. I couldn't find the
version 13. Is that functionality implemented in the version 13??

Here you can find the java code I wrote to do all this:

Thank you for your help and don't hesitate to contact me if you need more

Alberto GarcĂ­a

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message