Quantcast
Channel: SSH.NET Library
Viewing all 2955 articles
Browse latest View live

Closed Issue: SCP fails with dropbear because of option -q [1164]

$
0
0
SCP transfer uses commands like thischannel.SendExecRequest(string.Format("scp -qpf \"{0}\"", filename));When the remote system is using dropbear, the command fails with a usage message.  By default the scp command in dropbear is compiled without progress meter. Unfortunately in this case it does not ignore option "-q" but it complains with a usage message. I compared with the commands sent by WinSCP "scp -r -p -d -f filename" and the scp command from openssh "scp -f filename". It doesn't seem do be necessary to specify option "-q" for the remote scp.That's why I propose to remove option "-q" from all scp commands. Additionally the ScpClient seems to wait without timeout (or with a very long one) when it does not receive any data as a result of the failed remote scp command.
Comments: No response, assumed fixed

Closed Issue: ssh linux from silverlight 5 [1359]

$
0
0
I tried to use ssh.net nuget with sl 5 and got exception "Could not load file or assembly 'Microsoft.CSharp, Version=2.0.5.0..." So up to now build is valid for sl 4 and not valid for sl 5. For anyone interested python policy server for 943 port is attached.
Comments: No response, assumed fixed

Closed Issue: Client disconnect not handled. [1264]

$
0
0
I am using the DLL to tunnel RDP traffic using port forwarding. When disconnecting a session, I was getting a null reference exception from the dll. Eventually discovered it was coming from the ChannelDirectTcip.NET40.cs code file in the InternalSocketSend method. The problem was that because of the disconnect, this._socket was null, but the server was still sending data, and the dll was trying to relay that data to the nonexistent connection. To hack around this, I added code in the ChannelDirectTcpip.cs code file in the OnData method, to check for a null this._socket. If not null, call “this.InternalSocketSend(data);” as usual. If “this._socket” is null, call “this.SendMessage(new ChannelEofMessage(this.RemoteChannelNumber));” instead. Probably not the best solution, but it works.
Comments: No response, assumed fixed

Closed Issue: Exception raised when disconnection is performed intentionally from the user [1243]

$
0
0
I noticed that whenever we call the Disconnect method, a new SshConnectionException is raised with ConnectionLost as Disconnect Reason (is not more appropriate ByApplication?). Do you think it's possible to revise the code in order to close the connection normally, gracefully and without resorting to exceptions which confuse my application internal log because thinks they are real errors ?
Comments: No response, assumed fixed

Closed Issue: ScpClient hangs when remote SCP fails [1166]

$
0
0
The problem occurred in connection with http://sshnet.codeplex.com/workitem/1164 When trying to download a file, the remote SCP program did not understand the specified option "-q", complained by writing a usage message to stderr and exited.  After this both the remote SSHD process that handles a single SSH connection and the local ScpClient seem to wait for data. If it is not possible to identify this situation, a (user configurable) timeout might be useful to abort the running file transfer operation. The specific error situation can be fixed as described in the other bug report, but to make the software more robust it should handle all kinds of network or remote system errors.
Comments: No response, assumed fixed

Closed Issue: duplicate SSH_MSG_CHANNEL_CLOSE for same channel lets dropbear terminate connection [1227]

