Notebook: Error when trying to use certificate: SSLError: [SSL] PEM lib (_ssl.c:2599)

Created on 29 Sep 2015  ·  38Comments  ·  Source: jupyter/notebook

Hello, following the docs I was trying to create a public IPy server.

However, after creating certificate with
sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.key -out mycert.pem
and running
jupyter notebook --certfile=mycert.pem

The notebook doesn't start and I can't find any information about how to fix it.

The error message is:

[E 14:08:49.825 NotebookApp] Exception in callback (<socket._socketobject object at 0x7f021f33e980>, <function null_wrapper at 0x7f021f2cdf50>)
    Traceback (most recent call last):
      File "/home/marcin/anaconda/lib/python2.7/site-packages/tornado/ioloop.py", line 866, in start
        handler_func(fd_obj, events)
      File "/home/marcin/anaconda/lib/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/home/marcin/anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 265, in accept_handler
        callback(connection, address)
      File "/home/marcin/anaconda/lib/python2.7/site-packages/tornado/tcpserver.py", line 239, in _handle_connection
        do_handshake_on_connect=False)
      File "/home/marcin/anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 501, in ssl_wrap_socket
        context = ssl_options_to_context(ssl_options)
      File "/home/marcin/anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 478, in ssl_options_to_context
        context.load_cert_chain(ssl_options['certfile'], ssl_options.get('keyfile', None))
    SSLError: [SSL] PEM lib (_ssl.c:2599)
[E 14:08:49.827 NotebookApp] Exception in callback (<socket._socketobject object at 0x7f021f33e980>, <function null_wrapper at 0x7f021f2cdf50>)
    Traceback (most recent call last):
      File "/home/marcin/anaconda/lib/python2.7/site-packages/tornado/ioloop.py", line 866, in start
        handler_func(fd_obj, events)
      File "/home/marcin/anaconda/lib/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/home/marcin/anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 265, in accept_handler
        callback(connection, address)
      File "/home/marcin/anaconda/lib/python2.7/site-packages/tornado/tcpserver.py", line 239, in _handle_connection
        do_handshake_on_connect=False)
      File "/home/marcin/anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 501, in ssl_wrap_socket
        context = ssl_options_to_context(ssl_options)
      File "/home/marcin/anaconda/lib/python2.7/site-packages/tornado/netutil.py", line 478, in ssl_options_to_context
        context.load_cert_chain(ssl_options['certfile'], ssl_options.get('keyfile', None))
    SSLError: [SSL] PEM lib (_ssl.c:2599)

Edit I'm running Jupyter 4.0.6, tornado 4.2.1 on Ubuntu 14.04
Thanks in advance.

Needs Info Documentation

Most helpful comment

@cavaunpeu using https instead of http may solve it

All 38 comments

Is this issue resolved? I get same error when starting jupyter notebook on a public hosting server, dreamhost. Please share if there is a solution/workaround.

(venv)[ps472256]$ pip list
backports.ssl-match-hostname (3.4.0.2)
bokeh (0.10.0)
certifi (2015.9.6.2)
chardet (2.3.0)
colorama (0.3.3)
Cython (0.23.2)
decorator (4.0.4)
diff-match-patch (20121119)
distribute (0.7.3)
Django (1.8.4)
django-bootstrap3 (6.2.2)
django-bower (5.0.4)
django-csvimport (2.4)
django-import-export (0.2.8)
django-nvd3 (0.8.2)
django-registration-redux (1.2)
djangorestframework (3.2.3)
Flask (0.10.1)
functools32 (3.2.3.post2)
greenlet (0.4.9)
ipykernel (4.0.3)
ipython (4.0.0)
ipython-genutils (0.1.0)
ipywidgets (4.0.3)
itsdangerous (0.24)
Jinja2 (2.8)
jsonschema (2.5.1)
jupyter (1.0.0)
jupyter-client (4.0.0)
jupyter-console (4.0.2)
jupyter-core (4.0.6)
Markdown (2.6.2)
MarkupSafe (0.23)
matplotlib (1.4.3)
mistune (0.7.1)
mock (1.3.0)
MySQL-python (1.2.5)
nbconvert (4.0.0)
nbformat (4.0.0)
nose (1.3.7)
notebook (4.0.5)
numpy (1.9.3)
pandas (0.16.2)
path.py (8.1.1)
patsy (0.4.0)
pbr (1.8.0)
pexpect (3.3)
pickleshare (0.5)
pip (7.1.2)
ptyprocess (0.5)
Pygments (2.0.2)
pyparsing (2.0.3)
pystache (0.5.4)
python-dateutil (2.4.2)
python-nvd3 (0.13.7)
python-slugify (0.0.9)
pytz (2015.6)
PyYAML (3.11)
pyzmq (14.7.0)
qtconsole (4.0.1)
requests (2.7.0)
rest-pandas (0.3.2)
scipy (0.16.0)
setuptools (18.3.2)
simplegeneric (0.8.1)
six (1.9.0)
statsmodels (0.6.1)
tablib (0.10.0)
terminado (0.5)
tornado (4.2.1)
traitlets (4.0.0)
Unidecode (0.4.18)
Werkzeug (0.10.4)
Thanks

