Re: Local tunneling question
Andre Charbonneau <[email protected]>
| Newsgroups | gmane.comp.java.sshtools.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Thanks for the reply.
This is what I get when I turn debugging output on (some parts ommitted
for clarity reasons...):
(...)
Creating VNC tunnel (addLocalForwarding)...
[Thread-5] INFO forwarding.ForwardingListener - Creating forwarding
listener named 'VNC'
[Thread-5] DEBUG forwarding.ForwardingListener - Address to bind: 0.0.0.0
[Thread-5] DEBUG forwarding.ForwardingListener - Port to bind: 5920
[Thread-5] DEBUG forwarding.ForwardingListener - Host to connect: localhost
[Thread-5] DEBUG forwarding.ForwardingListener - Port to connect: 5920
VNC tunnel started.
[Forwarding listener 2] INFO forwarding.ForwardingListener - Starting
forwarding listener thread for 'VNC'
[Thread-9] INFO transport.HostKeyVerification - Could not open or read
/home/andre/.ssh/known_hosts: is not supported
[Thread-9] DEBUG net.TransportProviderFactory - Use normal socket
[Thread-9] INFO transport.TransportProtocolCommon - Starting transport
protocol
(...)
[Forwarding listener 2] INFO forwarding.ForwardingListener -
Connection accepted, creating forwarding channel
[Forwarding listener 2] DEBUG connection.ChannelDataWindow - Increasing
window space by 131072
[Forwarding listener 2] INFO transport.TransportProtocolCommon -
Sending SSH_MSG_CHANNEL_OPEN (90)
[Transport protocol 2] DEBUG transport.TransportProtocolCommon -
Received SSH_MSG_CHANNEL_DATA
[Transport protocol 2] DEBUG connection.ConnectionProtocol - Received 2
bytes of data for channel id 0
[Transport protocol 2] DEBUG transport.TransportProtocolCommon -
Received SSH_MSG_CHANNEL_DATA
[Transport protocol 2] DEBUG connection.ConnectionProtocol - Received
56 bytes of data for channel id 0
15/05/07 14:54:52 Got connection from client 127.0.0.1
[Transport protocol 1] DEBUG transport.TransportProtocolCommon -
Received SSH_MSG_CHANNEL_OPEN_CONFIRMATION
(no more messages after this... VNC password dialog hangs...)
Regards,
Andre
Bernardo F Costa wrote:
> Hi Andre !
> I never worked with ForwardingClient, but could there
> be any problem if you are using the same port on
> 127.0.0.1 and a.b.c.d (as your ip) ? This is just a
> guess, I mean, the same happens if the biding port of
> localhost is changed ? However, what really could help
> you is trying to log debug messages of
> ForwardingClient class. There were problems of hang
> ups on some other classes, some of them already
> corrected, and if some of these problems persist on
> ForwardingClient then, it is possible taht the log
> messages will show it.
>
> --- Andre Charbonneau
> <[email protected]> escreveu:
>
>
>> Hi,
>> I'm trying to use the latest release of sshtools to
>> create a local SSH
>> tunnel to tunnel VNC. (I know the SSHTerm has a VNC
>> feature, but I
>> would like to use sshtool to simply create a SSH
>> tunnel and then use
>> another VNC viewer application through this tunnel.)
>>
>> So I wrote a small java app that simply creates a
>> local forwarding
>> tunnel, as shown below:
>>
>> SshClient ssh = null;
>> ssh = new SshClient();
>> // Connect and authenticate (GSI)
>> ssh.connect(connectionProps, new
>> DialogKnownHostsKeyVerification(null));
>> SshAuthenticationClient authClient = new
>> GSSAuthenticationClient();
>>
>> authClient.setHostname(connectionProps.getHost());
>> authClient.setUsername(""); // Use empty
>> username, GSI will set
>> the usename to use.
>> authClient.setProperties(connectionProps);
>> int result = ssh.authenticate(authClient,
>> connectionProps.getHost());
>> if(result !=
>> AuthenticationProtocolState.COMPLETE)
>> {
>> JOptionPane.showMessageDialog(null,
>> "Authentication error when creating VNC
>> channel.",
>> "", JOptionPane.WARNING_MESSAGE);
>> System.exit(1);
>> }
>>
>> // Create a tunnel for the VNC traffic.
>> ForwardingClient forwarding =
>> ssh.getForwardingClient();
>> forwarding.addLocalForwarding("VNC",
>> "0.0.0.0", 5920,
>> "localhost", 5920);
>> forwarding.startLocalForwarding("VNC");
>> System.out.println("VNC tunnel started.");
>>
>> // And also open a shell to see what's going
>> on...
>> SessionChannelClient
>> session=ssh.openSessionChannel();
>> if
>>
>>
> (!session.requestPseudoTerminal("vt100",80,24,0,0,""))
>
>> System.out.println("Failed to allocate a
>> pseudo terminal");
>> if (session.startShell())
>> {
>> InputStream in=session.getInputStream();
>> OutputStream
>> out=session.getOutputStream();
>> IOStreamConnector input=new
>> IOStreamConnector(System.in,out);
>> IOStreamConnector output=new
>> IOStreamConnector(in,System.out);
>>
>>
>>
> output.getState().waitForState(IOStreamConnectorState.CLOSED);
>
>> }
>>
>>
>> My tightvnc server is listening on a.b.c:5920.
>>
>> If I use the command-line vncviewer to directly
>> access the VNC server
>> listening on a.b.c:5920, everything works fine. But
>> when I try to use
>> the tunnel created by the code above (by using the
>> command: xvncviewer
>> a.b.c::5920), the vncviewer hangs after the password
>> prompt and the only
>> output log I get on the vnc server side is:
>>
>> 15/05/07 10:53:37 Got connection from client
>> 127.0.0.1
>>
>> I suspect I'm not setting up the ssh tunnel
>> correctly... Any ideas what
>> I might be doing wrong?
>>
>> Any information about this would be much
>> appreciated.
>>
>> Thanks,
>> Andre
>>
>>
>>
>>
>>
> -------------------------------------------------------------------------
>
>> This SF.net email is sponsored by DB2 Express
>> Download DB2 Express C - the FREE version of DB2
>> express and take
>> control of your XML. No limits. Just data. Click to
>> get it now.
>> http://sourceforge.net/powerbar/db2/
>> _______________________________________________
>> Sshtools-users mailing list
>> [email protected]
>>
>>
> https://lists.sourceforge.net/lists/listinfo/sshtools-users
>
>
>
> __________________________________________________
> Fale com seus amigos de graça com o novo Yahoo! Messenger
> http://br.messenger.yahoo.com/
>
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/