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

[ssl-issues] sslv3 alert handshake failure on Debian System #330

Closed
MatthiasJaeger opened this issue Apr 4, 2015 · 33 comments
Closed

[ssl-issues] sslv3 alert handshake failure on Debian System #330

MatthiasJaeger opened this issue Apr 4, 2015 · 33 comments

Comments

@MatthiasJaeger
Copy link

After experiencing #323 I switched to your project as it seems to be better maintained and downloaded the master branch. The problem is not fixed for me. But if I replace "AUTH_URL_V3" by "AUTH_URL" in coockies.py, line 116 I can use the downloader.

Unmodified master branch output:

$ ./coursera-dl --clear-cache -n ~/.netrc globalaffairsfinal-001
Downloading class: globalaffairsfinal-001
Starting new HTTPS connection (1): class.coursera.org
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Starting new HTTPS connection (1): www.coursera.org
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Traceback (most recent call last):
  File "./coursera-dl", line 6, in <module>
    coursera_dl.main()
  File "/home/lobo32/coursera-dl/coursera/coursera_dl.py", line 932, in main
    result = download_class(args, class_name)
  File "/home/lobo32/coursera-dl/coursera/coursera_dl.py", line 828, in download_class
    username=args.username, password=args.password
  File "/home/lobo32/coursera-dl/coursera/cookies.py", line 339, in get_cookies_for_class
    get_authentication_cookies(session, class_name, username, password)
  File "/home/lobo32/coursera-dl/coursera/cookies.py", line 162, in get_authentication_cookies
    login(session, username, password, class_name=class_name)
  File "/home/lobo32/coursera-dl/coursera/cookies.py", line 117, in login
    headers=headers, allow_redirects=False)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 507, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 464, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 431, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure
@mxamin
Copy link
Contributor

mxamin commented Apr 4, 2015

What is the version of your Python? It should work on v2.7.9, v3.2 and above.

@MatthiasJaeger
Copy link
Author

The version of the python Debian package is 2.7.3-4+deb7u1. It is the current version in Debian Wheezy. But soon Debian Jessie will become stable which means that I (as well as many other Debian users) will upgrade and then have python 2.7.9.

$ python
Python 2.7.3 (default, Mar 13 2014, 11:03:55) 
[GCC 4.7.2] on linux2

@rbrito
Copy link
Member

rbrito commented Apr 5, 2015

Hi, Matthias.

On Apr 04 2015, MatthiasJaeger wrote:

After experiencing #323 I switched to your project as it seems to be
better maintained and downloaded the master branch.

Oh, super nice. I'll take that as a compliment! :)

The problem is not fixed for me. But if I replace "AUTH_URL_V3" by
"AUTH_URL" in coockies.py, line 116 I can use the downloader.

OK. I will see what I can do. I do have interest in having even older
version of Debian working, but I am 100% of the time working with Debian
testing or unstable (I am a Debian Maintainer myself).

So you said that substituting AUTH_URL_V3 with AUTH_URL makes things work
again for you? Usually, these problems with SSL happen deep down in
OpenSSL, but some can be worked around in Python. If that's the case, then I
may change things (or, at least, create a command-line option for users to
select which auth URL to use).

Do you happen to use any on-demand course or only regular ones? I'm just
checking since coursera is a moving target and we essentially have to follow
what they do there.

Regards,

Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA
http:https://cynic.cc/blog/ : github.com/rbrito : profiles.google.com/rbrito
DebianQA: http:https://qa.debian.org/developer.php?login=rbrito%40ime.usp.br

@rbrito
Copy link
Member

rbrito commented Apr 5, 2015

@MatthiasJaeger,

I have modified my local copy to use AUTH_URL instead of AUTH_URL_V3 and, as you suggested, things seem to work fine for me. But I guess that I am not really a valuable data point, since I was unaffected by Coursera's removal of SSLv3 (read: everything used to work fine with me either way).

It would be nice to have more people testing these changes before I go ahead and commit a change to our repository.

Thanks,

Rogério Brito.

@Cxrille
Copy link

Cxrille commented Apr 5, 2015

