EC2上的Jupyter:SSL错误 [英] Jupyter on EC2: SSL Error

查看:238
本文介绍了EC2上的Jupyter:SSL错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从EC2提供Jupyter笔记本电脑,但出现SSL错误. 我正在使用此AMI:TensorFlow GPU - @nottombrown (ami-8ed4d0e4).我使用了自签名证书,这可能是问题的一部分.

I'm trying to serve a Jupyter notebook from EC2 but I'm getting an SSL error. I'm using this AMI: TensorFlow GPU - @nottombrown (ami-8ed4d0e4). I used a self-signed certificate and that might be part of the problem.

我查看了其他类似错误的SO帖子,例如

I've looked at several other SO posts that have a similar error such as this, this and this, but they're getting the error in a quite different context and I can't figure out how to get the solutions (such as setting verify=False) to work for me.

[E 15:52:44.954 NotebookApp] Exception in callback (<socket._socketobject object at 0x7f5f993dad00>, <function null_wrapper at 0x7f5f99319758>)
    Traceback (most recent call last):
      File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 883, in start
        handler_func(fd_obj, events)
      File "/usr/local/lib/python2.7/dist-packages/tornado/stack_context.py", line 275, in null_wrapper
        return fn(*args, **kwargs)
      File "/usr/local/lib/python2.7/dist-packages/tornado/netutil.py", line 274, in accept_handler
        callback(connection, address)
      File "/usr/local/lib/python2.7/dist-packages/tornado/tcpserver.py", line 239, in _handle_connection
        do_handshake_on_connect=False)
      File "/usr/local/lib/python2.7/dist-packages/tornado/netutil.py", line 521, in ssl_wrap_socket
        return ssl.wrap_socket(socket, **dict(context, **kwargs))
      File "/usr/lib/python2.7/ssl.py", line 487, in wrap_socket
        ciphers=ciphers)
      File "/usr/lib/python2.7/ssl.py", line 241, in __init__
        ciphers)
    SSLError: [Errno 336265225] _ssl.c:355: error:140B0009:SSL routines:SSL_CTX_use_PrivateKey_file:PEM lib

推荐答案

此错误表示找不到SSL证书.

如果尚未创建SSL证书:

通过在命令行中键入以下内容(从您的主目录开始)来创建一个:

Create one by typing the following into the command line (starting at your home directory):

$ mkdir certs
$ cd certs
$ sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout mycert.pem -out mycert.pem

(摘自这些说明 )

现在您已经有了SSL证书:

您需要告诉Jupyter在哪里找到它.

You need to tell Jupyter where to find it.

看看是否有jupyter_notebook_config.py(或使用jupyter notebook --generate-config生成).

Take a look at jupyter_notebook_config.py if you have one (or generate one using jupyter notebook --generate-config).

确保您具有以下行:

c.NotebookApp.certfile = u'/home/ubuntu/certs/mycert.pem' #location of your certificate file

(请参见 Jupyter Notebook文档)

,并确保您的自签名SSL证书实际上位于该位置.一个常见的错误是例如将certs.certs混合在一起.这样的错误将导致Jupyter无法找到您的SSL证书,并会导致您得到错误.

and make sure that your self-signed SSL certificate is actually at that location. A common mistake is to mix up certs with .certs for example. A mistake like this will result in Jupyter not being able to find your SSL certificate and that'll result in the error that you're getting.

这篇关于EC2上的Jupyter:SSL错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