From b7549eb08d1e8b68b6525b3f26d323f3115a3481 Mon Sep 17 00:00:00 2001 From: dafeliton Date: Thu, 18 Jul 2024 23:28:48 -0700 Subject: [PATCH] remove iframe config fix --- images/datascience-notebook/Dockerfile | 2 - .../scripts/jupyter_server_config.py | 61 ------------------- 2 files changed, 63 deletions(-) delete mode 100644 images/datascience-notebook/scripts/jupyter_server_config.py diff --git a/images/datascience-notebook/Dockerfile b/images/datascience-notebook/Dockerfile index eeb5d55f..3c452a0c 100644 --- a/images/datascience-notebook/Dockerfile +++ b/images/datascience-notebook/Dockerfile @@ -43,10 +43,8 @@ COPY /scripts/jupyter_notebook_config.py /tmp/jupyter_notebook_config_extra.py COPY /scripts/jupyter_server_config.py /tmp/jupyter_server_config_extra.py COPY /scripts/nbgrader_config.py /etc/jupyter/nbgrader_config.py RUN cat /tmp/jupyter_notebook_config_extra.py >> /etc/jupyter/jupyter_notebook_config.py && \ -cat /tmp/jupyter_server_config_extra.py >> /etc/jupyter/jupyter_server_config.py && \ chmod -R uga+x /usr/share/datahub/scripts/ && \ chmod -R uga+x /etc/jupyter/jupyter_notebook_config.py && \ - chmod -R uga+x /etc/jupyter/jupyter_server_config.py && \ chmod -R uga+x /etc/jupyter/nbgrader_config.py # Copy over R tests to /opt/manual_tests diff --git a/images/datascience-notebook/scripts/jupyter_server_config.py b/images/datascience-notebook/scripts/jupyter_server_config.py deleted file mode 100644 index bda99141..00000000 --- a/images/datascience-notebook/scripts/jupyter_server_config.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (c) Jupyter Development Team. -# Distributed under the terms of the Modified BSD License. -# mypy: ignore-errors -import os -import stat -import subprocess -from pathlib import Path - -from jupyter_core.paths import jupyter_data_dir - -c = get_config() # noqa: F821 -c.ServerApp.ip = "0.0.0.0" -c.ServerApp.open_browser = False - -# Fix iframes (formgrader) as of jhub 4.1.0 -c.ServerApp.tornado_settings = {'headers': {'Content-Security-Policy': "frame-ancestors *;"}} - -# to output both image/svg+xml and application/pdf plot formats in the notebook file -c.InlineBackend.figure_formats = {"png", "jpeg", "svg", "pdf"} - -# https://github.com/jupyter/notebook/issues/3130 -c.FileContentsManager.delete_to_trash = False - -# Generate a self-signed certificate -OPENSSL_CONFIG = """\ -[req] -distinguished_name = req_distinguished_name -[req_distinguished_name] -""" -if "GEN_CERT" in os.environ: - dir_name = Path(jupyter_data_dir()) - dir_name.mkdir(parents=True, exist_ok=True) - pem_file = dir_name / "notebook.pem" - - # Generate an openssl.cnf file to set the distinguished name - cnf_file = Path(os.getenv("CONDA_DIR", "/usr/lib")) / "ssl/openssl.cnf" - if not cnf_file.exists(): - cnf_file.write_text(OPENSSL_CONFIG) - - # Generate a certificate if one doesn't exist on a disk - subprocess.check_call( - [ - "openssl", - "req", - "-new", - "-newkey=rsa:2048", - "-days=365", - "-nodes", - "-x509", - "-subj=/C=XX/ST=XX/L=XX/O=generated/CN=generated", - f"-keyout={pem_file}", - f"-out={pem_file}", - ] - ) - # Restrict access to the file - pem_file.chmod(stat.S_IRUSR | stat.S_IWUSR) - c.ServerApp.certfile = str(pem_file) - -# Change default umask for all subprocesses of the Server if set in the environment -if "NB_UMASK" in os.environ: - os.umask(int(os.environ["NB_UMASK"], 8)) \ No newline at end of file