diff --git a/docs/edge-forwardauth-no-google.md b/docs/edge-forwardauth-no-google.md new file mode 100644 index 0000000..e8c8ec4 --- /dev/null +++ b/docs/edge-forwardauth-no-google.md @@ -0,0 +1,20 @@ +# AP4 edge forward-auth: local identity profile + +nginx의 `auth_request`가 oauth2-proxy `/oauth2/auth`를 호출하고, 미인증 +브라우저만 Keycloak로 redirect한다. oauth2-proxy는 confidential +`edge-proxy` client로 code를 교환하며 browser에는 HttpOnly session cookie만 +남긴다. + +Google이 없어도 이 경계는 완전히 동작한다. 사용자는 Keycloak local +credential로 로그인하고 upstream 애플리케이션은 OAuth/OIDC를 몰라도 된다. + +보안 경계: + +- backend와 oauth2-proxy 포트를 host에 publish하지 않는다. +- 외부에서 받은 identity header를 nginx가 제거·덮어쓴다. +- backend는 trusted nginx가 주입하는 별도 internal token도 확인한다. +- 브라우저가 직접 호출한 `/oauth2/auth`는 공개하지 않는다. + +`verify-edge-no-google-profile.sh`는 Compose와 nginx 계약을 검사하고, +`verify-pattern4.sh`는 실제 local-user 브라우저 흐름과 spoofing 방어를 +검증한다. diff --git a/scripts/verify-edge-no-google-profile.sh b/scripts/verify-edge-no-google-profile.sh new file mode 100755 index 0000000..e281f14 --- /dev/null +++ b/scripts/verify-edge-no-google-profile.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env sh +set -eu + +rendered="$(docker compose config --format json)" +printf '%s\n' "$rendered" | jq -e ' + (.services["oauth2-proxy"].command | index("--provider=keycloak-oidc") != null) + and + (.services["oauth2-proxy"].command | index("--code-challenge-method=S256") != null) + and + (.services.app.ports == null) + and + (.services["oauth2-proxy"].ports == null) +' >/dev/null + +rg -Fq 'auth_request /oauth2/auth;' frontend/default.conf.template +rg -Fq 'proxy_set_header X-Auth-Request-User $auth_user;' \ + frontend/default.conf.template +echo "AP4 local-identity edge profile verified"