$
0
0
When transferring files with SCP from a device running dropbear 0.53.1 I noticed connection aborts on the PC runninng SSH.NET with error messages from dropbear. On the PC I get "An established connection was aborted by the software in your host machine." while dropbear on the device logs "authpriv.info dropbear[4775]: Exit (system): Close for unknown channel 0"(Dropbear terminates the whole connection in an unclean way when it detects this error.) The problem depends on timing because it seems to disappear when I run dropbear with system call trace or (lots of) debug output. With debudding on the PC we found out that SSH.NET sometimes sends SSH_MSG_CHANNEL_CLOSE twice. SshNet.Logging Verbose: 1 : ReceiveMessage from server: 'ChannelCloseMessage': 'SSH_MSG_CHANNEL_CLOSE : #2'.SshNet.Logging Verbose: 1 : SendMessage to server 'ChannelCloseMessage': 'SSH_MSG_CHANNEL_CLOSE : #0'.SshNet.Logging Verbose: 1 : SendMessage to server 'ChannelCloseMessage': 'SSH_MSG_CHANNEL_CLOSE : #0'.Eine Ausnahme (erste Chance) des Typs "Renci.SshNet.Common.SshConnectionException" ist in Renci.SshNet.dll aufgetreten.15:29:31.3242:scp_ErrorOccurred: An established connection was aborted by the software in your host machine. In Channel.cs there is a call tothis.SendMessage(new ChannelCloseMessage(this.RemoteChannelNumber));both in Close() and in OnClose() In the problematic case Close() is called first, then OnClose().  We were able to fix the problem by preventing the Channel object from sending the message twice. We modify a variable when sending ChannelCloseMessage for the first time and skip the second call if the variable does not have its initial value.  Bodo
Comments: No response, assumed fixed

Closed Issue: Passwords in memory [1169]

$
0
0
Hello! I wrote a simple application for forwarding local ports, it works great and was really easy! But i have one concern, when investigating the memory of my application i found that my password was found no less then 13 times. I tried to remove it but setting _password (in PasswordConnectionInfo) to null after successful authentication but without luck. Would it be possible to either encrypt the password stored in memory or after authentication, remove it completely from memory?   Also, my application clears the passwordbox used for entering the password. This is how i establish a connection:    void initSSHClient() { client = new SshClient(tbHost.Text, tbUsername.Text, pbPassword.Password); client.ConnectionInfo.AuthenticationBanner += new EventHandler(ConnectionInfo_AuthenticationBanner); client.Connect(); if (client.IsConnected) { pbPassword.Clear(); } }
Comments: No response, assumed fixed

Closed Issue: RemoveForwardedPort(ForwardedPort) [1163]

$
0
0
Set up a forwarded port using:AddForwardedPort("127.0.0.1", 8080, "example.org", 80); Then browse to http://127.0.0.1:8080 Then:RemoveForwardedPort(ForwardedPort) "RemoveForwardedPort" will stop listening to port 8080 on ip 127.0.0.1 BUT it does not kill current connections.
Comments: No response, assumed fixed

Commented Issue: Orphaned threads when port forwarding [1522]

$
0
0
I'm not sure if this is the same issue as [here](http://sshnet.codeplex.com/workitem/1436).

In the situation where a port forward has been established and actively used, therefore a listener thread has been created, if the network is disconnected (by pulling out the cable) and reconnected sometime later then the internal thread will remain there even after everything else has been disposed properly. This causes problems, especially when trying to exit the application since it will hang.

With a fair amount of Console.WriteLineing it was established that the internal listener thread, consisting mostly of the Bind function in ChannelDirectTcpip, eventually exits its main loop correctly but then stalls at this point forever (well at least until a kill -9 is issued):

```
System.Threading.WaitHandle.WaitAny(new WaitHandle[] { this._channelEof });
```

I do not know much about the inner workings of SSH.NET and therefore do not know the best solution to the problem, but a workaround that seems to do the job for us is to simply allow that wait to timeout:

```
System.Threading.WaitHandle.WaitAny(new WaitHandle[] { this._channelEof }, 5000);
```

After that, the inner thread exits properly and no more hangs on exit.
Comments: ** Comment from web user: teadriven **

Hi,

I wasn't suggesting the timeout as a solution, it was simply a hack to get it working for us in the meantime since our application should only be run on a local network for the now and therefore 5 seconds is reasonable.

I pulled down the source for 23481 and copied a build of the library over to my test bed (a server and a client VM, both linux, with simulated network cable disconnections to test the ability to maintain a tunnel).

Unfortunately there is still a runaway thread that causes the processor usage to ramp up when exiting the application.