Hi. I have a really hard time getting coursera-dl to work again and I'm running out of ideas.
I still get "urlopen error [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure" when trying to get anything.

  • I upgraded to Linux Mint 17.1 Rebecca (Ubuntu 14.04 LTS)
  • I built python 2.7.9 from source (python -V : Python 2.7.9)
  • I tried updating coursera-dl with pip : sudo -H pip install coursera-dl -U
  • I tried cloning this repository but cannot get it to work : ./coursera-dl -> "ImportError: No module named requests" (and yes, everything is already up to date with "sudo -H pip install -r requirements.txt -U")
  • I installed lot's of stuff from various posts (stackoverflow, ...)

Please, tell me what to do in order to resume downloading my 70+ courses !

@MatthiasJaeger
Copy link
Author

Please tell me if there is anything else I can test to help you. I originally tested it on a normal course and a final project.

Now I also tried testing it for an on-demand course. It shows the same problem, but even after substituting AUTH_URL_V3 with AUTH_URL this doesn't work and a simmilar problem seems to arrise from a different source. But since I never tried before and therefore never successfully downloaded a on-demand course I might be doing something wrong there ... The test and output with AUTH_URL_V3:

$ ./coursera-dl --clear-cache --on-demand -n .netrc learn-chinese
Downloading class: learn-chinese
Starting new HTTPS connection (1): www.coursera.org
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Traceback (most recent call last):
  File "./coursera-dl", line 6, in <module>
    coursera_dl.main()
  File "/home/lobo32/coursera-dl/coursera/coursera_dl.py", line 930, in main
    result = download_on_demand_class(args, class_name)
  File "/home/lobo32/coursera-dl/coursera/coursera_dl.py", line 873, in download_on_demand_class
    login(session, args.username, args.password)
  File "/home/lobo32/coursera-dl/coursera/cookies.py", line 117, in login
    headers=headers, allow_redirects=False)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 507, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 464, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 431, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure

The test and output with AUTH_URL:

 ./coursera-dl --clear-cache --on-demand -n .netrc learn-chinese
Downloading class: learn-chinese
Starting new HTTPS connection (1): accounts.coursera.org
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Logged in on coursera.org.
Starting new HTTPS connection (1): www.coursera.org
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Traceback (most recent call last):
  File "./coursera-dl", line 6, in <module>
    coursera_dl.main()
  File "/home/lobo32/coursera-dl/coursera/coursera_dl.py", line 930, in main
    result = download_on_demand_class(args, class_name)
  File "/home/lobo32/coursera-dl/coursera/coursera_dl.py", line 876, in download_on_demand_class
    page = get_on_demand_syllabus(session, class_name)
  File "/home/lobo32/coursera-dl/coursera/coursera_dl.py", line 202, in get_on_demand_syllabus
    page = get_page(session, url)
  File "/home/lobo32/coursera-dl/coursera/coursera_dl.py", line 129, in get_page
    r = session.get(url)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 476, in get
    return self.request('GET', url, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 464, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 431, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:504: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure

While set to AUTH_URL and downloading a normal course it works but it produces warning messages for insecure connections:

$ ./coursera-dl -n .netrc globalaffairsfinal-001
Downloading class: globalaffairsfinal-001
Starting new HTTPS connection (1): class.coursera.org
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Starting new HTTPS connection (1): accounts.coursera.org
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Logged in on coursera.org.
Starting new HTTPS connection (1): class.coursera.org
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Found authentication cookies.
Downloaded https://class.coursera.org/globalaffairsfinal-001/lecture/index (24771 bytes)
(...)

@rbrito
Copy link
Member

rbrito commented Apr 6, 2015

Hi.

On Apr 05 2015, Cxrille wrote:

Hi. I have a really hard time getting coursera-dl to work again and I'm running out of ideas.
I still get "urllib2.URLError: <urlopen error [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure>" when trying to get anything.

  • I upgraded to Linux Mint 17.1 Rebecca (Ubuntu 14.04 LTS)

No problems, but a better options would have been to use Debian testing
which will, on the 25th of this month, become Debian 8. :)

  • I built python 2.7.9 from source (python -V : Python 2.7.9)

Is this the accessible version of Python in your

  • I tried updating coursera-dl with pip : sudo -H pip install coursera-dl -U

Here we have a problem: the coursera-dl that you downloaded using Python is
not this project. It is the other project called coursera-dl. Furthermore,
you shouldn't have used pip with sudo.

In fact, it is almost always a bad idea to mess around with system-wide
installed packages, as they may break other packages that were installed
with your package installer (e.g., apt/dpkg).

