Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create admin account for myself. #4

Open
RyPoints opened this issue Aug 5, 2016 · 10 comments
Open

Create admin account for myself. #4

RyPoints opened this issue Aug 5, 2016 · 10 comments

Comments

@RyPoints
Copy link

RyPoints commented Aug 5, 2016

As some background, I have svmp-overseer and svmp-server compiling and functional on an OpenStack sever. I also got svmp-web-console compiling, though I understand it is a deprecated version of svmp-overseer.

In svmp-web-console part of the setup was to create a default admin user and part of the screenshot you show is an admin account that can approve pending accounts. I tried grunt add-default-admin and grunt reports adding the user, but that user then cannot login to svmp-web-console.

Of course, I'm actually more interested in getting this same idea functioning on svmp-overseer. I didn't see any options for creating a similar admin account though and all user accounts show a pending account status. Perhaps this is just a matter of modifying a 'user' entry to an 'admin' entry in the mongodb somehow or is there an easier way? What are the account details needed to access mongodb if this is the best way to do so?

Eventually, I went through the code hacking admin access into every place I saw it referenced in the code, with the idea that after I gave myself admin access, I could approve the pending users and then remove that code. This did allow me to access the Pending Users screen, but no pending users are listed, even though I have plenty of pending user accounts that I created. If you have any tips on completing hacking the code in this way to grant myself some admin access, that would also do.

Thanks in advance for any help you can provide!

@dkeppler
Copy link
Member

dkeppler commented Aug 7, 2016

The add-default-admin grunt task should work the same for svmp-overseer. See https://github.com/SVMP/svmp-overseer/blob/master/Gruntfile.js#L69. You can change the username and password it uses at lines 79 & 80 that function.

If it's still not working, make sure 'dev' and 'prod' databases aren't getting mixed up. The mongo db doesn't have a user/pass unless you intentionally set one in the db url in the config file.

Also take a look at the svmp-server-cli repo for another tool that gives additional control over users and other settings.

@RyPoints
Copy link
Author

RyPoints commented Aug 8, 2016

Thanks for this @dkeppler .

I had already edited the Gruntfile.js and done all this and got a "Default admin already exists!" message when I attempted to do it again. However, I just reset my mongodb, then ran it one more time and I could login under the default admin account I created. Now I'm seeing:

2016-08-08T19:43:54.587Z - error: listVolumes failed: code=ECONNREFUSED, errno=ECONNREFUSED, syscall=connect

But I'm thinking that has to do with me needing to update the OpenStack credentials in the config-local.yaml, so I'll get to that. Thanks again for the help!

@RyPoints
Copy link
Author

RyPoints commented Aug 8, 2016

So, updating the settings got rid of 2016-08-08T19:43:54.587Z - error: listVolumes failed: code=ECONNREFUSED, errno=ECONNREFUSED, syscall=connect.

However, I'm currently seeing in the web interface:

Error creating the Volume. Check your cloud setting and the connection.

My OpenStack config is now:

    # only required if 'cloud_platform' is set to 'openstack'
    authUrl: "https://localhost:5000/"
    username: <My CityCloud Login>
    password: <My CityCloud Password>
    tenantId: See image from Projects screen.  I'm using the Id value from there.
    tenantName: "Default Project 23694"
    region: "La1"

citycloud

Does that all look okay to you? Is that the only configuration issue that could be causing writing the volume to display an error?

@dkeppler
Copy link
Member

dkeppler commented Aug 9, 2016

You need to configure the rest of the VM settings as described here, particularly the part about data volumes.

I just noticed that page doesn't say what format the volume needs to be in. The easiest way to do that is to:

  1. launch a temporary linux VM on your cloud account
  2. attach a fresh block storage volume to it
  3. create a partition table on the volume with at least one primary partition
  4. format the first partition as ext4

Then you can terminate the temp VM and snapshot the volume. The UUID of that snapshot is what you use for goldsnapshotId.

@RyPoints
Copy link
Author

RyPoints commented Aug 9, 2016

Ah, thank you. That's exactly the doc I needed. I'll get to doing that and let you know how I do.

@RyPoints
Copy link
Author

RyPoints commented Aug 9, 2016

So I started from a fresh clone, copied my config-local.yaml's and did 1, 2, 3 and 4. I took a snapshot of the volume and added the Id to goldsnapshotId. I also created and added the auth_key and the overseer_url. However, even after doing that I still see the same error in the web interface:

Error creating the Volume. Check your cloud setting and the connection.

So, then, I installed the svmp-config tool. I hadn't previously installed that. I started to go through the config options on the doc you linked. I created the auth_key and I added environment variables for the overseer_url and auth_key. When I tried 'svmp-config devices' I saw:

