Files
buryan-infra/ops/sso/2026-10-19-noch/08b-immich-oauth-write.sh
T
buryan-agent 5652d0bd8d Родной SSO: Home через Authentik, Navidrome, Mealie, Immich, Element
Home Assistant: trusted_networks + trusted_users, домен через прокси — своя форма убрана.
Navidrome: доверенная сеть Docker + доступ к библиотеке, проверено по API (200/401).
Authentik: созданы mealie-oidc и immich-oidc с областями по образцу.
Mealie: родной OIDC, прокси убран. Immich: oauth включён в базе.
Synapse: allow_existing_users=true — SSO пускает существующие учётки.
2026-10-19 13:44:37 +03:00

38 lines
1.9 KiB
Bash
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
#!/bin/bash
# Immich: запись настроек (файл должен быть читаем пользователю postgres)
set -uo pipefail
echo "=== 1. ПУШУ И ОТКРЫВАЮ НА ЧТЕНИЕ ==="
scp -q /tmp/immich.sql root@192.168.1.10:/tmp/immich.sql
ssh -o BatchMode=yes root@192.168.1.10 'pct push 151 /tmp/immich.sql /tmp/immich.sql --perms 644 && pct exec 151 -- ls -la /tmp/immich.sql' 2>&1 | sed 's/^/ /'
echo
echo "=== 2. ЗАПИСЬ ==="
ssh -o BatchMode=yes root@192.168.1.10 'pct exec 151 -- bash -c "su - postgres -c \"psql -d immich_db -f /tmp/immich.sql\""' 2>&1 | sed 's/^/ /'
echo
echo "=== 3. ПРОВЕРКА В БАЗЕ ==="
ssh -o BatchMode=yes root@192.168.1.10 'pct exec 151 -- bash -c "su - postgres -c \"psql -d immich_db -tAc \\\"select value from system_metadata where key='"'"'system-config'"'"'\\\"\"" 2>/dev/null' 2>&1 \
| python3 -c "
import json,sys
d=json.loads(sys.stdin.read().strip())
o=d.get('oauth',{})
print(' enabled:', o.get('enabled'), '| clientId:', o.get('clientId'), '| issuer:', (o.get('issuerUrl') or '')[:60])
"
echo
echo "=== 4. ПЕРЕЗАПУСК IMMICH ==="
ssh -o BatchMode=yes root@192.168.1.104 'docker restart immich_server >/dev/null 2>&1 && echo " перезапущен"' 2>&1
for i in $(seq 1 12); do
sleep 10
code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 8 http://192.168.1.104:2283/api/server/version 2>/dev/null)
[ "$code" = "200" ] && { echo " поднялся ($i)"; break; }
done
echo
echo "=== 5. ПРИЗНАКИ ВХОДА В IMMICH ==="
curl -s --max-time 10 http://192.168.1.104:2283/api/server/features 2>/dev/null | python3 -c "
import json,sys
d=json.load(sys.stdin)
print(' oauth:', d.get('oauth'), '| авто-запуск:', d.get('oauthAutoLaunch'), '| вход по паролю:', d.get('passwordLogin'))
" 2>&1
echo " домен: $(curl -s -o /dev/null -w '%{http_code}' --max-time 12 -k https://immich.buryans.ru/)"