In my particular case (but I know that I am an exception), I use
everything packaged from Debian unstable (which is the distribution to
which I contribute my own packages---funnily enough, I have not packaged
coursera-dl to Debian).

  • I tried cloning this repository but cannot get it to work : ./coursera-dl -> "ImportError: No module named requests" (and yes, everything is already up to date with "sudo -H pip install -r requirements.txt -U")

What do you get if you fire up a python interpreter and import requests,
like this:

$ python
Python 2.7.9 (default, Mar  1 2015, 12:57:24) 
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import requests
>>> 
  • I installed lot's of stuff from various posts (stackoverflow, ...)

Please, tell me what to do in order to resume downloading my 70+ courses !

OK, a quick and dirty way that won't fix the situation that you already have
is the following:

cd /tmp
virtualenv my-coursera
cd my-coursera
source bin/activate
git clone https://github.com/coursera-dl/coursera
cd coursera
pip install -r requirements.txt
./coursera-dl --help

This will create an environment that has no conflicts with your other
packages and that has only our needed packages and nothing else.

Please let me know if this fixes your immediate needs.

Hope this helps,

Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA
http:https://cynic.cc/blog/ : github.com/rbrito : profiles.google.com/rbrito
DebianQA: http:https://qa.debian.org/developer.php?login=rbrito%40ime.usp.br

@Cxrille
Copy link

Cxrille commented Apr 6, 2015

Well, debian sid was my first love 10-15 years ago !
The highest 2.7 version available from apt-get is 2.7.6. So I had to download 2.7.9 + configure;make;make install.

Without virtualenv :
Python 2.7.9 (default, Apr 5 2015, 14:46:34)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import requests
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named requests

With virtualenv (and git clone, pip install, ...):
./coursera-dl --help is OK
./coursera-dl -u *** -p *** somecourse-001 : Not OK (still same SSLError)
BUT
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import requests

Python 2.7.6 ??? I guess I messed something up.
At least, I know I should learn about virtualenv from now. I will try to get python 2.7.9 in my virtual python environment.

@rbrito
Copy link
Member

rbrito commented Apr 6, 2015

Hi.

On Apr 06 2015, Cxrille wrote:

Well, debian sid was my first love 10-15 years ago !
The highest 2.7 version available from apt-get is 2.7.6.

If you want to, just point your sources.list file to testing instead of
stable and you will be given python 2.7.9 (and lots of other goodies), as we
are nearing a release.

So I had to
download 2.7.9 + configure;make;make install.

This is likely to present you with some problems. You should uninstall it,
if possible.

Without virtualenv :
Python 2.7.9 (default, Apr 5 2015, 14:46:34)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import requests
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named requests

With virtualenv (and git clone, pip install, ...):
./coursera-dl --help is OK
./coursera-dl -u *** -p *** somecourse-001 : Not OK (still same SSLError)
BUT
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.

import requests

Python 2.7.6 ??? I guess I messed something up.

No, that's simply that the virtualenv picked up the Python 2.7.6
interpreter. You can fix it by telling virtualenv which interpreter you want
to use with the -p option.

But before you do that, can you please take a moment while you still have
Python 2.7.6 installed and let me know editing the file coursera/cookies.py
on line 352 and replace PROTOCOL_TLSv1 with PROTOCOL_SSLv23 makes things
work or not with Python 2.7.6?

This is similar to my change in

https://github.com/coursera-dl/coursera/commit/46320cfec9b5e9e42fe6c7b1ca602347e3ee4420

Hope all this helps,

Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA
http:https://cynic.cc/blog/ : github.com/rbrito : profiles.google.com/rbrito
DebianQA: http:https://qa.debian.org/developer.php?login=rbrito%40ime.usp.br

@Cxrille
Copy link

Cxrille commented Apr 6, 2015

virtualenv + python 2.7.6 + PROTOCOL_SSLv23 :