It worked for me after making a slight change in the openssl parameters. i am saving both the key and certificate in the same file, 'mycert.pem'.

original:
$sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.key -out mycert.pem
my version:
$sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.pem -out mycert.pem

I'm getting the same error as well trying to start a notebook server on a Ubuntu 14.04 instance on Digital Ocean. Unfortunately, guy1nj's workaround doesn't work for me, although it changes the error from SSLError: [SSL] PEM lib to ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number

@stahlous If possible, would you mind sharing the traceback here from the error message? It would be helpful to isolate if it is the same tornado source file that is causing the error. Thanks.

@minrk Failing above at https://github.com/tornadoweb/tornado/blob/master/tornado/netutil.py#L468. Looks like this issue on the tornado site is related: https://github.com/tornadoweb/tornado/issues/1534 and may have a workaround for @stahlous

Here's the traceback from making one request to the server.

$ jupyter notebook
[I 13:06:32.165 NotebookApp] Writing notebook server cookie secret to /run/user/1000/jupyter/notebook_cookie_secret
[I 13:06:32.240 NotebookApp] Serving notebooks from local directory: /home/<home_directory>
[I 13:06:32.241 NotebookApp] 0 active kernels
[I 13:06:32.241 NotebookApp] The IPython Notebook is running at: https://[all ip addresses on your system]:8888/
[I 13:06:32.241 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[W 13:06:41.161 NotebookApp] SSL Error on 10 ('199.116.169.254', 42894): [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:600)
[E 13:06:41.162 NotebookApp] Uncaught exception
    Traceback (most recent call last):
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/http1connection.py", line 693, in _server_request_loop
        ret = yield conn.read_response(request_delegate)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 870, in run
        value = future.result()
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/concurrent.py", line 215, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 876, in run
        yielded = self.gen.throw(*exc_info)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/http1connection.py", line 168, in _read_message
        quiet_exceptions=iostream.StreamClosedError)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 870, in run
        value = future.result()
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/concurrent.py", line 215, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/iostream.py", line 1243, in _do_ssl_handshake
        self.socket.do_handshake()
      File "/home/<home_directory>/anaconda3/lib/python3.4/ssl.py", line 810, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:600)
[W 13:06:41.237 NotebookApp] SSL Error on 10 ('134.134.139.77', 49400): [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:600)
[E 13:06:41.238 NotebookApp] Uncaught exception
    Traceback (most recent call last):
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/http1connection.py", line 693, in _server_request_loop
        ret = yield conn.read_response(request_delegate)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 870, in run
        value = future.result()
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/concurrent.py", line 215, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 876, in run
        yielded = self.gen.throw(*exc_info)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/http1connection.py", line 168, in _read_message
        quiet_exceptions=iostream.StreamClosedError)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 870, in run
        value = future.result()
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/concurrent.py", line 215, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/iostream.py", line 1243, in _do_ssl_handshake
        self.socket.do_handshake()
      File "/home/<home_directory>/anaconda3/lib/python3.4/ssl.py", line 810, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:600)
[W 13:06:41.285 NotebookApp] SSL Error on 10 ('134.134.139.77', 62970): [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:600)
[E 13:06:41.286 NotebookApp] Uncaught exception
    Traceback (most recent call last):
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/http1connection.py", line 693, in _server_request_loop
        ret = yield conn.read_response(request_delegate)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 870, in run
        value = future.result()
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/concurrent.py", line 215, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 876, in run
        yielded = self.gen.throw(*exc_info)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/http1connection.py", line 168, in _read_message
        quiet_exceptions=iostream.StreamClosedError)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 870, in run
        value = future.result()
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/concurrent.py", line 215, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/iostream.py", line 1243, in _do_ssl_handshake
        self.socket.do_handshake()
      File "/home/<home_directory>/anaconda3/lib/python3.4/ssl.py", line 810, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:600)