Supported device types:
    Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE

I am using the SSL and the site was accessible via https://. However, since that error indicated an SSL issue, I went to the config and turned the SSL options off and the URL options to http://. Then, I tried 'svmp-config devices' again and I saw:

Supported device types:
    Error code: 500, text: TypeError: Cannot read property &#39;sub&#39; of undefined
    at /home/centos/svmp-overseer/lib/authentication.js:75:38
    at Object.module.exports.verify (/home/centos/svmp-overseer/node_modules/jsonwebtoken/index.js:39:12)
    at Object.exports.checkAdminToken [as handle] (/home/centos/svmp-overseer/lib/authentication.js:74:13)
    at next_layer (/home/centos/svmp-overseer/node_modules/express/lib/router/route.js:103:13)
    at Route.dispatch (/home/centos/svmp-overseer/node_modules/express/lib/router/route.js:107:5)
    at /home/centos/svmp-overseer/node_modules/express/lib/router/index.js:205:24
    at Function.proto.process_params (/home/centos/svmp-overseer/node_modules/express/lib/router/index.js:269:12)
    at next (/home/centos/svmp-overseer/node_modules/express/lib/router/index.js:199:19)
    at next (/home/centos/svmp-overseer/node_modules/express/lib/router/index.js:176:38)
    at next (/home/centos/svmp-overseer/node_modules/express/lib/router/index.js:176:38)
    at Layer.handle (/home/centos/svmp-overseer/app/routes/log.js:110:9)
    at trim_prefix (/home/centos/svmp-overseer/node_modules/express/lib/router/index.js:240:15)
    at /home/centos/svmp-overseer/node_modules/express/lib/router/index.js:208:9
    at Function.proto.process_params (/home/centos/svmp-overseer/node_modules/express/lib/router/index.js:269:12)
    at next (/home/centos/svmp-overseer/node_modules/express/lib/router/index.js:199:19)
    at SendStream.error (/home/centos/svmp-overseer/node_modules/express/node_modules/serve-static/index.js:86:37)

Do you have any additional configuration recommendations?

@RyPoints
Copy link
Author

RyPoints commented Aug 10, 2016

So export NODE_TLS_REJECT_UNAUTHORIZED=0 will get svmp-config devices beyond UNABLE_TO_VERIFY_LEAF_SIGNATURE. This is somewhat expected on my server setup, as I'm using self-signed certificates and no external certificate authority at this stage. After adding that though, both SSL and non-SSL versions get the above and below code:

500, text: TypeError: Cannot read property &#39;sub&#39; of undefined

I also see this same code currently when running svmp-config add and svmp-config list.

@RyPoints
Copy link
Author

RyPoints commented Aug 11, 2016

I got this functioning on my own after I realized this error had to do with the auth_token. Your sample auth_token in the config file is a little confusing due to its length. The real auth_token is much longer and when I created the token it said something like:

Creating token: {"sub":"svmp-server-N","jti":"8abcde12-a345-67e9-10c7-11p12r131e4a","iss":"server-1234-5678","role":"admin"}
mxquikxfbszxnabqqbtdrzkegiuzuwjxjkizheqheohxxlemzgnlrnboxwfwjpodpcukqrlgskmlwtozejjlckynggaabqrltflmmsxmfcnutlxhzdcbqkoqkcusopaxdgxvdgyvntuypevhpmkipsrztvfheqigozpzdevuhqeuhporvqzdxygggtmnihiyfpzbjqbsjwblmzjdetgigpmknkzvaasllagetszwnmotzbuskowpkfazsibqhhbwrczdlhfzarehedexiqjtfajweccexqxtru-

I originally thought the key was 8abcde12-a345-67e9-10c7-11p12r131e4a because that matched the length of your sample key in the config, but the key was actually the longer string.

I'm seeing proper output now for svmp-config list and I'll continue with configuring this.

@RyPoints
Copy link
Author

RyPoints commented Aug 11, 2016

svmp-config devices and svmp-config list now give the expected results. However, for svmp-config add I see:

Adding a new user...
    Error code: 500, text: {"msg":"Error adding user: Validation failed"}

For svmp-config images I see:
Error code: 500, text: {"msg":"Error listing Cloud Flavors"}

And for svmp-config volume-create <username> I see:
Error code: 500, text: {"msg":"Problem creating Volume for user"}

Also, as reported in Issue #5 when I attempt to approve new users I'm currently seeing Password should be at least 8 characters in the web interface even though all the users have passwords of at least that length that follow the password requirements.

Any ideas on how to get beyond those issues?

@sirishkalidindi
Copy link

Hey RyPoints,

I'm struck at the same point :( ..... have you out the fix? if so could help me out here?

Thanks
Sirish K

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants