Terradue / DotNet4One

.Net Library to Access XML-RPC API of Opennebula
GNU Affero General Public License v3.0
6 stars 4 forks source link

Usage Example Problem #4

Closed childonline closed 9 years ago

childonline commented 9 years ago

I'm trying to run the usage example on top of the virtualbox sandbox provided by opennebula found here: http://opennebula.org/tryout/sandboxvirtualbox/

image

As you can see I've got my VM up and running and working properly on http://localhost:9869/.

However, running:

string proxyUrl = "http://localhost:9869/";
string adminUser = "oneadmin";
string adminPwd = "opennebula";
OneClient one = new OneClient(proxyUrl, adminUser, adminPwd);

USER_POOL pool = one.UserGetPoolInfo();

fails on line:

USER_POOL pool = one.UserGetPoolInfo();

with the following error: image

I assume adminUser and adminPwd are incorrect, but these are the only credentials provided. Any hints why this fails?

Thanks!

enguer commented 9 years ago

Indeed, this kind of user and password may not work. The user should be a user with driver server_* to allow requests delegation and the password should be the SHA1 password. I recommend to use the user "serveradmin" (should be created by default) and the associated SHA1 password (you can find it doing "oneuser show ", being the id of the user). Let us know if it helps. Best Regards The Terradue team

childonline commented 9 years ago

I created a new user "admin", assigned it to the oneadmin group (the same group serveradmin is assigned to) and changed its authdriver to server* as seen below: image

Both passwords admin and fe76e79cbc08db8ef3363090fffd5bc718630412 fail with the same exception as before.

I also tried logging with serveradmin but the auth_driver on that is server_cipher. image

enguer commented 9 years ago

In fact, by server_*, I meant server_cipher ot server_x509. Did you try to login using "serveradmin" and "c9dff.....660" ? If yes and it did not work, it means there is another problem to be investigated. Best Regards The Terradue team

childonline commented 9 years ago

Yes, I did try serveradmin with "c9dff..." :(

enguer commented 9 years ago

Another possibility is that the url you use is wrong. Usually, default XmlRpc urls look like this: http://localhost:2633/RPC2 (cf: http://archives.opennebula.org/documentation:rel4.4:manage_users) Best Regards The Terradue team

childonline commented 9 years ago

You are absolutley right, I just checked /etc/one/oned.conf & the endpoint url should indeed be http://localhost:2633/RPC2. Sunstone also confirms it: image

So I forwarded port 2633 in VirtualBox, restarted the VM and tried running the following code again:

string proxyUrl = "http://localhost:2633/RPC2";
string adminUser = "serveradmin";
string adminPwd = "c9dff2583b47e24c2946419e40dc8ccf6ce0e660";

OneClient one = new OneClient(proxyUrl, adminUser, adminPwd);

USER_POOL pool = one.UserGetPoolInfo();

However, this time I am greeted with a new exception: image

So it seems some progress has been made, but I really don't understand why it fails authentification, I made no changes to serveradmin.

enguer commented 9 years ago

I think you are not using the good password. Try to use the one you can find in ~/.one/sunstone_auth Best Regards The Terradue team

childonline commented 9 years ago

That did the trick! The file was in /var/lib/one/.one, but once I found it everything went smoothly.

Thanks alot for helping me out here :beer: !