libvirt/src/qemu
John Ferlan a1344f70a1 qemu: Utilize qemu secret objects for RBD auth/secret
https://bugzilla.redhat.com/show_bug.cgi?id=1182074

If they're available and we need to pass secrets to qemu, then use the
qemu domain secret object in order to pass the secrets for RBD volumes
instead of passing the base64 encoded secret on the command line.

The goal is to make AES secrets the default and have no user interaction
required in order to allow using the AES mechanism. If the mechanism
is not available, then fall back to the current plain mechanism using
a base64 encoded secret.

New APIs:

qemu_domain.c:
  qemuDomainGetSecretAESAlias:
    Generate/return the secret object alias for an AES Secret Info type.
    This will be called from qemuDomainSecretAESSetup.

  qemuDomainSecretAESSetup: (private)
    This API handles the details of the generation of the AES secret
    and saves the pieces that need to be passed to qemu in order for
    the secret to be decrypted. The encrypted secret based upon the
    domain master key, an initialization vector (16 byte random value),
    and the stored secret. Finally, the requirement from qemu is the IV
    and encrypted secret are to be base64 encoded.

qemu_command.c:
  qemuBuildSecretInfoProps: (private)
    Generate/return a JSON properties object for the AES secret to
    be used by both the command building and eventually the hotplug
    code in order to add the secret object. Code was designed so that
    in the future perhaps hotplug could use it if it made sense.

  qemuBuildObjectSecretCommandLine (private)
    Generate and add to the command line the -object secret for the
    secret. This will be required for the subsequent RBD reference
    to the object.

  qemuBuildDiskSecinfoCommandLine (private)
    Handle adding the AES secret object.

Adjustments:

qemu_domain.c:
  The qemuDomainSecretSetup was altered to call either the AES or Plain
  Setup functions based upon whether AES secrets are possible (we have
  the encryption API) or not, we have secrets, and of course if the
  protocol source is RBD.

qemu_command.c:
  Adjust the qemuBuildRBDSecinfoURI API's in order to generate the
  specific command options for an AES secret, such as:

    -object secret,id=$alias,keyid=$masterKey,data=$base64encodedencrypted,
            format=base64
    -drive file=rbd:pool/image:id=myname:auth_supported=cephx\;none:\
           mon_host=mon1.example.org\:6321,password-secret=$alias,...

  where the 'id=' value is the secret object alias generated by
  concatenating the disk alias and "-aesKey0". The 'keyid= $masterKey'
  is the master key shared with qemu, and the -drive syntax will
  reference that alias as the 'password-secret'. For the -drive
  syntax, the 'id=myname' is kept to define the username, while the
  'key=$base64 encoded secret' is removed.

  While according to the syntax described for qemu commit '60390a21'
  or as seen in the email archive:

    https://lists.gnu.org/archive/html/qemu-devel/2016-01/msg04083.html

  it is possible to pass a plaintext password via a file, the qemu
  commit 'ac1d8878' describes the more feature rich 'keyid=' option
  based upon the shared masterKey.

Add tests for checking/comparing output.

NB: For hotplug, since the hotplug code doesn't add command line
    arguments, passing the encoded secret directly to the monitor
    will suffice.
