【发布时间】:2020-06-03 17:48:44
【问题描述】:
我正在尝试通过 SSL 为我的 Spring Boot 应用程序保护与 AWS RDS 实例的连接。我查看了几个博客和官方documentation 并相应地修改了我的连接字符串以包含与SSL连接相关的某些参数。
我的证书放置在资源的证书文件夹中。以下是我尝试通过证书路径的方式:
jdbc:postgresql://myamazondomain.rds.amazonaws.com:5432/db_name?sslmode=verify-full&sslrootcert=/cert/rds-ca-cert_name.p12&password=my_passwrord
我也试过了:
jdbc:postgresql://myamazondomain.rds.amazonaws.com:5432/db_name?sslmode=verify-full&sslrootcert=/src/main/resources/cert/rds-ca-cert_name.p12&password=mypassword
但是,当我尝试从我的 ECS 容器连接到 RDS 时,我收到以下错误:
ERROR com.zaxxer.hikari.pool.HikariPool - HikariPool-1 - Exception during pool initialization.
org.postgresql.util.PSQLException: Could not open SSL root certificate file /cert/rds-ca-cert_name.p12.
at org.postgresql.ssl.LibPQFactory.<init>(LibPQFactory.java:120)
at org.postgresql.core.SocketFactoryFactory.getSslSocketFactory(SocketFactoryFactory.java:61)
at org.postgresql.ssl.MakeSSL.convert(MakeSSL.java:33)
at org.postgresql.core.v3.ConnectionFactoryImpl.enableSSL(ConnectionFactoryImpl.java:435)
at org.postgresql.core.v3.ConnectionFactoryImpl.tryConnect(ConnectionFactoryImpl.java:94)
at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:192)
at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:49)
at org.postgresql.jdbc.PgConnection.<init>(PgConnection.java:195)
at org.postgresql.Driver.makeConnection(Driver.java:454)
有人可以建议这里的错误是什么。将存储在类路径中的证书传递给 jdbc 连接字符串的正确方法是什么。
【问题讨论】:
标签: postgresql ssl jdbc ssl-certificate amazon-rds