Renci SSH.net changing remote SFTP port request C#
Nessuno ha ancora preso questa issue.
- Lingua principale
- C#
- Stelle
- 4.4k
- Fork
- 993
- Merge medio
- 9g 21h
- PR unite (30g)
- 1
Descrizione
I am writing a small piece of code in C# (VS 2017) to upload files to a remote server using SFTP through a SOCKS Proxy.
I have used Renci SSH.net before for other applications similar to this again going through the SOCKS proxy with no issues at all.
However in this application I am having an problem where the Renci SSH.net call to the Socks proxy is for a different Port to the one I requested.
Here is my code
`private static void testSFTPConnection()
{
//get the SFTP Connection Info
ConnectionInfo connInfo = testRemoteSFTP();
try
{
//Start the SFTP Client
using (SftpClient remoteSFTPClient = new SftpClient(connInfo))
{
//Connect the remote session
remoteSFTPClient.Connect();
//log a successful connection
Console.WriteLine("SFTP File Upload - connection to the file destination server successful");
//Disconnect the Destination SFTP connection
remoteSFTPClient.Disconnect();
}
}
catch(Exception ex)
{
Console.WriteLine("SFTP File Upload Exception: " + ex.Message);
}
}
public static ConnectionInfo testRemoteSFTP()
{
return new ConnectionInfo(remoteHost,50101, remoteUser,ProxyTypes.Socks5, proxyURL,proxyPort, proxyUser, proxyPwd, new PasswordAuthenticationMethod(remoteUser,remotePwd));
}
`
As you can see I am setting the Connection info to call the remote host on port 50101 (as per their request) However when I run the code the SOCKS Proxy tells me I am requesting a connection to the remote server on Port 50297.
When I tried to debug the connection information in VS 2017, the connection object shows me the Port request as being 50101 but it still hits the proxy requesting port 50297
I used WinSCP to test the connection to the remote server through the SOCKS proxy on the port 50101 and it connected through fine.
I used wire shark to try and trap my outgoing connection request and there I can see the Port request has changed to 50297
I am now out of ideas as to what the cause of this could be or what fix to apply so any help in this regard would be appreciated
Thanks in advance
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Iniziare riproducendo l'esempio fornito di ConnectionInfo e SftpClient con il proxy SOCKS5, richiedendo la porta remota 50101. Confrontare la richiesta del proxy in Wireshark con la connessione WinSCP, quindi identificare perché SSH.NET invia la porta 50297; completato quando siano state stabilite la causa e una correzione o limitazione verificata.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- csharp
- Ambito
- networking
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Da chiarire
- Idoneità per principianti
- 20/100