[libvirt] Regression testing libvirt authentication

Eric Blake eblake at redhat.com
Fri Jan 10 14:15:51 UTC 2014


On 01/10/2014 07:12 AM, Daniel P. Berrange wrote:
> On Wed, Jan 08, 2014 at 04:32:12PM +0000, Richard W.M. Jones wrote:
>>
>> I'm trying to find a way to regression-test a program which uses
>> libvirt authentication (virConnectAuth, virConnectAuthPtr).  Ideally
>> the test:/// driver would be able to fake authentication demands, but
>> it doesn't seem to be able to do that.
>>
>> Any suggestions?  Would this feature belong in the test driver or
>> elsewhere?
> 
> I'd guess we could easily add auth to the test driver. Either the XML
> doc for the test driver could allow you to fully specify auth parameters
> it should try to collect or perhaps URI parameters could be abused.

In fact, Rich did the former (XML describes the parameters to collect):

commit e093351209a4937631ec70d6007b096c6754dcce
Author: Richard W.M. Jones <rjones at redhat.com>
Date:   Wed Jan 8 18:32:48 2014 +0000

    test driver: Add authentication to test driver.

    There is no easy way to test authentication against libvirt.  This
    commit modifies the test driver to allow simple username/password
    authentication.

    You modify the test XML by adding:

     <node>
       ...
       <auth>
         <user password="123456">rich</user>
         <user>jane</user>
       </auth>
     </node>

    If there are any /node/auth/user elements, then authentication is
    required by the test driver (if none are present, then the test driver
    will work as before and not require authentication).

    In the example above, two phony users are added:

     rich  password: 123456
     jane  no password required

    The test driver will demand a username.  If the password attribute is
    present (or if the username entered is wrong), then the password is
    also asked for and checked:

     $ virsh -c test://$(pwd)/testnode.xml list
     Enter username for localhost: rich
     Enter rich's password for localhost: ***
      Id    Name                           State
     ----------------------------------------------------
      1     fv0                            running
      2     fc4                            running

    Signed-off-by: Richard W.M. Jones <rjones at redhat.com>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 604 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20140110/9d1ee10a/attachment-0001.sig>


More information about the libvir-list mailing list