Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tunnel via SSH? #143

Closed
johnnybubonic opened this issue Sep 22, 2021 · 3 comments · Fixed by #209
Closed

Tunnel via SSH? #143

johnnybubonic opened this issue Sep 22, 2021 · 3 comments · Fixed by #209

Comments

@johnnybubonic
Copy link

johnnybubonic commented Sep 22, 2021

Since #140 was implemented and New() deprecated, how is one supposed to do a qemu+ssh connection?

I was under the impression this should work:

package main

import (
	"fmt"

	"github.com/digitalocean/go-libvirt"
	`github.com/digitalocean/go-libvirt/socket`
	`github.com/digitalocean/go-libvirt/socket/dialers`
)

func main() {

	var conn *libvirt.Libvirt
	var dialer socket.Dialer
	var err error

	dialer = dialers.NewRemote("<IP_ADDRESS_HERE>", dialers.UsePort("22"))

	conn = libvirt.NewWithDialer(dialer)
	if err = conn.ConnectToURI("qemu+ssh://user@<IP_ADDRESS_HERE>/system"); err != nil {
		fmt.Println(err)
		return
	}
}

But it just hangs.

I find it hard to believe SSH tunneling was broken by oversight considering it's treated as a first-class connection URI upstream.

@trapgate
Copy link
Member

Have a look at #89, you may be running into the same problem.

@JenniGriesmann
Copy link
Contributor

Assuming that's the issue, I think you could potentially work around it by implementing your own dialer instead of using the pre-fab "remote" one.

@LordNoteworthy
Copy link

I am having a similar issue, the error returned by libvirt server is: "msg":"failed to run the server: procedure interrupted while awaiting response".

I am using ssh as transport connection, with a passwordless ssh key pair.

dialer := dialers.NewRemote(address, dialers.UsePort(port))
conn = libvirt.NewWithDialer(dialer)
uri := fmt.Sprintf("qemu+ssh://%s@%s/system?keyfile=id_rsa&no_tty=1", user, address)
err = conn.ConnectToURI(libvirt.ConnectURI(uri))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants