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

Ouverte
#240 1 commentaire 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

Personne n'a encore pris cette issue.

Évaluation

Difficulté
4/5
Temps estimé
3-5 jours
Accessibilité débutants
42/100
Type d'issue
Fonctionnalité
Clarté
Plutôt claire
Activité
À l'abandon
Stack technique
rust
Domaine
backend, cli

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

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:

Langage dominant
Rust
Étoiles
142
Forks
40
Merge moyen
2 j 22 h
PR mergées (30 j)
10

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

  • Aucun Dockerfile ni fichier Docker Compose
  • Aucun modèle de pull request
  • Aucun guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de bootc-dev/bcvk

Toutes les issues de bootc-dev/bcvk

Issues similaires

Plus d'issues Rust

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.