Downloading class: clinicalneurology-002
Starting new HTTPS connection (1): class.coursera.org
/home/cyrille/Tmp/coursera/my-coursera/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Starting new HTTPS connection (1): www.coursera.org
/home/cyrille/Tmp/coursera/my-coursera/local/lib/python2.7/site-packages/requests/packages/urllib3/util/ssl_.py:79: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Traceback (most recent call last):
  File "./coursera-dl", line 6, in <module>
    coursera_dl.main()
  File "/home/cyrille/Tmp/coursera/my-coursera/coursera/coursera/coursera_dl.py", line 932, in main
    result = download_class(args, class_name)
  File "/home/cyrille/Tmp/coursera/my-coursera/coursera/coursera/coursera_dl.py", line 828, in download_class
    username=args.username, password=args.password
  File "/home/cyrille/Tmp/coursera/my-coursera/coursera/coursera/cookies.py", line 339, in get_cookies_for_class
    get_authentication_cookies(session, class_name, username, password)
  File "/home/cyrille/Tmp/coursera/my-coursera/coursera/coursera/cookies.py", line 162, in get_authentication_cookies
    login(session, username, password, class_name=class_name)
  File "/home/cyrille/Tmp/coursera/my-coursera/coursera/coursera/cookies.py", line 117, in login
    headers=headers, allow_redirects=False)
  File "/home/cyrille/Tmp/coursera/my-coursera/local/lib/python2.7/site-packages/requests/sessions.py", line 507, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/home/cyrille/Tmp/coursera/my-coursera/local/lib/python2.7/site-packages/requests/sessions.py", line 464, in request
    resp = self.send(prep, **send_kwargs)
  File "/home/cyrille/Tmp/coursera/my-coursera/local/lib/python2.7/site-packages/requests/sessions.py", line 576, in send
    r = adapter.send(request, **kwargs)
  File "/home/cyrille/Tmp/coursera/my-coursera/local/lib/python2.7/site-packages/requests/adapters.py", line 431, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure

I tried to set a python 2.7.9 virtualenv with -p, but it failed (ImportError: cannot import name HTTPSHandler).

@rbrito
Copy link
Member

rbrito commented Apr 6, 2015

Hi.

On Apr 06 2015, Cxrille wrote:

I tried to set a python 2.7.9 virtualenv with -p, but it failed
(ImportError: cannot import name HTTPSHandler).

Please, install also the package urllib3 inside the virtual environment:

pip install urllib3

If that's not sufficient, then try to install the following packages:

pip install urllib3 pyasn1 ndg-httpsclient

The last one will install pyOpenSSL which will require some compilation.
Since you are using your own compiled python right now, you may already have
the dependencies, but if necessary, you can install the (Debian) packages
libffi-dev and libssl-dev so that the compilation succeeds.

Please, post back the results.

Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA
http:https://cynic.cc/blog/ : github.com/rbrito : profiles.google.com/rbrito
DebianQA: http:https://qa.debian.org/developer.php?login=rbrito%40ime.usp.br

@Cxrille
Copy link

Cxrille commented Apr 6, 2015

urlib3 is not sufficient.
I tried installing pyasn1 ndg-httpsclient but I miss libffi-dev and libssl-dev. When I tried apt-get these, I realized I broke my system when trying to remove python 2.7.9 this way : http:https://stackoverflow.com/questions/3544378/uninstall-python-built-from-source/3544440#3544440

So... I will reinstall Mint then come back later for python-pyasn1 and ndg-httpsclient. This time, no more sudo pip install either!

@Cxrille
Copy link

Cxrille commented Apr 6, 2015

It works with urllib3 + pyasn1 + ndg-httpsclient !
(And of course, to compile ndg-httpsclient, apt-get install python-dev libffi-dev libssl-dev)

Thank you !

@truth1ness
Copy link

Coursera-dl and python novice here and I'm getting a similar _ssl.c:507: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure> error on my mac running python 2.7.6. I don't understand a lot of this thread, do I need to 1) upgrade my python version or 2) wait on an update to coursera-dl or 3) do something else?

@Cxrille
Copy link

Cxrille commented Apr 7, 2015

You don't need to upgrade. From a fresh mint (ubuntu) install with python 2.7.6 :

apt-get install python-virtualenv python-dev libffi-dev libssl-dev build-essential
cd /tmp (or whatever)
virtualenv my-coursera
cd my-coursera
source bin/activate
git clone https://github.com/coursera-dl/coursera
cd coursera
pip install -r requirements.txt
pip install urllib3 pyasn1 ndg-httpsclient
./coursera-dl ...

(No need to edit cookies.py)

@rbrito
Copy link
Member

rbrito commented Apr 7, 2015

Hi, @Cxrille.

On Apr 07 2015, Cxrille wrote:

You don't need to upgrade. From a fresh mint (ubuntu) install :

