Zum*_*pel 4 postgresql azure keycloak
我正在 Azure 应用服务(Docker 容器)中运行 KeyCloak,使用以下图像“quay.io/keycloak/keycloak:21.0.1” - 正如文档中所述
一切正常。我可以使用自定义域访问 KeyCloak,并且登录管理控制台也可以。但!一件事不起作用:数据库。
我使用的是 PostgreSQL 数据库,该数据库也托管在 Azure 上。在 DBeaver 的帮助下,我可以使用在环境变量中输入的相同凭据连接到它(这就是我从顺便说一句复制数据库 URL 的地方)。
日志声明如下:
2023-03-10T13:54:44.250741391Z 2023-03-10 13:54:44,192 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Failed to obtain JDBC connection
2023-03-10T13:54:44.253996869Z 2023-03-10 13:54:44,192 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: SSL error: Certificates do not conform to algorithm constraints
2023-03-10T13:54:44.254005969Z 2023-03-10 13:54:44,192 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Certificates do not conform to algorithm constraints
2023-03-10T13:54:44.254020670Z 2023-03-10 13:54:44,193 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Certificates do not conform to algorithm constraints
2023-03-10T13:54:44.254027270Z 2023-03-10 13:54:44,194 ERROR [org.keycloak.quarkus.runtime.cli.ExecutionExceptionHandler] (main) ERROR: Algorithm constraints check failed on signature algorithm: SHA1withRSA
Run Code Online (Sandbox Code Playgroud)
只是为了澄清这一点:只是为了确保 Web 应用程序可以访问数据库,我完全打开了它(0.0.0.0 - 255.255.255.255)。另外,我手动添加了“keycloak”模式(根据文档,这应该是默认模式)。
多亏了这个GitHub 答案,我才能够找到它。
Azure Database for Postgresql - Single Server 似乎正在使用 SHA256 DigiCertGlobalRootG2,对于任何使用 Single Server 的人来说都不会遇到此问题。
但对于灵活服务器,仍在使用旧的 SHA1 根证书,导致此错误。
灵活服务器的解决方法
https://github.com/keycloak/keycloak/issues/17606#issuecomment-1472289443
对于那些尝试解决此问题而不使用 security.config 使其适用于 Azure 灵活 PostgresSQL 服务器的人。通过添加以下证书:https://learn.microsoft.com/en-us/azure/postgresql/flexible-server/how-to-connect-tls-ssl 到 /opt/keycloak/.postgresql/root.crt 并设置 KC_DB_URL_PROPERTIES="?sslmode=verify-full"
| 归档时间: |
|
| 查看次数: |
2354 次 |
| 最近记录: |