When connecting to a remote libvirtd, or hypervisor that requires
authentication we have callbacks which can be used to prompt for
various credentials. This is tedious if you are looking to automate
stuff though. While we could let each application implement a
custom auth callback for fetching credentials from a config file,
it is nicer if we provide this ability directly in libvirt, so that
all apps can benefit from it.
So this series introduces a new config file in which authentication
credentials can be placed. It supports setting multiple sets of
credentials, of varying types in one file. I use the '.ini' config
file syntax, since this makes it easy to reuse the same config file
in virt-viewer & similar apps to store VNC / SPICE credentials.
To find the config file we check for each of
- Path from LIBVIRT_AUTH_FILE env var
- Query param 'authfile=PATH' in the URI params
- /etc/libvirt/auth.conf
- $HOME/.libvirt/auth.conf
if no config file is present, everything should carry on as normal.
If the config is present, then it is consulted to fill in credentials
first. Only if there are still missing credentials, will the auth
callbacks then be invoked.
See the docs in patch 12 of this series for the config file
syntax examples.
This is supported for all drivers that do auth, remote, esx,
xenapi, hyperv and phyp, though I have only tested it with the
remote driver. I would appreciate someone giving it a go with
the other drivers.
The first 7 patches are actually all related to the viruri.[ch]
file, expanding its functionality & adding tests. This is to
make sure the auth config patches can have easy access to the
query params.
The last 7 patches are related to the auth config file support
again including tests