helios-server
helios-server copied to clipboard
System installation
Hello! We are trying to test helios in a virtual enviroment, but we have some implementation problems. We surpassed the installation process, but now we can't login to the system. We tried password & google authentication methods and we get the following python error responses:
Using google oauth:
Request Method: | GET
-- | --
http://example.com:8080/auth/after/?code=4/SQ***dIr0&scope=email+profile+https://www.googleapis.com/auth/userinfo.profile+https://www.googleapis.com/auth/userinfo.email
1.8.19
KeyError
'names'
/home/admin/helios-server-master/helios_auth/auth_systems/google.py in get_user_info_after_auth, line 57
/home/admin/helios-server-master/venv/bin/python
2.7.9
['/home/admin/helios-server-master', '/home/admin/helios-server-master/venv/lib/python2.7', '/home/admin/helios-server-master/venv/lib/python2.7/plat-x86_64-linux-gnu', '/home/admin/helios-server-master/venv/lib/python2.7/lib-tk', '/home/admin/helios-server-master/venv/lib/python2.7/lib-old', '/home/admin/helios-server-master/venv/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/home/admin/helios-server-master/venv/local/lib/python2.7/site-packages']
Lun, 13 May 2019 09:39:35 -0700
Using Password auth (creating user in postgres DB with plain and md5 token column entry as password):
Request Method: | POST
-- | --
http://example.com:8080/auth/password/login
1.8.19
KeyError
'password'
/home/admin/helios-server-master/helios_auth/auth_systems/password.py in password_check, line 33
/home/admin/helios-server-master/venv/bin/python
2.7.9
['/home/admin/helios-server-master', '/home/admin/helios-server-master/venv/lib/python2.7', '/home/admin/helios-server-master/venv/lib/python2.7/plat-x86_64-linux-gnu', '/home/admin/helios-server-master/venv/lib/python2.7/lib-tk', '/home/admin/helios-server-master/venv/lib/python2.7/lib-old', '/home/admin/helios-server-master/venv/lib/python2.7/lib-dynload', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/home/admin/helios-server-master/venv/local/lib/python2.7/site-packages']
Lun, 13 May 2019 09:43:31 -0700
I need some advice in the correct steps to get helios working
Hello Cristian!
I've just tested my local copy running Ben's code and I was able to login with Gmail. I've just recovered some old thread in google groups (if you don't know, I would recommend signing up there and maybe even posting questions like this there) where he doesn't recommend to use password type , since "That is older code that was never clear to use and the flows probably won't work well.":
"https://groups.google.com/forum/#!searchin/helios-voting/password%7Csort:date/helios-voting/Uo1InglgqUs/5ltyeQggtmoJ"
Back to Gmail, since you received similar error in both cases, I think that might be some problem previous to that point. Do you know debbugin with IPython? I have it installed and I use it like this:
-
edit helios_auth/auth_systems/google.py
-
before the line cited by the error message I do this:
import IPython IPython.embed() #get the nice name http = httplib2.Http(".cache") http = credentials.authorize(http) (resp_headers, content) = http.request("https://people.googleapis.com/v1/people/me?personFields=names", "GET")
then, in the terminal where I am running python manage.py runserver, it stops at that point and I can run the lines of interest and see what the results are.
For example:
In [1]: http = httplib2.Http(".cache")
In [2]: http = credentials.authorize(http)
In [3]: (resp_headers, content) = http.request("https://people.googleapis.com/v1/people/me?personFields=names", "GET") 2019-05-16 04:33:25,880 WARNING new_request() takes at most 1 positional argument (2 given)
In [4]:
In [4]: response = json.loads(content)
In [5]: response
Out[5]:
{u'etag':
As you can see, in the response you should have the key 'names'. You can do that in previous code until you get exactly where the problems is occurring.
Hope that helps!
Interesting to know that password auth is not recommended. It would be nice to have known that from a comment in the settings.py
file. Regardless, I've been using password authentication and I haven't had any issues. @c-urrutia, the reason you are getting a KeyError
for password
is because your user does not have the password
key defined in the json object in the info
column for that user.
I use the following command in a shell script where the shell variables ${USER_EMAIL}
, ${USER_NAME}
, and ${USER_PASS}
are set. You can change admin_p
to False
if you do not want to create an admin account.
echo "from helios_auth.models import User; \
User.objects.create(user_type='password',user_id='${USER_EMAIL}', \
info={'name':'${USER_NAME}','password':'${USER_PASS}'}, admin_p=True)" | \
python manage.py shell
Also, I suspect your google authentication exception is coming from this line. This suggests that either google's auth api has changed or you're not sending valid authentication info. I don't use google auth, so I'm not sure if it still works, but @shirlei suggests that it is.
Hi @crass and @shirlei! I've been using the tutorial made by Shirley at https://github.com/ifsc/helios-server, so, apologies if this issue has no place here. I've finished the system installation and connected as Admin, but couldn't add news users in "Helios_Auth". When I try to do so, i get the following error:
"IntegrityError at /admin/helios_auth/user/add/ null value in column "info" violates not-null constraint DETAIL: Failing row contains (3, asd, sa, sa, null, null, f)"
That made me think that I haven't properly configured something and the JSON isn't properly working. Can anyone help me with this problem?
PS: I've been trying to made this installation in a virtual machine. I have almost no knowledge about Linux and I've struggled for the last 3 days just to get here... lol
Hello @c-urrutia!
I don't know if this helps you, but I had the same error using google oauth, the problem was only because I hadn't enabled the People API on console.developers.
@diheldiniz,
This apparently happens because the admin panel does not provide any value for the database info column. If you do not use "password" authentication method, you can add a default value for the info column.
Does anyone know if this can open any serious vulnerabilities in the system?
https://github.com/benadida/helios-server/blob/449988927869bf6139b12f15e3dcfc2b78e1f900/helios_auth/models.py#L26
Interesting to know that password auth is not recommended. It would be nice to have known that from a comment in the
settings.py
file. Regardless, I've been using password authentication and I haven't had any issues. @c-urrutia, the reason you are getting aKeyError
forpassword
is because your user does not have thepassword
key defined in the json object in theinfo
column for that user.I use the following command in a shell script where the shell variables
${USER_EMAIL}
,${USER_NAME}
, and${USER_PASS}
are set. You can changeadmin_p
toFalse
if you do not want to create an admin account.echo "from helios_auth.models import User; \ User.objects.create(user_type='password',user_id='${USER_EMAIL}', \ info={'name':'${USER_NAME}','password':'${USER_PASS}'}, admin_p=True)" | \ python manage.py shell
Also, I suspect your google authentication exception is coming from this line. This suggests that either google's auth api has changed or you're not sending valid authentication info. I don't use google auth, so I'm not sure if it still works, but @shirlei suggests that it is.
Interesting to know that password auth is not recommended. It would be nice to have known that from a comment in the
settings.py
file. Regardless, I've been using password authentication and I haven't had any issues. @c-urrutia, the reason you are getting aKeyError
forpassword
is because your user does not have thepassword
key defined in the json object in theinfo
column for that user.I use the following command in a shell script where the shell variables
${USER_EMAIL}
,${USER_NAME}
, and${USER_PASS}
are set. You can changeadmin_p
toFalse
if you do not want to create an admin account.echo "from helios_auth.models import User; \ User.objects.create(user_type='password',user_id='${USER_EMAIL}', \ info={'name':'${USER_NAME}','password':'${USER_PASS}'}, admin_p=True)" | \ python manage.py shell
Also, I suspect your google authentication exception is coming from this line. This suggests that either google's auth api has changed or you're not sending valid authentication info. I don't use google auth, so I'm not sure if it still works, but @shirlei suggests that it is.
Hello
Which user and which password do you use to enter using the password method?
I try to enter http://localhost:8000/auth/password/login with user type admin, but it doesn't work for me. Check the tables in the database and I see the correct data in: auth_user.
Finally I want to enter to create a vote.
Thanks for the help
Hello @c-urrutia!
I don't know if this helps you, but I had the same error using google oauth, the problem was only because I hadn't enabled the People API on console.developers.
Saved the day for me! Google Auth works after People API enabled! Thanks @c-urrutia !