Joshua Howard
Joshua Howard

Reputation: 916

Cannot obtain a trusted connection when hosting Jupyter Notebook on AWS EC2 instance

I am wanting to host Jupyter notebooks on my AWS instance and I am following this tutorial. On step 2, I am configuring an SSL certificate as follows

sudo openssl req -x509 -nodes -days 365 -newkey rsa:1024 -keyout "cert.key" -out "cert.pem" -batch

I am able to access the notebook successfully, but I get a warning that my connection is not secure

enter image description here

On the backend, the Jupyter notebook logs the following warning

[W 19:53:29.080 NotebookApp] SSL Error on 10 ('127.0.0.1', 43680): [SSL: TLSV1_ALERT_UNKNOWN_CA] tlsv1 alert unknown ca (_ssl.c:777)

Any ideas on what would be wrong with the SSL certificate?

EDIT

The reason that I am accessing the localhost is that I am launching the application as follows

ssh -L 8157:127.0.0.1:8888 <username>@<instance> jupyter notebook

The SSL cert is stored on the EC2 instance and the Jupyter notebook config can locate the certificate (Jupyter complains if it cannot find the certificate locally).

Upvotes: 3

Views: 1651

Answers (1)

kichik
kichik

Reputation: 34704

You're using a self-signed certificate. Those are not trusted by the browser. If you want a proper certificate, you should assign a domain to that IP and then get a certificate for that domain with Let's Encrypt.

But if you want to hide your service behind SSH, there is really no point in adding HTTPS on top of it. All your communication is already encrypted with SSH. You're not gaining much by using HTTPS here.

Upvotes: 2

Related Questions