So you are now able to use everything (after installing said packages) with
Python 2.7.6? If so, that's great.

I am going to push a change so that the extra packages are present in the
requirements file...

I guess that the most important one is pyOpenSSL, which, unfortunately, is
the one that requires compilation, and I guess that the amount of people
having a compiler and headers and stuff installed is pretty minimal,
especially among Windows users. :(

Perhaps for people using Debian/Ubuntu/Linux Mint, all the virtual env dance
is not necessary and, perhaps, it is just a simple matter of installing:

apt-get install python-bs4 python-requests python-html5lib python-urllib3 python-six \
        python-openssl python-ndg-httpsclient python-pyasn1 python-nose python-mock

Perhaps the crucial part is to have a recent enough python-urlllib3 which
has a declared dependency on python-openssl. This way, you don't have to
mess with the packages that I put in requirements.txt and just go ahead
and use the program.

I would accept a patch/pull request to the documentation (README.md) that is
friendly to novice users, if anybody wants to contribute that.

Regards,

Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA
http:https://cynic.cc/blog/ : github.com/rbrito : profiles.google.com/rbrito
DebianQA: http:https://qa.debian.org/developer.php?login=rbrito%40ime.usp.br

@marjinal1st
Copy link

Had same problem, @Cxrille's solution worked w/o problem 👍

@rbrito
Copy link
Member

rbrito commented Apr 14, 2015

@marjinal1st. Excellent. When the new versions of Ubuntu and Debian get released this month, the installation will be much simpler as a newer version of Python will be available.

@hegazy
Copy link

hegazy commented Apr 14, 2015

@Cxrille's solution worked without any problems on linux mint 17.1 with python 2.7.6

@Pavel-Y
Copy link

Pavel-Y commented Apr 21, 2015

Had the same issue. @Cxrille's solution worked like a charm. Thanks! Win7 Python 2.7.3

@zhaozhao
Copy link

There is another approach using python3.

  • install python3 if you have not.
  • just create virtualenv with python3 and do the same procedure as usual:
virtualenv -p python3 my-coursera
cd my-coursera
source bin/activate
git clone https://github.com/coursera-dl/coursera
cd coursera
pip install -r requirements.txt
./coursera-dl ...

This works for me.

@rihenperry
Copy link

yes!! I definitely got it working with @Cxrille solution for python version 2.7.6
On Ubuntu 14.04 LTS, 64-bit machine,
The very first step is to get setup these dependencies ->
1)sudo apt-get install python-virtualenv python-dev libffi-dev libssl-dev build-essential
2) setup virtualenv for git clonned cousera repository
virtualenv cousera
3)then lastly install dependencies listed in requirements.txt
pip install -r requirements.txt
4)These state makes coursera-dl work for on-demand/self-paced courses as well.Enjoy!!

@danmbox
Copy link

danmbox commented May 1, 2015

@Cxrille's instructions not working here (Ubuntu 14.04 64 bit, python 2.7.6). I'm getting the ResponseNotReady error referenced in #348 (even if I try --clear-cache, logging out, replacing AUTH_URL_V3, or installing in a virtualenv -p python3 env)

@rihbyne does it still work for you or is it broken now?

@rdinse
Copy link

rdinse commented May 11, 2015

@zhaozhao Awesome. Switching to Python 3 solved it for me as well.

@rbrito
Copy link
Member

rbrito commented May 15, 2015

@danmbox,

Can you (possibly manually) revert the changes at 46320cf and 0ad0f4c in your local copy to see if they help you with this issue?

Do you have ndg-httpsclient and pyOpenSSL installed also?

Thanks.

@rbrito
Copy link
Member

rbrito commented Jun 3, 2015

Hi, Andrea.

On Jun 01 2015, Andrea Pravato wrote:

In my machine (Ubuntu 14.04) the problem was solved by using Python 3, as
suggested.

Excellent. I am really leaning towards recommending that people move on to
Python 3 (3.4 works very well and is the latest stable version).

I did it like this:

  1. sudo pip uninstall coursera-dl
  2. sudo apt-get install python3-pip
  3. sudo python3 -m pip install coursera-dl

Ooops. The coursera-dl that you get with pip is a different project than
ours. Ours is simply called coursera to be used with pip. See the note 1 on
this section:

https://github.com/coursera-dl/coursera#recommended-installation-method-for-all-operating-systems

