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

Đang mở
#240 1 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
42/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
rust
Lĩnh vực
backend, cli

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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:

Ngôn ngữ chính
Rust
Star
142
Fork
40
Merge trung bình
2 ngày 22 giờ
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

  • Không có Dockerfile hay tệp Docker Compose
  • Không có mẫu pull request
  • Không có hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của bootc-dev/bcvk

Tất cả issue của bootc-dev/bcvk

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.