오래도록 이 문제를 해결하려고 애써 왔지만 아직도 해결되지 않습니다. discourse-openid-connect 플러그인을 사용하여 Keycloak 설정으로 인증을 통합하는 것을 시도하고 있습니다. 현재 discourse-docker 버전 3.0.1을 사용 중입니다. 지금 OpenID connect 로그인 버튼을 클릭하면 discourse에 다음과 같은 메시지가 표시됩니다. “Unable to fetch configuration from identity provider. Please try again.”
새로운 discourse 설정으로 이관하는 중인데, 재미있는 점은 discourse가 기존 Keycloak 인스턴스를 통해 Keycloak 로그인 화면에 접근하는 것은 잘 되지만, 새로운 인스턴스로는 접근하지 못한다는 것입니다. 이는 다음 사항이 참이어야 함을 의미합니다:
- openid-connect 플러그인 설정이 확실히 정확합니다 (기존 discourse에서 복사함)
- discourse 클라이언트에 대한 Keycloak 설정이 확실히 정확합니다 (기존 discourse에서 복사함)
- 네트워크 문제가 없습니다
- 트래픽을 차단하는 방화벽이 있거나 다른 장애 요소가 없습니다
추가로, discourse 인스턴스에서 Keycloak의 discovery document URL을 curl로 성공적으로 요청할 수 있음을 확인했습니다. Keycloak 버전은 기존 것과 동일하며, Keycloak 인증은 discourse와 동일한 AWS 리전과 가용 영역(AZ)에 위치한 다른 도구에서는 정상적으로 작동합니다. openid-connect를 사용하여 로그인할 때 로그에 기록되는 오류는 다음과 같습니다.
많은 조사를 하고 테스트해 보았지만 아무것도 해결되지 않았습니다. 허용되지 않는 IP에 대한 오류 메시지는 꽤 일반적인 것 같고, discovery document를 curl로 정상적으로 요청할 수 있으므로 방화벽이 무언가를 차단하고 있다는 가능성은 거의 없다고 확신합니다. discourse가 어딘가의 캐시에서 문서를 가져오려고 하거나 올바른 토큰 URL을 호출하지 못하고 있을 것 같지만, 정확히 알 수 없습니다. 도움이 필요하니 조언을 주시면 감사하겠습니다.
Started GET "/session/csrf" for <my_ip> at 2023-02-01 18:02:24 +0000
Processing by SessionController#csrf as JSON
Completed 200 OK in 2ms (Views: 0.2ms | ActiveRecord: 0.0ms | Allocations: 406)
Started POST "/auth/oidc" for 10.158.133.85 at 2023-02-01 18:02:24 +0000
(oidc) Setup endpoint detected, running now.
OIDC Log: Fetching discovery document from https://<keycloak_URL>.com/auth/realms/<my_realm>/.well-known/openid-configuration
OIDC Log: Fetching discovery document raised error Faraday::ConnectionFailed FinalDestination: all resolved IPs were disallowed
OIDC Log: Discovery document is
---
(oidc) Request phase initiated.
(oidc) Authentication failure! openid_connect_discovery_error: OmniAuth::OpenIDConnect::DiscoveryError, Discovery document is missing
Started GET "/auth/failure?message=openid_connect_discovery_error&strategy=oidc" for <my_ip> at 2023-02-01 18:02:24 +0000
Processing by Users::OmniauthCallbacksController#failure as HTML
Parameters: {"message"=>"openid_connect_discovery_error", "strategy"=>"oidc"}
Rendered users/omniauth_callbacks/failure.html.erb within layouts/no_ember (Duration: 0.1ms | Allocations: 17)
Rendered layout layouts/no_ember.html.erb (Duration: 17.3ms | Allocations: 5113)
Completed 200 OK in 24ms (Views: 19.7ms | ActiveRecord: 0.0ms | Allocations: 6610)