Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add (or document) the ability to SSH through bastion hosts, if possible

Aperta
#167 3 commenti 1 reazione 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
networking

Direzione di ricerca

Esamina l’issue correlata #84 e le API Session, Channel, TcpStream e RawFd coinvolte nell’esempio. Determina se un channel o uno stream può fungere da trasporto per una seconda session, quindi definisci se il risultato debba essere implementato come supporto o come documentazione che descriva l’approccio praticabile e le relative limitazioni.

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

Descrizione

enhancement

This relates to #84. I'm not interested in using ssh-agent based key forwarding, but I would like to be able to jump through an intermediate host without relying on netcat.

I'm not sure how feasible this would be, but ideally you could do something like this:

    let tcp = TcpStream::connect("bastion-host:22").unwrap();
    let mut bastion_session = Session::new().unwrap();
    bastion_session.set_tcp_stream(tcp);
    bastion_session.handshake().unwrap();
    bastion_session.userauth_password("username", "password").unwrap();
    bastion_channel = bastion_session.channel_direct_tcpip("target-host", 22, None); 
    target_session = Session::new().unwrap();
    // Here's the crux of it, and where I'm really unsure of how difficult this would be
    target_session.set_tcp_stream(bastion_channel); // Or a stream from the bastion?
    target_session.handshake.unwrap();
    target_session.userauth_password("username", "password").unwrap();
    // etcetera

This follows a pattern I've used with other SSH client libraries, e.g.

    bastion_connection = await asyncssh.connect("bastion")
    target_connection = await asyncssh.connect("target", tunnel=bastion_connection)

It seems like the issue is that a channel/stream doesn't implement the RawFd trait, so we can't pass that as a TCP stream to another session. Would it be possible to implement that trait on either the channel or stream?

I'm working on my first Rust project, so please forgive my ignorance here.

EDIT: I'm also waay too used to working in a high level language, because I did a bit of digging and I doubt this will be simple. Still, it would be good to know what it might look like to do this.

Lingua principale
Rust
Stelle
571
Fork
166
Merge medio
1g 18h
PR unite (30g)
5

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

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 rust-lang/ssh2-rs

Tutte le issue di rust-lang/ssh2-rs

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.