-
Notifications
You must be signed in to change notification settings - Fork 132
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
Add TLS and SSH Dialers, and support libvirt URI parsing #209
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this submission! go-libvirt has needed better TLS support for a long time.
Hang in there. The CI setup for go-libvirt has gotten a little long-in-the-tooth and needed updating. I've got a separate PR open to fix that; once it has merged you can update this PR and the tests should succeed. |
The CI updates are merged; if you pull the latest changes into your fork the tests should pass. |
When opening a connection with the libvirt client, the provided URI is first used to set up the socket used to communicate with libvirtd. The actual URI passed to libvirtd (i.e. when calling the ConnectToURI() method) contains only a subset of the original, since relative to libvirtd the underlying virt provider is always local. Create a new ConnectToURI() function that returns a connected Libvirt using the appropriate dialer and remote URI.
This is a simpler way to initiate a connection.
All of the hard parts are now implemented by the dialer, so the example can be much more straightforward.
This is needed for ssh support.
Resolve qemu+ssh:// URIs using the internal (golang ssh library--based) ssh dialer. Note that this cannot respect the system ssh configuration, as users of the libvirt client library would (since it shells out to the ssh binary for these URIs, unlike for qemu+libssh:// or qemu+libssh2:// URIs).
Thanks! Rebased the branch on that CI change. |
Add a Dialer for TLS connections. This removes the need for consumers of the library to write a lot of TLS setup code, and abstracts the weird part of the connection protocol discussed in #89.
Add a Dialer for SSH connections, using the golang stdlib ssh library.
Introduce a function to connect to an arbitrary libvirt connection URI. This removes the need for every consumer to reimplement this functionality if they want user-configurable connection parameters, and greatly simplifies the process of opening a connection. The transports that are implemented are
unix
,tcp
,tls
,libssh2
,libssh
, andssh
.Note that for now all 3 of the ssh transports are implemented using the same golang ssh library for connection, so the behaviour may not always be identical to the libvirt client (in particular the
ssh
transport would normally be expected to pick up settings from the user's.ssh/config
file by virtue of it shelling out to the ssh client).Fixes #139
Fixes #143
Fixes #189