dmacvicar / terraform-provider-libvirt

Terraform provider to provision infrastructure with Linux's KVM using libvirt
Apache License 2.0
1.54k stars 457 forks source link

Use virt-ssh-helper instead of unix socket forwarding #1019

Open nward opened 1 year ago

nward commented 1 year ago

I am sorry for nuking the template - none of it applies. This is a feature request / change proposal.

Currently, this provider connects to libvirt/qemu over SSH with SSH unix socket forwarding (direct-streamlocal). virsh itself does not do this - instead, it uses a binary called virt-ssh-helper running in a terminal session - here is sshd debug of this happening:

debug3: mm_audit_run_command entering command sh -c 'which virt-ssh-helper 1>/dev/null 2>&1; if test $? = 0; then     virt-ssh-helper 'qemu:///system'; else    if 'nc' -q 2>&1 | grep "requires an argument" >/dev/null 2>&1; then ARG=-q0;else ARG=;fi;'nc' $ARG -U /opt/homebrew/var/run/libvirt/libvirt-sock; fi'

My proposal is that this provider should do the same - as some ssh servers (for example, the tailscale sshd) does not support direct-streamlocal (unix) channels.

Alternatively, perhaps we try direct-streamlocal, and fall back to virt-ssh-helper if this errors?