heather: use native Jupyter password login instead of Caddy basic auth

This commit is contained in:
mikl 2026-09-11 13:09:53 +03:00
commit 07bd059376
2 changed files with 8 additions and 11 deletions

View file

@ -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
'';

View file

@ -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
'';