Another similar effect is that the IsConnected property blocks for a very long time if the network cable is disconnected (it does not honour the ConnectionInfo.Timeout value). To help with that situation we have to launch a Task to check the connection and attempt a reconnect which means I can then Wait on the Task with a sensible timeout (yet another hack I'm afraid).

Regards,
Dan

New Post: Dynamic PortForward Problem

$
0
0
Thank you for your reply.

yes I have problem with DNS resolving on my side, after some test when I use IP address it works fine.
I thought when I use dynamic forwarding (SSH -d), DNS resolving occur on SSH server like Putty and tunnelier does.
Does ssh.net pass the whole request to ssh server or try parse hostname to ip address before send the request to ssh server?

thanks,

New Post: Dynamic PortForward Problem

$
0
0
i,

It tries to resolve DNS name on the client and then provides IP address to the server.
I think its a protocol restriction so dont think it could change.

Thanks,
Oleg

Commented Issue: Orphaned threads when port forwarding [1522]

$
0
0
I'm not sure if this is the same issue as [here](http://sshnet.codeplex.com/workitem/1436).

In the situation where a port forward has been established and actively used, therefore a listener thread has been created, if the network is disconnected (by pulling out the cable) and reconnected sometime later then the internal thread will remain there even after everything else has been disposed properly. This causes problems, especially when trying to exit the application since it will hang.

With a fair amount of Console.WriteLineing it was established that the internal listener thread, consisting mostly of the Bind function in ChannelDirectTcpip, eventually exits its main loop correctly but then stalls at this point forever (well at least until a kill -9 is issued):

```
System.Threading.WaitHandle.WaitAny(new WaitHandle[] { this._channelEof });
```

I do not know much about the inner workings of SSH.NET and therefore do not know the best solution to the problem, but a workaround that seems to do the job for us is to simply allow that wait to timeout:

```
System.Threading.WaitHandle.WaitAny(new WaitHandle[] { this._channelEof }, 5000);
```

After that, the inner thread exits properly and no more hangs on exit.
Comments: ** Comment from web user: olegkap **

Hi,

Ok, yea, no problem, just wanted to mentioned about this 5000 hack and make sure you aware of side effect.

As far as locking in IsConnected, there is no locking there with exception of this._socket.Poll method call which could potentially wait for a while.

I guess another idea, can you try this commit: 23468?
This is one of my ideas to fix this problem, this way I dont test for is connected but have a special variable to test for disposing situation.

Since it seems you can easily reproduce this error, can you try this commit and let me know if it works?
If it does, I guess I will make this as a solution.

Thanks,
Oleg

New Post: Dynamic PortForward Problem

$
0
0
Hi,

I don't know about protocol restriction, but putty and tunnelier can do dynamic portforward even with DNS disabled on local machine, I guess I have to look putty source code.
Thankyou for your attention, ssh.net is very good libbrary keep up the good job.

thanks

New Post: Dynamic PortForward Problem

$
0
0
Hi,
Just for information, in SOCK5 we can send domain name as request, I found information from here.

thanks

New Post: Pageant integration?

$
0
0
Unfortunately, that code uses the .net 4+ MemoryMappedFile. I'm stuck with .net3.5 (For various reasons I'm not too happy with). There isn't a heavy reliance on that feature though so it may be fairly easy to replace.

Thanks,

Robert

New Post: Pageant integration?

$
0
0
FYI, this patch works great under .net 4 without modification. Given that Pageant is the ubiquitous SSH agent for windows, it's a shame that it can't be included. It's as simple as:
        string host = "myhost";
        string username = "joeschmo";
        var agent = new PageantProtocol();
        var conn = new AgentConnectionInfo(host,username,agent);
        var client = new SshClient(conn));

        (Insert appropriate exception handling of course...).
Robert

Commented Issue: Orphaned threads when port forwarding [1522]

$
0
0
I'm not sure if this is the same issue as [here](http://sshnet.codeplex.com/workitem/1436).

In the situation where a port forward has been established and actively used, therefore a listener thread has been created, if the network is disconnected (by pulling out the cable) and reconnected sometime later then the internal thread will remain there even after everything else has been disposed properly. This causes problems, especially when trying to exit the application since it will hang.