[W 13:06:41.815 NotebookApp] SSL Error on 10 ('134.134.139.72', 54779): [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:600)
[E 13:06:41.815 NotebookApp] Uncaught exception
    Traceback (most recent call last):
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/http1connection.py", line 693, in _server_request_loop
        ret = yield conn.read_response(request_delegate)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 870, in run
        value = future.result()
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/concurrent.py", line 215, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 876, in run
        yielded = self.gen.throw(*exc_info)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/http1connection.py", line 168, in _read_message
        quiet_exceptions=iostream.StreamClosedError)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 870, in run
        value = future.result()
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/concurrent.py", line 215, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/iostream.py", line 1243, in _do_ssl_handshake
        self.socket.do_handshake()
      File "/home/<home_directory>/anaconda3/lib/python3.4/ssl.py", line 810, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:600)
[W 13:06:41.863 NotebookApp] SSL Error on 10 ('134.134.139.72', 58004): [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:600)
[E 13:06:41.863 NotebookApp] Uncaught exception
    Traceback (most recent call last):
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/http1connection.py", line 693, in _server_request_loop
        ret = yield conn.read_response(request_delegate)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 870, in run
        value = future.result()
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/concurrent.py", line 215, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 876, in run
        yielded = self.gen.throw(*exc_info)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/http1connection.py", line 168, in _read_message
        quiet_exceptions=iostream.StreamClosedError)
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/gen.py", line 870, in run
        value = future.result()
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/concurrent.py", line 215, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 3, in raise_exc_info
      File "/home/<home_directory>/anaconda3/lib/python3.4/site-packages/tornado/iostream.py", line 1243, in _do_ssl_handshake
        self.socket.do_handshake()
      File "/home/<home_directory>/anaconda3/lib/python3.4/ssl.py", line 810, in do_handshake
        self._sslobj.do_handshake()
    ssl.SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:600)

I don't know why but @guy1nj trick works for me !

$ conda info
Current conda install:

             platform : linux-64
        conda version : 3.18.2
  conda-build version : 1.18.0
       python version : 3.4.3.final.0
     requests version : 2.8.0

@hadim Thanks for sharing.

Encountering this same issue. Logs:

[E 23:29:52.181 NotebookApp] Uncaught exception
Traceback (most recent call last):
  File "/usr/bin/anaconda/lib/python2.7/site-packages/tornado/http1connection.py", line 693, in _server_request_loop
    ret = yield conn.read_response(request_delegate)
  File "/usr/bin/anaconda/lib/python2.7/site-packages/tornado/gen.py", line 870, in run
    value = future.result()
  File "/usr/bin/anaconda/lib/python2.7/site-packages/tornado/concurrent.py", line 215, in result
    raise_exc_info(self._exc_info)
  File "/usr/bin/anaconda/lib/python2.7/site-packages/tornado/gen.py", line 876, in run
    yielded = self.gen.throw(*exc_info)
  File "/usr/bin/anaconda/lib/python2.7/site-packages/tornado/http1connection.py", line 168, in _read_message
    quiet_exceptions=iostream.StreamClosedError)
  File "/usr/bin/anaconda/lib/python2.7/site-packages/tornado/gen.py", line 870, in run
    value = future.result()
  File "/usr/bin/anaconda/lib/python2.7/site-packages/tornado/concurrent.py", line 215, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
SSLError: [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:590)

Generating cert with:
openssl req -x509 -nodes -days 1000 -newkey rsa:2048 -keyout mycert.pem -out mycert.pem

Same issue here, I was following all the instruction exactly on
http://jupyter-notebook.readthedocs.org/en/latest/public_server.html
The issue is solved with the trick @guy1nj provided
Thanks!

Thanks all for sharing what is working in your environments. It helps others that may have similar environments.

To assist and better cover different deployment environments, we'll be adding references to the OpenSSL documentation (https://www.openssl.org/ and https://www.openssl.org/docs/) as well as OpenSSL Cookbook (https://www.feistyduck.com/books/openssl-cookbook/) to the Jupyter documentation. These resources should assist folks find the certificate creation parameters that work best in their environment.

@ellisonbg @Carreau @minrk

Can't get this to work. Getting [SSL: WRONG_VERSION_NUMBER] wrong version number (_ssl.c:600) like most.

@cavaunpeu using https instead of http may solve it

@vinc30 in what sense? where would I make this change? I'm trying to set up a remote notebook on a server that doesn't allow (to my knowledge) incoming http requests. so, trying access the port via ssh instead.

Reporting that @guy1nj trick worked like a charm. Thanks

Fixed by #507. The openssl call and jupyter call had fallen out of sync, so there was a missing --keyfile mycert.key arg.

Had this issue, fixed using https instead of http as suggested by @cavaunpeu

@djakubosky Thanks - this helped me

For me, using https explicitly in the URL solved the problem.

is there a way to have the server automagically redirect http:// to https://

@dansteingart it's possible if http is on port 80 and https is on 443. Tornado doesn't allow redirecting an http request _already on the correct port_ to https.

I have this error when launch ipython notebook in ubuntu, i tried the command above, it doesnt work

