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

Python error on testing external_cloud.py #17

Closed
marxistvegan opened this issue Jun 7, 2017 · 5 comments
Closed

Python error on testing external_cloud.py #17

marxistvegan opened this issue Jun 7, 2017 · 5 comments

Comments

@marxistvegan
Copy link

marxistvegan commented Jun 7, 2017

Hey folks,
So I followed the instructions I thought to a 'T'

The nextcloud instance can talk the 'bosh'
'internal_plain' works to login

When I try to use this I am not able to login, on the client says not authorized, so I tried to run
./external_cloud.py -c /etc/external_cloud.conf -l /var/log/prosody/ -I <nextcloud user> <nextcloud domain>

2017-06-07 19:02:08,548 INFO: Start external auth script 0.2.0+ for prosody with endpoint: https://nextcloud.dev.glocal.coop/index.php/apps/ojsxc/ajax/externalApi.php
2017-06-07 19:02:08,572 INFO: Starting new HTTPS connection (1): nextcloud.dev.glocal.coop
Traceback (most recent call last):
  File "./external_cloud.py", line 262, in <module>
    success = is_user(ISUSER_TEST[0], ISUSER_TEST[1])
  File "./external_cloud.py", line 180, in is_user
    if is_user_cloud(username, server):
  File "./external_cloud.py", line 103, in is_user_cloud
    'domain':server
  File "./external_cloud.py", line 43, in send_request
    logging.warn('An error occured during the request: %s' % err)
TypeError: __str__ returned non-string (type Error)

Not sure where to start

@MarcelWaldvogel
Copy link
Contributor

Googling for TypeError: __str__ returned non-string (type Error) gave a few links related to the requests library which external_cloud.py also uses, e.g. psf/requests#2524. They seem to be related to handling SSL errors.

I checked your URL, and the certificate expired in February. I would expect fixing this to solve the problem.

I agree, however, that the error message is horrible, at best. I will try to find out why it doesn't show anything better.

@MarcelWaldvogel
Copy link
Contributor

The weirdness of the error message seems to be version dependent.

On Ubuntu 16.04 (Python 2.7.12, requests 2.16.5), the message is: WARNING: An error occured during the request: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590); on Ubuntu 17.04 (Python 2.7.13, requests 2.10.0), WARNING: An error occured during the request: ("bad handshake: Error([('SSL routines', 'ssl3_get_server_certificate', 'certificate verify failed')],)",).

Maybe updating your requests library would create a more helpful error message?

@MarcelWaldvogel
Copy link
Contributor

Here is an experimental fix (aka hack): Can you try fdf9d86?

@marxistvegan
Copy link
Author

Thanks! Good catch! Now a different error that i think i can resolve but this is resolved from updating the cert :)

@MarcelWaldvogel
Copy link
Contributor

"Fixed" by fdf9d86 (making the error message clearer for older request/urllib/ssl errors)

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

2 participants