Anyway, for Debian-derived distributions, things may be much easier once the
program gets packaged.

Regards,

Rogério Brito : rbrito@{ime.usp.br,gmail.com} : GPG key 4096R/BCFCAAAA
http:https://cynic.cc/blog/ : github.com/rbrito : profiles.google.com/rbrito
DebianQA: http:https://qa.debian.org/developer.php?login=rbrito%40ime.usp.br

@cheiff
Copy link

cheiff commented Jul 27, 2015

@zhaozhao's solution (python3) worked for me, too. I was unable to make it work with 2.7.6 in Ubuntu 14.04.
Thank you!

@rbrito
Copy link
Member

rbrito commented Aug 15, 2015

Hi there.

Is anybody else experiencing this bug? If not, then I'd like to close this bug. Otherwise, I would like to:

All this with an eye to close this bug and concentrate discussion on issue #377, to make things simpler.

I appreciate any help that I can have here, so that we build something that works for as many users as possible (and this includes us).

Thanks,

Rogério.

@foxel
Copy link

foxel commented Sep 24, 2015

Python 2.7.6 @ Ubuntu 14.04

Starting new HTTPS connection (1): class.coursera.org
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Starting new HTTPS connection (1): www.coursera.org
/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. For more information, see https://urllib3.readthedocs.org/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
Traceback (most recent call last):
  File "/usr/local/bin/coursera-dl", line 9, in 
    load_entry_point('coursera==0.0.3', 'console_scripts', 'coursera-dl')()
  File "/usr/local/lib/python2.7/dist-packages/coursera/coursera_dl.py", line 944, in main
    result = download_class(args, class_name)
  File "/usr/local/lib/python2.7/dist-packages/coursera/coursera_dl.py", line 842, in download_class
    username=args.username, password=args.password)
  File "/usr/local/lib/python2.7/dist-packages/coursera/cookies.py", line 337, in get_cookies_for_class
    get_authentication_cookies(session, class_name, username, password)
  File "/usr/local/lib/python2.7/dist-packages/coursera/cookies.py", line 160, in get_authentication_cookies
    login(session, username, password, class_name=class_name)
  File "/usr/local/lib/python2.7/dist-packages/coursera/cookies.py", line 115, in login
    headers=headers, allow_redirects=False)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 508, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 465, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 573, in send
    r = adapter.send(request, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/requests/adapters.py", line 431, in send
    raise SSLError(e, request=request)
requests.exceptions.SSLError: [Errno 1] _ssl.c:510: error:14094410:SSL routines:SSL3_READ_BYTES:sslv3 alert handshake failure

@balta2ar balta2ar changed the title sslv3 alert handshake failure on Debian System [ssl-issues] sslv3 alert handshake failure on Debian System Jun 12, 2016
@hendarmawan
Copy link

virtualenv -p python3 my-coursera

it works

@alfonso73
Copy link

alfonso73 commented Jan 7, 2019

Hi, has anyone an idea on how to solve the issue on Windows 10 64bit?

thanks!
#####################################################################

ATTENTION! PLEASE READ THIS!

The following error has just occurred:

SSLError HTTPSConnectionPool(host='www.coursera.org', port=443): Max retries exceeded with url: /api/login/v3 (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'ssl3_read_bytes', 'sslv3 alert handshake failure')],)",),))

Please read instructions on how to fix this error here:

https://github.com/coursera-dl/coursera-dl#sslerror-errno-1-_sslc504-error14094410ssl-routinesssl3_read_bytessslv3-alert-handshake-failure

#####################################################################

@madmax2
Copy link

madmax2 commented Feb 4, 2020

@rbrito
what is the the solution to this for windows 10 running python?
the solution posted is for linux

sudo apt-get install build-essential python-dev libssl-dev libffi-dev
pip install --user urllib3 pyasn1 ndg-httpsclient pyOpenSSL

@rbrito
Copy link
Member

rbrito commented Feb 4, 2020

Sorry. I have no idea, as I don't have any Windows machine.

I would suggest that you install a recent version of Python (e.g., Python 3.8), since it quite probably has all the "modern" pieces in place.

Also, if you don't need Python 2 for any other project, I recommend that you get rid of Python 2, as it won't have any kind of support (including security, crypto algorithms and protocols etc.).

@coursera-dl coursera-dl locked as resolved and limited conversation to collaborators Feb 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests