Compare commits

..

1 Commits

Author SHA1 Message Date
gitea 111f11f534 docs(sekrety): dołożenie klucza do ISTNIEJĄCEGO sekretu, nie tylko tworzenie
Po zmergowaniu LOG-34 pody prezentacji nie wstały:
  Error: couldn't find key SESSION_SECRET in Secret astrololo/astrololo-auth

Runbook opisywał wyłącznie ścieżkę instalacji OD ZERA — SESSION_SECRET pojawiał
się tylko w komendzie `create secret`. Na działającym wdrożeniu sekret już
istnieje, a merge manifestu kluczy do niego nie dokłada; każe ich tylko szukać.

Gorzej: opisana rotacja też by tam nie zadziałała. Używała JSON Patch z
`op: replace` na /data/SESSION_SECRET, a `replace` wymaga, żeby ścieżka już
istniała — czyli jedyna komenda, po którą sięgnąłby ktoś w tej sytuacji, też
odmawia.

Teraz obie potrzeby obsługuje JEDNA komenda: `--type=merge` ze `stringData`
dokłada albo nadpisuje i nie wymaga wcześniejszego istnienia klucza. Dopisane
sprawdzenie kompletu kluczy bez pokazywania wartości oraz to samo ostrzeżenie
w runbooku demo, gdzie czeka dokładnie ta sama pułapka.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-21 12:58:33 +02:00
3 changed files with 37 additions and 35 deletions
+37 -9
View File
@@ -100,15 +100,43 @@ unset APP_PASSWORD
wstanie**: usługa z kontami, ale bez klucza, nie odróżniłaby ważnej sesji od
podrobionej. Nikt go nigdy nie musi oglądać.
> **Rotacja tego klucza wylogowuje WSZYSTKICH.** To nie usterka, tylko awaryjny
> wyłącznik: gdy podejrzewasz, że ktoś przechwycił cudzą sesję, podmiana klucza
> unieważnia je wszystkie naraz.
>
> ```bash
> kubectl -n astrololo patch secret astrololo-auth --type=json \
> -p="[{\"op\":\"replace\",\"path\":\"/data/SESSION_SECRET\",\"value\":\"$(openssl rand -hex 32 | base64 | tr -d '\n')\"}]"
> kubectl -n astrololo rollout restart deploy/presentation
> ```
### ⚠️ Masz już sekret sprzed LOG-34? Dołóż klucz, nie twórz od nowa
Komenda wyżej zakłada sekret **od zera**. Jeśli `astrololo-auth` już istnieje,
merge manifestu sam klucza nie dołoży — pod zgłosi wtedy:
```
Error: couldn't find key SESSION_SECRET in Secret astrololo/astrololo-auth
```
Dokładamy klucz, nie ruszając pozostałych:
```bash
kubectl -n astrololo patch secret astrololo-auth --type=merge \
-p "{\"stringData\":{\"SESSION_SECRET\":\"$(openssl rand -hex 32)\"}}"
kubectl -n astrololo rollout restart deploy/presentation
```
Sprawdzenie, że komplet kluczy jest na miejscu (bez pokazywania wartości):
```bash
kubectl -n astrololo get secret astrololo-auth -o jsonpath='{.data}' \
| tr ',' '\n' | grep -o '"[A-Z_]*"'
```
Oczekiwane: `APP_PASSWORD`, `INTERNAL_TOKEN`, `SESSION_SECRET`.
> `--type=merge` ze `stringData` **dokłada albo nadpisuje** i nie wymaga, żeby
> klucz wcześniej istniał — w odróżnieniu od JSON Patch z `op: replace`, który
> na brakującej ścieżce po prostu odmawia. Ta sama komenda służy więc i do
> dołożenia, i do rotacji.
### Rotacja klucza sesji
**Wylogowuje WSZYSTKICH.** To nie usterka, tylko awaryjny wyłącznik: gdy
podejrzewasz, że ktoś przechwycił cudzą sesję, podmiana klucza unieważnia je
wszystkie naraz. Komenda ta sama, co dołożenie wyżej.
`INTERNAL_TOKEN` jest losowany i **nikt go nigdy nie musi oglądać** — służy tylko
usługom do rozmowy między sobą. `APP_PASSWORD` wpisujesz w przeglądarce
-13
View File
@@ -31,19 +31,6 @@ spec:
# Where the librarian sends THIS bot's results/pongs back to (its own
# NodePort). Lets one librarian serve both bots - see deploy-bot.yaml.
- { name: CONJURER_SELF_CALLBACK, value: "http://192.168.1.73:32442" }
# Self-hosted models (Ollama). No API key - the endpoint IS the
# configuration, and the backend stays unselectable while unset.
# Pick a model at runtime with: $gadaj_teraz ollama <model>
# ($modele_ai lists what the server actually has pulled).
- { name: CONJURER_OLLAMA_URL, value: "http://192.168.1.72:11434" }
# The server currently has exactly one model pulled (verified via
# /v1/models): gemma4:e2b. Without this the built-in default
# (llama3.1:8b) would be requested and every reply would fail.
- { name: CONJURER_OLLAMA_MODEL, value: "gemma4:e2b" }
# Self-hosted generation is far slower than a hosted API, especially
# the first request after the model is evicted from VRAM. Applies to
# every backend, so keep it only as high as you actually need.
- { name: CONJURER_AI_TIMEOUT_SECONDS, value: "240" }
volumeMounts:
- { name: data, mountPath: /data }
- { name: netrc, mountPath: /secrets, readOnly: true }
-13
View File
@@ -51,19 +51,6 @@ spec:
# query and answers results/pongs HERE - so it serves this bot AND the
# test bot from one instance, no CONJURER_MAIN_BOT repointing needed.
- { name: CONJURER_SELF_CALLBACK, value: "http://192.168.1.73:32443" }
# Self-hosted models (Ollama). No API key - the endpoint IS the
# configuration, and the backend stays unselectable while unset.
# Pick a model at runtime with: $gadaj_teraz ollama <model>
# ($modele_ai lists what the server actually has pulled).
- { name: CONJURER_OLLAMA_URL, value: "http://192.168.1.72:11434" }
# The server currently has exactly one model pulled (verified via
# /v1/models): gemma4:e2b. Without this the built-in default
# (llama3.1:8b) would be requested and every reply would fail.
- { name: CONJURER_OLLAMA_MODEL, value: "gemma4:e2b" }
# Self-hosted generation is far slower than a hosted API, especially
# the first request after the model is evicted from VRAM. Applies to
# every backend, so keep it only as high as you actually need.
- { name: CONJURER_AI_TIMEOUT_SECONDS, value: "240" }
volumeMounts:
- { name: data, mountPath: /data }
- { name: netrc, mountPath: /secrets, readOnly: true }