sshnet / sshnet/SSH.NET

ForwardedPortRemote not closing the local TCP socket.

Offen
#326 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Vorherrschende Sprache
C#
Sterne
4.4k
Forks
993
Ø Merge
9 T. 21 Std.
Gemergte PRs (30 T.)
1

Beschreibung

I am using SSH.NET to create a reverse tunnel to a Linux server so that I am able to connect to a VNC server behind a NAT. There is also a monitoring program running that checks whether someone is actually connected to the VNC server. This is checked using the following piece of code:

int clients = IPGlobalProperties
    .GetIPGlobalProperties()
    .GetActiveTcpConnections()
    .Where((c) => c.LocalEndPoint.Port == monitorPort)
    .Count();

(monitorPort is 5900, so the port VNC server is listening on)

Using our old reverse tunneling system, this worked fine. But with SSH.NET the amount of clients never decrease. It seems that SSH.NET keeps the socket to the VNC server open forever.

  • I can clearly see that when I connect to the VNC server through the tunnel, the amount of clients goes to 1, but when I disconnect the VNC client it never goes back to 0.
  • When I connect directly to the VNC server (over LAN, not through the tunnel) the amount of clients does immediately go back to 0 after disconnecting.
  • And when I use Plink for the reverse tunnel, the socket also closes immediately after a disconnect from the VNC client.

So I would say that this is a bug in SSH.NET right? The expected behavior would be that the socket closes immediately after the client disconnects.

If you need more info, please let me know. Will have a look at the source code myself tomorrow.
Kind regards,
LJ

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit der Implementierung von ForwardedPortRemote und reproduziere die im Issue beschriebene VNC-Trennung im Reverse-Tunnel. Verfolge den Lebenszyklus des lokalen TCP-Sockets, wenn der VNC-Client die Verbindung trennt; fertig ist die Aufgabe, wenn die Anzahl der Verbindungen umgehend auf null zurückgeht und damit direkten Verbindungen und Plink entspricht.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
csharp
Bereich
networking
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
40/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.