Possible issue with IPv6 client connecting to an iPv4 host

Aperta
#1,639 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
csharp
Ambito
networking

Direzione di ricerca

Inizia con la riproduzione minima in C# e con gli entry point di connessione SshClient.Connect e SftpClient indicati nel report. Riproduci il comportamento con IPv6 abilitato e disabilitato, confronta il comportamento della connessione con il client SSH da terminale e determina se è definita un'opzione IPv4-only. Il lavoro è completato quando il comportamento richiesto e la superficie di configurazione sono documentati o supportati da un test verificato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

TL;DR; Connections only work if I disable IPv6 on local machine. Client may accept IPv6 connections, but I can only whitelist IPv4 addresses. Can I force SSH.NET to use IPv4 only?

Hey,
I started working on an old project again where an app would connect to a remote server to transfer some files. I could not connect to my remote test servers, connection would time out. I reduced the example right down to the following,

var sshClient = new SshClient(Host, Port, Username, Password);
sshClient.ErrorOccurred += (sender, e) =>
{
    Debugger.Break();
};
sshClient.HostKeyReceived += (sender, eventArgs) =>
{
    Debugger.Break();
};
sshClient.ServerIdentificationReceived += (sender, eventArgs) =>
{
    Debugger.Break();
};
sshClient.Connect();
Debugger.Break();

If I took the credentials I can manually SSH to the server without issues.

ssh User@Host -p PORT
< input password

I have the issue across both my macOS and Windows machines here. Wondering if remote servers had changed I asked friend to try and they have no issues at all.

Remote host makes me input an IP address to whitelist my client machine. It only accepts IPv4 addresses, I tried an IPv6 address but it rejected it. If I disable IPv6 (tested on Windows by disabling in control panel) my connections work right away. So I think what is happening here is the host accepts an IPv6 connection but with no way to whitelist it I can't connect. I assume because the host accepts the IPv6 connection it won't attempt to fallback to IPv4. But if this is the case I don't understand why Terminal connects fine. I tried verbose output with ssh but I couldn't see any IPv4/6 things happening.

If I can confirm host accepts IPv6 connections I'll request they allow adding IPv6 whitelists which should solve the problem (at least on this host)

Is it possible to force SshClient and SftpClient use IPv4 if even if IPv6 is available?

Lingua principale
C#
Stelle
4.4k
Fork
993
Merge medio
9g 21h
PR unite (30g)
1

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di sshnet/SSH.NET

Tutte le issue di sshnet/SSH.NET

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.