The typical Jupyter installation includes more than 125 packages. If any one of these packages has been compromised, any account running Jupyter could become compromised. Keep in mind that even if the initial installation does not include any compromised packages, you might need to install additional packages—which could have been compromised. Or, you might run a Jupyter "notebook," obtained from an internet repository, that contains hidden malware; a Jupyter notebook has exactly the same access to files and other system resources as the user who started the notebook server. While we do not know of any active exploits against Jupyter at this time, this is a serious risk.
WARNING: We recommend you do not use Jupyter, or similar software, if your account has access to any ITAR, proprietary, or non-public data or programs.
Steps for Securely Setting Up Jupyter Notebook
Before you use Jupyter Notebook on NAS systems, you must complete these steps.
Notes:
You only need to do these steps once (the first time you use Jupyter).
Some of the command lines are too long to be formatted as one line, so they are broken with a backslash (\).
Before You Begin: Make sure you have set up SSH passthrough.
Log into a PFE and load the miniconda3 module from the /swbuild/analytix directory:
pfe20% module use -a /swbuild/analytix/tools/modulefiles
pfe20% module load miniconda3/v4
To access Jupyter commands, activate a conda environment with Jupyter installed. All provided environments other than the base environment will work. For a list of other environments you can use, see Machine Learning: Overview. We suggest using the latest tensorflow or pytorch environment. In this example, we use the jupyterlab environment:
Set a password for your Jupyter notebooks, using both the jupyter notebook and the jupyter server commands:
(jupyterlab)% jupyter notebook password
(jupyterlab)% jupyter server password
Two JSON password files will be written to your $HOME/.jupyter directory. Both commands are needed to ensure that the secure setup is compatible with older environments. In the future, Jupyter will move to using only jupyter server commands, so using both commands will also help guarantee future compatibility. The password used for both commands should be the same to reduce troubleshooting steps, but make sure the password follows the same security standards as other NAS passwords..
Note: The default "token" authentication is not as secure as a password if you plan to share the notebook with others.
Make the Jupyter configuration information visible only to you:
(jupyterlab)% chmod 700 $HOME/.jupyter
Protect Jupyter from request forgery by creating a self-signed certificate for your Jupyter HTTPS server:
Copy the default NAS configuration files to your private configuration directory. These configuration files allow you to connect to the Jupyter server from your local web browser. The following command line copies two different configuration files (jupyter_server_config.py and jupyter_notebook_config.py) to your .jupyter directory:
IMPORTANT: You must run Jupyter on a node dedicated to you alone. You can do this either by running an interactive PBS session (for CPU or GPU jobs) or by reserving a dedicated compute node (for CPU jobs only). Running Jupyter on any other system, including an secure front end (SFE), Lou front end (LFE), or a non-dedicated front-end system, is prohibited.