diff --git a/hosts/heather/caddy.nix b/hosts/heather/caddy.nix index 259f8f7..28104de 100644 --- a/hosts/heather/caddy.nix +++ b/hosts/heather/caddy.nix @@ -113,13 +113,9 @@ Allow: /" 200 reverse_proxy 127.0.0.1:6767 ''; - # JupyterLab (ботать аналитику с iPad). Два слоя защиты: - # Caddy basicauth (пароль в pass iscg.dev/jupyter/basicauth) - # + Jupyter token внутри. Лимиты памяти/CPU в jupyter.nix. + # JupyterLab: native login form (пароль хранится как bcrypt-хеш + # в /var/lib/jupyter-secrets/jupyter.env), наружу только HTTPS. "jupyter.iscg.dev".extraConfig = '' - basicauth { - mikl $2a$14$u4jCpuLFeymewgx1uuGRs.6.L1JYf7vMtgwhU/Wvw5iuXJflynvSu - } reverse_proxy 127.0.0.1:8890 ''; diff --git a/hosts/heather/jupyter.nix b/hosts/heather/jupyter.nix index 46d8cae..4171ea1 100644 --- a/hosts/heather/jupyter.nix +++ b/hosts/heather/jupyter.nix @@ -5,8 +5,8 @@ # установка не в nix store — пакеты летят из PyPI, пинить нечего. # # Безопасность: слушает только 127.0.0.1:8890, наружу через Caddy -# (jupyter.iscg.dev). Caddy basicauth (см. caddy.nix jupyterBasicAuth) + -# Jupyter token (пасс iscg.dev/jupyter/token, env-файл jupyter-secrets). +# (jupyter.iscg.dev). Native Jupyter password login (bcrypt-хеш +# в env-файле jupyter-secrets). # # Лимиты: MemoryMax 2G, CPUQuota 50% — ноутбук не сможет съесть сервер. @@ -17,8 +17,8 @@ let jupyterBin = "${jupyterEnv}/bin/jupyter-lab"; in { # JupyterLab управляет собственным env-файлом? нет — используем - # EnvironmentFile с токеном: /var/lib/jupyter-secrets/jupyter.env - # (JUPYTER_TOKEN=..., mikl:users 0600) + # EnvironmentFile с хешем пароля: /var/lib/jupyter-secrets/jupyter.env + # (JUPYTER_PASSWORD_HASH=..., mikl:users 0600) systemd.services.jupyterlab = { description = "JupyterLab notebook server"; after = [ "network.target" ]; @@ -40,7 +40,8 @@ in { --no-browser \ --ip=127.0.0.1 \ --port=8890 \ - --IdentityProvider.token="$JUPYTER_TOKEN" \ + --ServerApp.password="$JUPYTER_PASSWORD_HASH" \ + --IdentityProvider.token="" \ --ServerApp.allow_remote_access=True \ --ServerApp.root_dir=/srv/jupyter '';