2016-05-20 11:09:05 -04:00
..
EVENTHANDLERS.txt
libvirtd_qemu.aug qemu: add support for sending QEMU stdout/stderr to virtlogd 2015-11-26 14:30:16 +00:00
MIGRATION.txt
qemu_agent.c util: string: Introduce virStringEncodeBase64 2016-05-16 12:58:48 +02:00
qemu_agent.h qemu: change qemuFindAgentConfig return type 2016-01-11 17:17:52 +01:00
qemu_alias.c qemu: Utilize qemu secret objects for RBD auth/secret 2016-05-20 11:09:05 -04:00
qemu_alias.h qemu: Utilize qemu secret objects for RBD auth/secret 2016-05-20 11:09:05 -04:00
qemu_blockjob.c conf: add caps to virDomainObjFormat/SaveStatus 2016-02-05 10:57:08 +00:00
qemu_blockjob.h
qemu_capabilities.c qemu: Add virQEMUCapsSetGICCapabilities() 2016-05-18 11:27:56 +02:00
qemu_capabilities.h qemu: Add virQEMUCapsSetGICCapabilities() 2016-05-18 11:27:56 +02:00
qemu_capspriv.h qemu: Export caps cache APIs for tests 2016-05-06 10:27:32 +02:00
qemu_cgroup.c qemu_cgroup: allow access to /dev/dri for virtio-vga 2016-05-19 10:52:50 +02:00
qemu_cgroup.h Implement qemuSetupGlobalCpuCgroup 2016-03-01 14:30:11 +00:00
qemu_command.c qemu: Utilize qemu secret objects for RBD auth/secret 2016-05-20 11:09:05 -04:00
qemu_command.h qemu: command: Ignore QEMU_CAPS_DEVICE when building drive alias 2016-05-16 08:59:35 -04:00
qemu_conf.c util: Replace virDomainDiskSourceIsBlockType with a new helper 2016-05-09 12:36:52 +02:00
qemu_conf.h sysconf: Include unistd.h 2015-12-24 18:03:50 +01:00
qemu_domain_address.c qemu: address: Remove QEMU_CAPS_DEVICE usage 2016-05-18 14:33:58 -04:00
qemu_domain_address.h qemu: Introduce qemuBuildControllerDevCommandLine 2016-03-11 06:17:06 -05:00
qemu_domain.c qemu: Utilize qemu secret objects for RBD auth/secret 2016-05-20 11:09:05 -04:00
qemu_domain.h secret: Alter virSecretGetSecretString 2016-05-16 12:58:48 +02:00
qemu_driver.c qemu: driver: Fix function header alignment of some functions 2016-05-20 06:51:11 +02:00
qemu_driver.h
qemu_hostdev.c qemu: hostdev: Introduce qemuHostdevUpdateActiveDomainDevices() 2015-10-26 13:50:35 +01:00
qemu_hostdev.h qemu: hostdev: Introduce qemuHostdevUpdateActiveDomainDevices() 2015-10-26 13:50:35 +01:00
qemu_hotplug.c Revert "qemu_hotplug: fix checking graphics ports" 2016-05-18 17:16:56 +02:00
qemu_hotplug.h qemu: Introduce qemuDomainSecretHostdevPrepare and Destroy 2016-05-02 06:10:19 -04:00
qemu_hotplugpriv.h
qemu_interface.c util: set vlan tag for macvtap passthrough mode on SRIOV VFs 2016-05-10 14:04:19 -04:00
qemu_interface.h autocreate tap device for ethernet network type 2016-03-23 11:37:59 +00:00
qemu_migration.c graphics: rename gListen to glisten 2016-05-20 10:05:56 +02:00
qemu_migration.h qemu: migration: new migration param for persistent destination XML 2016-04-18 14:45:58 +02:00
qemu_monitor_json.c Remove qemuProcessInitPCIAddresses with dependencies 2016-05-20 07:43:39 +02:00
qemu_monitor_json.h Remove qemuProcessInitPCIAddresses with dependencies 2016-05-20 07:43:39 +02:00
qemu_monitor_text.c Remove qemuProcessInitPCIAddresses with dependencies 2016-05-20 07:43:39 +02:00
qemu_monitor_text.h Remove qemuProcessInitPCIAddresses with dependencies 2016-05-20 07:43:39 +02:00
qemu_monitor.c Remove qemuProcessInitPCIAddresses with dependencies 2016-05-20 07:43:39 +02:00
qemu_monitor.h Remove qemuProcessInitPCIAddresses with dependencies 2016-05-20 07:43:39 +02:00
qemu_parse_command.c qemu: parse: Handle suffixes for -m memory 2016-05-20 08:46:39 -04:00
qemu_parse_command.h qemu: parse: rename qemuCaps->caps 2016-02-19 09:45:23 -05:00
qemu_process.c qemu_process: separate graphics socket and address generation 2016-05-20 10:16:49 +02:00
qemu_process.h graphics: generate fake ports also for tests 2016-05-10 10:44:45 +02:00
qemu_processpriv.h
qemu.conf qemu: add support for sending QEMU stdout/stderr to virtlogd 2015-11-26 14:30:16 +00:00
test_libvirtd_qemu.aug.in qemu: add support for sending QEMU stdout/stderr to virtlogd 2015-11-26 14:30:16 +00:00
THREADS.txt There is no virDomainFindBy{ID, Name, UUID} anymore 2015-08-03 13:08:00 +02:00