SonarQube:如何连接启用 SSL Google Cloud Postgresql 服务器
SonarQube: How to connect to SSL enabled Google Cloud Postgresql server
我已经设置了一个 SonarQube 并配置了 SSL 证书,使 URL 始终使用 CertBot HTTPS。截至目前,PostgreSQL 数据库有一个 public IP,下面是 sonar.properties 文件中更改的值:
sonar.jdbc.username=weakusername
sonar.jdbc.password=strongpassword
sonar.web.host=127.0.0.1
sonar.jdbc.url=jdbc:postgresql://xx.xxx.xxx.xxx/sonarqube
sonar.search.javaOpts=-Xms512m -Xmx512m
# Change max limits
sysctl -w vm.max_map_count=262144
我正在使用Cloud SQL PostGres as the database. I would like to allow Only SSL Only Connections to the database and here如何做,生成客户端证书等
将“仅允许 SSL 连接”设置为 true 后,我了解到有一种方法可以使用 here 中描述的客户端证书连接到数据库。
下面是启动psql客户端的命令:
psql "sslmode=verify-ca sslrootcert=server-ca.pem \
sslcert=client-cert.pem sslkey=client-key.pem \
hostaddr=[INSTANCE_IP] \
user=postgres dbname=[DB_NAME]"
但是,SonarQube 无法连接到数据库(不确定如何告诉 SonarQube 使用客户端证书)。
配置文件中需要进行哪些更改才能使 SonarQube 使用适当的客户端证书并使用 SSL 连接到数据库?
您应该将以下内容添加到 URL:
jdbc:postgresql://xx.xxx.xxx.xxx/sonarqube?ssl=true&sslmode=verify-ca&sslrootcert=/path/to/server-ca.pem&sslkey=/path/to/client-key.pem&sslcert=/path/to/client-cert.pem
请参阅 the available SSL connection parameters and SSL client configuration 的文档。
将客户端密钥格式从 PEM 转换为 PK8:
openssl pkcs8 -topk8 -inform PEM -outform DER -in client-key.pem -out client-key.pk8 -nocrypt
请务必使用新的 path/filename.
更新 sonar.jdbc.url
中 sslkey
查询参数的值
我已经设置了一个 SonarQube 并配置了 SSL 证书,使 URL 始终使用 CertBot HTTPS。截至目前,PostgreSQL 数据库有一个 public IP,下面是 sonar.properties 文件中更改的值:
sonar.jdbc.username=weakusername
sonar.jdbc.password=strongpassword
sonar.web.host=127.0.0.1
sonar.jdbc.url=jdbc:postgresql://xx.xxx.xxx.xxx/sonarqube
sonar.search.javaOpts=-Xms512m -Xmx512m
# Change max limits
sysctl -w vm.max_map_count=262144
我正在使用Cloud SQL PostGres as the database. I would like to allow Only SSL Only Connections to the database and here如何做,生成客户端证书等
将“仅允许 SSL 连接”设置为 true 后,我了解到有一种方法可以使用 here 中描述的客户端证书连接到数据库。
下面是启动psql客户端的命令:
psql "sslmode=verify-ca sslrootcert=server-ca.pem \
sslcert=client-cert.pem sslkey=client-key.pem \
hostaddr=[INSTANCE_IP] \
user=postgres dbname=[DB_NAME]"
但是,SonarQube 无法连接到数据库(不确定如何告诉 SonarQube 使用客户端证书)。 配置文件中需要进行哪些更改才能使 SonarQube 使用适当的客户端证书并使用 SSL 连接到数据库?
您应该将以下内容添加到 URL:
jdbc:postgresql://xx.xxx.xxx.xxx/sonarqube?ssl=true&sslmode=verify-ca&sslrootcert=/path/to/server-ca.pem&sslkey=/path/to/client-key.pem&sslcert=/path/to/client-cert.pem
请参阅 the available SSL connection parameters and SSL client configuration 的文档。
将客户端密钥格式从 PEM 转换为 PK8:
openssl pkcs8 -topk8 -inform PEM -outform DER -in client-key.pem -out client-key.pk8 -nocrypt
请务必使用新的 path/filename.
更新sonar.jdbc.url
中 sslkey
查询参数的值