Traceback (most recent call last):
File "/usr/local/bin/jupyter-notebook", line 7, in
from notebook.notebookapp import main
File "/usr/local/lib/python2.7/dist-packages/notebook/notebookapp.py", line 61, in
from .services.contents.manager import ContentsManager
File "/usr/local/lib/python2.7/dist-packages/notebook/services/contents/manager.py", line 16, in
from nbformat import sign, validate, ValidationError
File "/usr/local/lib/python2.7/dist-packages/nbformat/init.py", line 33, in
from .validator import validate, ValidationError
File "/usr/local/lib/python2.7/dist-packages/nbformat/validator.py", line 10, in
from jsonschema import ValidationError
File "/usr/local/lib/python2.7/dist-packages/jsonschema/init.py", line 18, in
from jsonschema.validators import (
File "/usr/local/lib/python2.7/dist-packages/jsonschema/validators.py", line 8, in
import requests
File "/usr/local/lib/python2.7/dist-packages/requests/init.py", line 53, in
from .packages.urllib3.contrib import pyopenssl
File "/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 70, in
ssl.PROTOCOL_SSLv3: OpenSSL.SSL.SSLv3_METHOD,
AttributeError: 'module' object has no attribute 'PROTOCOL_SSLv3'

anyone can help ?

Make sure your port is 443 when enabling ssl. That was all I had to change. https://example.com just worked after changing port.

How do I get the IDLCR pem module? Port : 443

what is guy1nj's trick?

It looks like there are several causes of the SSL: WRONG_VERSION_NUMBER error. In my case I'm running jupyterhub on SUSE and get the error when a user has logged in and tries to start a jupyter server. The browser url specifies https, not http, so that is not the problem, And I'm using Chrome, not Safari. I am, however, using a self-signed certificate.

So I want to second xerxes01's question: what is guy1nj's trick?

It does not seem to be listed here: what are we missing?

I'm having the same problem! Where are you, guy1nj? We need you!

Ok, I solved my problem by changing http to https, as minrk suggested in the other thread.

https instead of http , it works.

Thanks, djakubosky

adding "https" works for me, don't ask why.

SOLUTION 👍
adding "https" works for me, don't ask why.

will someone tell me who is the guy @guy1nj and what is his trick?
I need to solve the issue, I have been trying to find his trick for last 10 minutes

Try the following,
original,
$sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.key -out mycert.pem
my version:
$sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.pem -out mycert.pem

Replace http:// with https://

I was running Jupyter on port 8888 and connecting via HTTPS (e.g. https://jupyter.example.com:8888).

When I configured Jupyter to run on port 443, everything worked as expected (e.g. https://jupyter.example.com).

Encountered the same error. None of the provided solutions works....

I am getting the same error when I attempt to access ipynb on aws:

[W 17:39:41.940 NotebookApp] SSL Error on 10 ('136.59.193.37', 55105): [SSL: HTTP_REQUEST] http request (_ssl.c:726)
[E 17:39:57.434 NotebookApp] Uncaught exception, closing connection.
Traceback (most recent call last):
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/tornado/iostream.py", line 709, in _handle_events
self._handle_read()
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/tornado/iostream.py", line 1581, in _handle_read
self._do_ssl_handshake()
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/tornado/iostream.py", line 1501, in _do_ssl_handshake
self.socket.do_handshake()
File "/home/ubuntu/anaconda2/lib/python2.7/ssl.py", line 846, in do_handshake
self._sslobj.do_handshake()
error: [Errno 0] Error
[E 17:39:57.436 NotebookApp] Exception in callback None
Traceback (most recent call last):
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/tornado/ioloop.py", line 1073, in start
handler_func(fd_obj, events)
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/tornado/stack_context.py", line 300, in null_wrapper
return fn(args, *kwargs)
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/tornado/iostream.py", line 709, in _handle_events
self._handle_read()
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/tornado/iostream.py", line 1581, in _handle_read
self._do_ssl_handshake()
File "/home/ubuntu/anaconda2/lib/python2.7/site-packages/tornado/iostream.py", line 1501, in _do_ssl_handshake
self.socket.do_handshake()
File "/home/ubuntu/anaconda2/lib/python2.7/ssl.py", line 846, in do_handshake
self._sslobj.do_handshake()
error: [Errno 0] Error

It worked for me after making a slight change in the openssl parameters. i am saving both the key and certificate in the same file, 'mycert.pem'.

original:
$sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.key -out mycert.pem
my version:
$sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout mycert.pem -out mycert.pem

solved my problem: https://fenghe.us/ssl-sslerror-ssl-pem-lib-_ssl-c3824-python-websockets-ssl/

@ghost it works for me, thank you.

Was this page helpful?
0 / 5 - 0 ratings