1. 25 6月, 2013 22 次提交
  2. 24 6月, 2013 18 次提交
    • J
      libxl: support qdisk backend · c3021302
      Jim Fehlig 提交于
      libxl supports the LIBXL_DISK_BACKEND_QDISK disk backend, where qemu
      is used to provide the disk backend.  This patch simply maps the
      existing <driver name='qemu'/> to LIBXL_DISK_BACKEND_QDISK.
      c3021302
    • J
      libxl: Fix disk format error message · 05bcf6f0
      Jim Fehlig 提交于
      Specifying an unsupported disk format with the tap driver resulted in
      a less than helpful error message
      
      error: Failed to start domain test-hvm
      error: internal error libxenlight does not support disk driver qed
      
      Change the message to state that the qed format is not supported by
      the tap driver, e.g.
      
      error: Failed to start domain test-hvm
      error: internal error libxenlight does not support disk format qed
      with disk driver tap
      
      While at it, check for unsupported formats in the other driver
      backends.
      05bcf6f0
    • D
      Add validation that all APIs contain ACL checks · 684ce830
      Daniel P. Berrange 提交于
      Add a script which parses the driver API code and validates
      that every API registered in a virNNNDriverPtr table contains
      an ACL check matching the API name.
      
      NB this currently whitelists a few xen driver functions
      which are temporarily lacking in access control checks.
      The xen driver is considered insecure until these are
      fixed.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      684ce830
    • D
      Set process ID in system identity · 5de708c1
      Daniel P. Berrange 提交于
      When creating a virIdentityPtr for the system identity, include
      the current process ID as an attribute.
      5de708c1
    • D
      Add ACL checks into the secrets driver · 15af5e5f
      Daniel P. Berrange 提交于
      Insert calls to the ACL checking APIs in all secrets driver
      entrypoints.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      15af5e5f
    • D
      Add ACL checks into the nwfilter driver · 1eca3f5b
      Daniel P. Berrange 提交于
      Insert calls to the ACL checking APIs in all nwfilter driver
      entrypoints.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      1eca3f5b
    • D
      Add ACL checks into the node device driver · 20d8e1f1
      Daniel P. Berrange 提交于
      Insert calls to the ACL checking APIs in all node device
      driver entrypoints.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      20d8e1f1
    • D
      Add ACL checks into the interface driver · a7147bc6
      Daniel P. Berrange 提交于
      Insert calls to the ACL checking APIs in all interface
      driver entrypoints.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      a7147bc6
    • D
      Add ACL checks into the network driver · 453da48b
      Daniel P. Berrange 提交于
      Insert calls to the ACL checking APIs in all network driver
      entrypoints.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      453da48b
    • D
      Add ACL checks into the storage driver · c930410b
      Daniel P. Berrange 提交于
      Insert calls to the ACL checking APIs in all storage driver
      entrypoints.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      c930410b
    • D
      Add ACL checks into the libxl driver · f5e007c3
      Daniel P. Berrange 提交于
      Insert calls to the ACL checking APIs in all libxl driver
      entrypoints.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      f5e007c3
    • D
      Add ACL checks into the Xen driver · cffe870c
      Daniel P. Berrange 提交于
      Insert calls to the ACL checking APIs in all Xen driver
      entrypoints.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      cffe870c
    • D
      Add ACL checks into the UML driver · d78277f9
      Daniel P. Berrange 提交于
      Insert calls to the ACL checking APIs in all UML driver
      entrypoints.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      d78277f9
    • D
      Add ACL checks into the LXC driver · 279866d5
      Daniel P. Berrange 提交于
      Insert calls to the ACL checking APIs in all LXC driver
      entrypoints.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      279866d5
    • D
      Add ACL checks into the QEMU driver · abf75aea
      Daniel P. Berrange 提交于
      Insert calls to the ACL checking APIs in all QEMU driver
      entrypoints.
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      abf75aea
    • D
      Auto-generate helpers for checking access control rules · 68602622
      Daniel P. Berrange 提交于
      Extend the 'gendispatch.pl' script to be able to generate
      three new types of file.
      
      - 'aclheader' - defines signatures of helper APIs for
        doing authorization checks. There is one helper API
        for each API requiring an auth check. Any @acl
        annotations result in a method being generated with
        a suffix of 'EnsureACL'. If the ACL check requires
        examination of flags, an extra 'flags' param will be
        present. Some examples
      
        extern int virConnectBaselineCPUEnsureACL(void);
        extern int virConnectDomainEventDeregisterEnsureACL(virDomainDefPtr domain);
        extern int virDomainAttachDeviceFlagsEnsureACL(virDomainDefPtr domain, unsigned int flags);
      
        Any @aclfilter annotations resuilt in a method being
        generated with a suffix of 'CheckACL'.
      
        extern int virConnectListAllDomainsCheckACL(virDomainDefPtr domain);
      
        These are used for filtering individual objects from APIs
        which return a list of objects
      
      - 'aclbody' - defines the actual implementation of the
        methods described above. This calls into the access
        manager APIs. A complex example:
      
          /* Returns: -1 on error (denied==error), 0 on allowed */
          int virDomainAttachDeviceFlagsEnsureACL(virConnectPtr conn,
                                                  virDomainDefPtr domain,
                                                  unsigned int flags)
          {
              virAccessManagerPtr mgr;
              int rv;
      
              if (!(mgr = virAccessManagerGetDefault()))
                  return -1;
      
              if ((rv = virAccessManagerCheckDomain(mgr,
                                                    conn->driver->name,
                                                    domain,
                                                    VIR_ACCESS_PERM_DOMAIN_WRITE)) <= 0) {
                  virObjectUnref(mgr);
                  if (rv == 0)
                      virReportError(VIR_ERR_ACCESS_DENIED, NULL);
                  return -1;
              }
              if (((flags & (VIR_DOMAIN_AFFECT_CONFIG|VIR_DOMAIN_AFFECT_LIVE)) == 0) &&
                  (rv = virAccessManagerCheckDomain(mgr,
                                                    conn->driver->name,
                                                    domain,
                                                    VIR_ACCESS_PERM_DOMAIN_SAVE)) <= 0) {
                  virObjectUnref(mgr);
                  if (rv == 0)
                      virReportError(VIR_ERR_ACCESS_DENIED, NULL);
                  return -1;
              }
              if (((flags & (VIR_DOMAIN_AFFECT_CONFIG)) == (VIR_DOMAIN_AFFECT_CONFIG)) &&
                  (rv = virAccessManagerCheckDomain(mgr,
                                                    conn->driver->name,
                                                    domain,
                                                    VIR_ACCESS_PERM_DOMAIN_SAVE)) <= 0) {
                  virObjectUnref(mgr);
                  if (rv == 0)
                      virReportError(VIR_ERR_ACCESS_DENIED, NULL);
                  return -1;
              }
              virObjectUnref(mgr);
              return 0;
          }
      
      - 'aclsyms' - generates a linker script to export the
         APIs to drivers. Some examples
      
        virConnectBaselineCPUEnsureACL;
        virConnectCompareCPUEnsureACL;
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      68602622
    • D
      Add ACL annotations to all RPC messages · e341435e
      Daniel P. Berrange 提交于
      Introduce annotations to all RPC messages to declare what
      access control checks are required. There are two new
      annotations defined:
      
       @acl: <object>:<permission>
       @acl: <object>:<permission>:<flagname>
      
        Declare the access control requirements for the API. May be repeated
        multiple times, if multiple rules are required.
      
          <object> is one of 'connect', 'domain', 'network', 'storagepool',
                   'interface', 'nodedev', 'secret'.
          <permission> is one of the permissions in access/viraccessperm.h
          <flagname> indicates the rule only applies if the named flag
          is set in the API call
      
       @aclfilter: <object>:<permission>
      
        Declare an access control filter that will be applied to a list
        of objects being returned by an API. This allows the returned
        list to be filtered to only show those the user has permissions
        against
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      e341435e
    • D
      Add a policy kit access control driver · b904bba7
      Daniel P. Berrange 提交于
      Add an access control driver that uses the pkcheck command
      to check authorization requests. This is fairly inefficient,
      particularly for cases where an API returns a list of objects
      and needs to check permission for each object.
      
      It would be desirable to use the polkit API but this links
      to glib with abort-on-OOM behaviour, so can't be used. The
      other alternative is to speak to dbus directly
      Signed-off-by: NDaniel P. Berrange <berrange@redhat.com>
      b904bba7