1. 16 5月, 2016 1 次提交
    • J
      secret: Alter virSecretGetSecretString · abd2272c
      John Ferlan 提交于
      Rather than returning a "char *" indicating perhaps some sized set of
      characters that is NUL terminated, alter the function to return 0 or -1
      for success/failure and add two parameters to handle returning the
      buffer and it's size.
      
      The function no longer encodes the returned secret, rather it returns
      the unencoded secret forcing callers to make the necessary adjustments.
      
      Alter the callers to handle the adjusted model.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      abd2272c
  2. 12 5月, 2016 2 次提交
  3. 09 5月, 2016 1 次提交
  4. 06 5月, 2016 3 次提交
    • J
      qemu: Introduce qemuDomainSecretIV · bead05ea
      John Ferlan 提交于
      Add the data structure and infrastructure to support an initialization
      vector (IV) secrets. The IV secret generation will need to have access
      to the domain private master key, so let's make sure the prepare disk
      and hostdev functions can accept that now.
      
      Anywhere that needs to make a decision over which secret type to use
      in order to fill in or use the IV secret has a switch added.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      bead05ea
    • J
      qemu: Split out the master key create and write · 608dfc6a
      John Ferlan 提交于
      A recent review of related changes noted that we should split the creation
      (or generation) of the master key into the qemuProcessPrepareDomain and leave
      the writing of the master key for qemuProcessPrepareHost.
      
      Made the adjustment and modified some comments to functions that have
      changed calling parameters, but didn't change the intro doc.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      608dfc6a
    • J
      qemu: Adjust names of qemuDomainSecretInfoType enums · 70ae856e
      John Ferlan 提交于
      From a review after push, add the "_TYPE" into the name.
      
      Also use qemuDomainSecretInfoType in the struct rather than int
      with the comment field containing the struct name
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      70ae856e
  5. 03 5月, 2016 1 次提交
  6. 02 5月, 2016 4 次提交
    • J
      qemu: Introduce qemuDomainSecretHostdevPrepare and Destroy · d0816650
      John Ferlan 提交于
      Similar to the qemuDomainSecretDiskPrepare, generate the secret
      for the Hostdev's prior to call qemuProcessLaunch which calls
      qemuBuildCommandLine. Additionally, since the secret is not longer
      added as part of building the command, the hotplug code will need
      to make the call to add the secret in the hostdevPriv.
      
      Since this then is the last requirement to pass a virConnectPtr
      to qemuBuildCommandLine, we now can remove that as part of these
      changes. That removal has cascading effects through various callers.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      d0816650
    • J
      qemu: Introduce qemuDomainHostdevPrivatePtr · 27726d8c
      John Ferlan 提交于
      Modeled after the qemuDomainDiskPrivatePtr logic, create a privateData
      pointer in the _virDomainHostdevDef to allow storage of private data
      for a hypervisor in order to at least temporarily store auth/secrets
      data for usage during qemuBuildCommandLine.
      
      NB: Since the qemu_parse_command (qemuParseCommandLine) code is not
      expecting to restore the auth/secret data, there's no need to add
      code to handle this new structure there.
      
      Updated copyrights for modules touched. Some didn't have updates in a
      couple years even though changes have been made.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      27726d8c
    • J
      qemu: Introduce qemuDomainSecretPrepare and Destroy · 40d8e2ba
      John Ferlan 提交于
      Rather than needing to pass the conn parameter to various command
      line building API's, add qemuDomainSecretPrepare just prior to the
      qemuProcessLaunch which calls qemuBuilCommandLine. The function
      must be called after qemuProcessPrepareHost since it's expected
      to eventually need the domain masterKey generated during the prepare
      host call. Additionally, future patches may require device aliases
      (assigned during the prepare domain call) in order to associate
      the secret objects.
      
      The qemuDomainSecretDestroy is called after the qemuProcessLaunch
      finishes in order to clear and free memory used by the secrets
      that were recently prepared, so they are not kept around in memory
      too long.
      
      Placing the setup here is beneficial for future patches which will
      need the domain masterKey in order to generate an encrypted secret
      along with an initialization vector to be saved and passed (since
      the masterKey shouldn't be passed around).
      
      Finally, since the secret is not added during command line build,
      the hotplug code will need to get the secret into the private disk data.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      40d8e2ba
    • J
      qemu: Introduce qemuDomainSecretInfo · 48f56a9c
      John Ferlan 提交于
      Introduce a new private structure to hold qemu domain auth/secret data.
      This will be stored in the qemuDomainDiskPrivate as a means to store the
      auth and fetched secret data rather than generating during building of
      the command line.
      
      The initial changes will handle the current username and secret values
      for rbd and iscsi disks (in their various forms). The rbd secret is
      stored as a base64 encoded value, while the iscsi secret is stored as
      a plain text value. Future changes will store encoded/encrypted secret
      data as well as an initialization vector needed to be given to qemu
      in order to decrypt the encoded password along with the domain masterKey.
      The inital assumption will be that VIR_DOMAIN_SECRET_INFO_PLAIN is
      being used.
      
      Although it's expected that the cleanup of the secret data will be
      done immediately after command line generation, reintroduce the object
      dispose function qemuDomainDiskPrivateDispose to handle removing
      memory associated with the structure for "normal" cleanup paths.
      Signed-off-by: NJohn Ferlan <jferlan@redhat.com>
      48f56a9c
  7. 16 4月, 2016 1 次提交
    • M
      qemu: Label master key file · 744d74fa
      Martin Kletzander 提交于
      When creating the master key, we used mode 0600 (which we should) but
      because we were creating it as root, the file is not readable by any
      qemu running as non-root.  Fortunately, it's just a matter of labelling
      the file.  We are generating the file path few times already, so let's
      label it in the same function that has access to the path already.
      Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      744d74fa
  8. 13 4月, 2016 2 次提交
  9. 07 4月, 2016 1 次提交
    • J
      qemu: Create domain master key · ad7520e8
      John Ferlan 提交于
      Add a masterKey and masterKeyLen to _qemuDomainObjPrivate to store a
      random domain master key and its length in order to support the ability
      to encrypt/decrypt sensitive data shared between libvirt and qemu. The
      key will be base64 encoded and written to a file to be used by the
      command line building code to share with qemu.
      
      New API's from this patch:
      
        qemuDomainGetMasterKeyFilePath:
          Return a path to where the key is located
      
        qemuDomainWriteMasterKeyFile: (private)
          Open (create/trunc) the masterKey path and write the masterKey
      
        qemuDomainMasterKeyReadFile:
          Using the master key path, open/read the file, and store the
          masterKey and masterKeyLen. Expected use only from qemuProcessReconnect
      
        qemuDomainGenerateRandomKey: (private)
          Generate a random key using available algorithms
      
          The key is generated either from the gnutls_rnd function if it
          exists or a less cryptographically strong mechanism using
          virGenerateRandomBytes
      
         qemuDomainMasterKeyRemove:
          Remove traces of the master key, remove the *KeyFilePath
      
        qemuDomainMasterKeyCreate:
          Generate the domain master key and save the key in the location
          returned by qemuDomainGetMasterKeyFilePath.
      
          This API will first ensure the QEMU_CAPS_OBJECT_SECRET is set
          in the capabilities. If not, then there's no need to generate
          the secret or file.
      
      The creation of the key will be attempted from qemuProcessPrepareHost
      once the libDir directory structure exists.
      
      The removal of the key will handled from qemuProcessStop just prior
      to deleting the libDir tree.
      
      Since the key will not be written out to the domain object XML file,
      the qemuProcessReconnect will read the saved file and restore the
      masterKey and masterKeyLen.
      ad7520e8
  10. 04 4月, 2016 2 次提交
  11. 29 3月, 2016 3 次提交
  12. 21 3月, 2016 1 次提交
  13. 10 3月, 2016 1 次提交
  14. 08 3月, 2016 2 次提交
  15. 01 3月, 2016 2 次提交
  16. 19 2月, 2016 2 次提交
  17. 17 2月, 2016 3 次提交
  18. 05 2月, 2016 2 次提交
    • M
      systemd: Modernize machine naming · c3bd0019
      Martin Kletzander 提交于
      So, systemd-machined has this philosophy that machine names are like
      hostnames and hence should follow the same rules.  But we always allowed
      international characters in domain names.  Thus we need to modify the
      machine name we are passing to systemd.
      
      In order to change some machine names that we will be passing to systemd,
      we also need to call TerminateMachine at the end of a lifetime of a
      domain.  Even for domains that were started with older libvirt.  That
      can be achieved thanks to virSystemdGetMachineNameByPID().  And because
      we can change machine names, we can get rid of the inconsistent and
      pointless escaping of domain names when creating machine names.
      
      So this patch modifies the naming in the following way.  It creates the
      name as <drivername>-<id>-<name> where invalid hostname characters are
      stripped out of the name and if the resulting name is longer, it
      truncates it to 64 characters.  That way we can start domains we
      couldn't start before.  Well, at least on systemd.
      
      To make it work all together, the machineName (which is needed only with
      systemd) is saved in domain's private data.  That way the generation is
      moved to the driver and we don't need to pass various unnecessary
      arguments to cgroup functions.
      
      The only thing this complicates a bit is the scope generation when
      validating a cgroup where we must check both old and new naming, so a
      slight modification was needed there.
      
      Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1282846Signed-off-by: NMartin Kletzander <mkletzan@redhat.com>
      c3bd0019
    • J
      conf: add caps to virDomainSnapshotDefFormat · b8b03f64
      Joao Martins 提交于
      The virDomainSnapshotDefFormat calls into virDomainDefFormat,
      so should be providing a non-NULL virCapsPtr instance. On the
      qemu driver we change qemuDomainSnapshotWriteMetadata to also
      include caps since it calls virDomainSnapshotDefFormat.
      Signed-off-by: NJoao Martins <joao.m.martins@oracle.com>
      b8b03f64
  19. 03 2月, 2016 1 次提交
  20. 12 1月, 2016 1 次提交
    • M
      qemu: change qemuFindAgentConfig return type · d5762cc0
      Michal Privoznik 提交于
      While this is no functional change, whole channel definition is
      going to be needed very soon. Moreover, while touching this obey
      const correctness rule in qemuAgentOpen() - so far it was passed
      regular pointer to channel config even though the function is
      expected to not change pointee at all. Pass const pointer
      instead.
      Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
      d5762cc0
  21. 09 1月, 2016 1 次提交
  22. 17 12月, 2015 2 次提交
  23. 09 12月, 2015 1 次提交