Merge pull request '[SECURITY] Caddy: голый IP по HTTP спрашивал пароль пилота открытым текстом' (#3318) from fix/caddy-bare-ip-plaintext-auth into main
All checks were successful
Deploy Infra Host / sync-infra-host (push) Successful in 7s
Deploy / changes (push) Successful in 10s
Deploy / deploy-caddy (push) Has been skipped
Deploy / build-worker (push) Successful in 42s
Deploy / build-backend (push) Successful in 50s
Deploy / build-frontend (push) Successful in 4m33s
Deploy / deploy (push) Successful in 1m13s
Deploy / deploy-status (push) Successful in 1s
Deploy / perimeter-smoke (push) Successful in 11s
All checks were successful
Deploy Infra Host / sync-infra-host (push) Successful in 7s
Deploy / changes (push) Successful in 10s
Deploy / deploy-caddy (push) Has been skipped
Deploy / build-worker (push) Successful in 42s
Deploy / build-backend (push) Successful in 50s
Deploy / build-frontend (push) Successful in 4m33s
Deploy / deploy (push) Successful in 1m13s
Deploy / deploy-status (push) Successful in 1s
Deploy / perimeter-smoke (push) Successful in 11s
This commit is contained in:
commit
60bb7cf54e
1 changed files with 14 additions and 17 deletions
31
Caddyfile
31
Caddyfile
|
|
@ -50,30 +50,27 @@
|
|||
# ничего не меняется. В окне: на Selectel CADDY_SITES=apps, на Beget=infra.
|
||||
import caddy/sites/{$CADDY_SITES:*}.caddy
|
||||
|
||||
# Plain HTTP by IP — closed by same auth gate (prevent bypass via direct IP / SSH tunnel).
|
||||
# Caddy issues no TLS here (no hostname). /health remains public.
|
||||
# Plain HTTP by IP. /health остаётся публичным (liveness). Всё остальное —
|
||||
# РЕДИРЕКТ на канонический HTTPS, а не проксирование под basic_auth.
|
||||
#
|
||||
# ЗДЕСЬ СТОЯЛ auth-гейт с проксированием приложения — «закрыть обход через
|
||||
# голый IP тем же гейтом». Замысел верный, исполнение — дыра: Basic-challenge
|
||||
# на plain HTTP означает, что браузер отправит пароль пилота ОТКРЫТЫМ ТЕКСТОМ
|
||||
# любому, кто слушает канал (аудит 02.09.2026: curl http://<IP>/api/v1/me →
|
||||
# 401 + Www-Authenticate: Basic realm="GenDesign Pilot"). Редирект строже
|
||||
# гейта: по HTTP не отдаётся ни контент, ни сам запрос пароля, обход через
|
||||
# IP закрыт тем, что отвечать нечему. Потребителей у IP:80 нет: все
|
||||
# deploy-смоки ходят docker exec → localhost внутри контейнеров (проверено
|
||||
# grep-ом по .forgejo/workflows и ops/ 02.09.2026).
|
||||
:80 {
|
||||
encode zstd gzip
|
||||
|
||||
route {
|
||||
# /health — public, без auth (GHA deploy smoke check, liveness probe).
|
||||
# /health — public, без auth (liveness probe).
|
||||
handle /health {
|
||||
reverse_proxy backend:8000
|
||||
}
|
||||
|
||||
# Auth gate (same snippet as gendsgn.ru).
|
||||
import caddy/users.caddy.snippet
|
||||
|
||||
handle /api/* {
|
||||
reverse_proxy backend:8000 {
|
||||
header_up X-Authenticated-User {http.auth.user.id}
|
||||
}
|
||||
}
|
||||
|
||||
handle {
|
||||
reverse_proxy frontend:3000 {
|
||||
header_up X-Authenticated-User {http.auth.user.id}
|
||||
}
|
||||
redir https://gendsgn.ru{uri} permanent
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue