I deployed v2.0-beta on a fresh k3s cluster. I tried following the deployment guide. My only deviation was to disable IPv6 in APISIX because my network does not support it.
All components are in Running state but I can not sign in with my initial user.
The sequence of events is as follows:
- Visit portal.<domain>
- „Sign in with Keycloak“
- Enter credentials and submit
- 302 idm authenticate
- 302 portal keycloak
- 307 portal /
- 307 portal signout
- Back to the portal; not logged in
In the logs of portal-front I found:
frontend Server fetch failed for /users/me: Error [AuthError]: Backend responded with status 401 │
frontend at e (.next/server/chunks/ssr/[root-of-the-server]__8e133fb0._.js:2:2165) │
frontend at async ao (.next/server/chunks/ssr/_c08c328d._.js:1:68298) │
frontend Keycloak logout completed
The culprit seems to be in portal-backend (shortened):
ERROR 1 --- [CIVITAS/CORE Data Management API] [nio-8080-exec-5] o.a.c.c.C.[.[.[/v1].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [/v1] threw exception
org.springframework.security.authentication.AuthenticationServiceException: An error occurred while attempting to decode the Jwt: I/O error on GET request for "https://idm.<domain>/realms/dev/protocol/openid-connect/certs": (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[...]
Caused by: org.springframework.security.oauth2.jwt.JwtException: An error occurred while attempting to decode the Jwt: I/O error on GET request for "https://idm.<domain>/realms/dev/protocol/openid-connect/certs": (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[...]
Caused by: com.nimbusds.jose.RemoteKeySourceException: I/O error on GET request for "https://idm.<domain>/realms/dev/protocol/openid-connect/certs": (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[...]
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://idm.<domain>/realms/dev/protocol/openid-connect/certs": (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[...]
Caused by: javax.net.ssl.SSLHandshakeException: (certificate_unknown) PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[...]
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[...]
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
[...]
WARN 1 --- [CIVITAS/CORE Data Management API] [nio-8080-exec-5] d.c.p.c.e.SecurityExceptionHandler : Authentication failed: Full authentication is required to access this resource
This looks like the backend not trusting the ingress certificate.
How would I make portal-backend trust my k3s’ self-signed CA certificate (/var/lib/rancher/k3s/server/tls/server-ca.crt)?
If I have overlooked anything, please do let me know.