ssh into container via VSOCK instead of via sshd.service?

Aperta
#240 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust
Ambito
backend, cli

Direzione di ricerca

Start at the bcvk ephemeral ssh implementation and the readiness timeout in crates/kit/src/utils.rs:71; compare how it currently connects with the systemd VSOCK SSH mechanism described in the issue. The Silverblue 43 example provides a reproduction, and the podman exec ... ssh 'vsock%3' command demonstrates the alternative path. Done means bcvk ephemeral ssh works on images without sshd.service or sshd.socket when systemd VSOCK SSH is available.

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

Descrizione

I think this is related to #236 but I'm opening a separate issue just in case, feel free to merge it into the other issue if needed.

bcvk ephemeral ssh requires sshd.service/sshd.socket to be running in the VM to work. On many distros/images, this is not the case.

systemd includes systemd-ssh-generator, this generator seems to be enabled by default on most distros. This means that on most distros, if systemd detects it is running in a VM, it will automatically listen on port 22 on the VM's AF_VSOCK, and start an sshd session for each incoming connection.

Maybe it would be worth switching bcvk ephemeral ssh to use this mechanism for better compatibility since all the configuration is already there (bcvk already allocates a VSOCK for each VM)?

Sample

Consider the quay.io/fedora-ostree-desktops/silverblue:43 image, sshd.service/sshd.socket is not enabled by default for this image so bcvk ephemeral ssh doesn't work:

❯ podman pull quay.io/fedora-ostree-desktops/silverblue:43
[...]
❯ bcvk ephemeral run -d --rm -K --name foo quay.io/fedora-ostree-desktops/silverblue:43
22850769c7f70368500ff696bb7d4084644cf2aaeaf9cd983afd1d44ed242cdb
❯ bcvk ephemeral ssh foo -v
Error: 
   0: Timeout waiting for readiness after 240s (221 attempts)

Location:
   crates/kit/src/utils.rs:71

However, I can ssh into the container over VSOCK, thanks to systemd-ssh-generator and systemd-ssh-proxy:

❯ podman exec -it foo ssh -i /run/tmproot/var/lib/bcvk/ssh 'vsock%3'
Warning: Permanently added 'vsock%3' (ED25519) to the list of known hosts.
[root@fedora ~]# 

Notes

More info:

Lingua principale
Rust
Stelle
142
Fork
40
Merge medio
2g 22h
PR unite (30g)
10

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Nessun modello di pull request
  • Nessuna 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 bootc-dev/bcvk

Tutte le issue di bootc-dev/bcvk

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.