With a fair amount of Console.WriteLineing it was established that the internal listener thread, consisting mostly of the Bind function in ChannelDirectTcpip, eventually exits its main loop correctly but then stalls at this point forever (well at least until a kill -9 is issued):

```
System.Threading.WaitHandle.WaitAny(new WaitHandle[] { this._channelEof });
```

I do not know much about the inner workings of SSH.NET and therefore do not know the best solution to the problem, but a workaround that seems to do the job for us is to simply allow that wait to timeout:

```
System.Threading.WaitHandle.WaitAny(new WaitHandle[] { this._channelEof }, 5000);
```

After that, the inner thread exits properly and no more hangs on exit.
Comments: ** Comment from web user: teadriven **

Oleg,

I'm afraid the 23468 build does not appear to deal with physical disconnects any differently. The IsConnected property still blocks and the tunnels still leave behind threads.

Regards,
Dan

Commented Issue: Orphaned threads when port forwarding [1522]

$
0
0
I'm not sure if this is the same issue as [here](http://sshnet.codeplex.com/workitem/1436).

In the situation where a port forward has been established and actively used, therefore a listener thread has been created, if the network is disconnected (by pulling out the cable) and reconnected sometime later then the internal thread will remain there even after everything else has been disposed properly. This causes problems, especially when trying to exit the application since it will hang.

With a fair amount of Console.WriteLineing it was established that the internal listener thread, consisting mostly of the Bind function in ChannelDirectTcpip, eventually exits its main loop correctly but then stalls at this point forever (well at least until a kill -9 is issued):

```
System.Threading.WaitHandle.WaitAny(new WaitHandle[] { this._channelEof });
```

I do not know much about the inner workings of SSH.NET and therefore do not know the best solution to the problem, but a workaround that seems to do the job for us is to simply allow that wait to timeout:

```
System.Threading.WaitHandle.WaitAny(new WaitHandle[] { this._channelEof }, 5000);
```

After that, the inner thread exits properly and no more hangs on exit.
Comments: ** Comment from web user: olegkap **

Hmm,
Well, 23468 doesnt handle disconnect differently, it only insures that IsConnected is not called during disposing.
So may be a problem somewhere else :(:(.

Is it possible for you to create a test case that I can run locally to recreate the problem, or may be if possible to connect to test server that you have where I could recreate this problem. You can send me this info privately if such scenario is possible,

I guess one more idea, to prevent isConnected from blocking is to replace this:
```
isConnected = (!this._isDisconnecting && this._socket != null && this._socket.Connected && this._isAuthenticated && this._messageListenerCompleted != null)
&& this._socket.Poll(-1, SelectMode.SelectWrite);

```
with this:
```
isConnected = (!this._isDisconnecting && this._socket != null && this._socket.Connected && this._isAuthenticated && this._messageListenerCompleted != null);

```

And see if it still hangs on IsConnected


Thanks,
Oleg

New Post: Pageant integration?

$
0
0
Hi,

The reason I cannot include it in the library is due to native method.
For example:
        [DllImport("user32.dll", EntryPoint = "SendMessageA", CallingConvention = CallingConvention.StdCall,
            ExactSpelling = true)]
        public static extern IntPtr SendMessage(IntPtr hWnd, int dwMsg, IntPtr wParam, ref COPYDATASTRUCT lParam);
Which is problematic in my view.
I would like to keep this library as open as possible and as pluggable as possible,


For this reason I keep ConnectionInfo class public that allows you to implement any additional connection info class like AgentConnectionInfo and use it.

Also AgentConnectionInfo can be implemented in your project without changing SshNet.

Hope it explains the reason behind this decision.

Thanks,
Oleg

New Post: Dynamic PortForward Problem

$
0
0
Hi,

Thanks for pointing it out,

I dont think I should disable IPv4 and IPv6 and only do domain name since it could be problematic for some but I will look into it of course.

So you were using the same code as above and it failed?
Did it throw any error? If so which one.

Thanks,
Oleg
Viewing all 2955 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>