我成功使用MySQL Workbench對Bluemix託管的MySQL Compose服務執行完全攻擊。將SpringBoot連接到託管在雲中的MySQL需要SSL
然後,我在本地筆記本電腦上用Apache Derby構建了一個簡單的SpringBoot Microservice ...成功。
我的下一步是使用Bluemix中託管的MySQL Compose。
我編輯application.properties跑進此錯誤 「PKIX路徑建設失敗:......」 「SunCertPathBuilderException:找不到請求目標的有效證書路徑」
application.properties file
spring.jpa.hibernate.ddl-auto=create
spring.jpa.database-platform=org.hibernate.dialect.MySQLDialect
spring.datasource.url=jdbc:mysql://somedomain:port/compose?useSSL=true?requireSSL=true
spring.datasource.username=myname
spring.datasource.password=mypassword
Bluemix爲我提供這些憑據在JSON:
{
"db_type": "mysql",
"name": "bmix-dal-yp-xxxxxxx-",
"uri_cli": "mysql -u myname -p --host somedomain.com --port 5555 --ssl-mode=REQUIRED",
"ca_certificate_base64": "LS0tLS1CRUd......",
"deployment_id": "58fexxxxxxxxxxx",
"uri": "mysql://myname:[email protected]:55555/compose"
}
我應該在我的application.properties中的某處使用CA證書嗎?
我是否需要在默認情況下使用springBoot運行的嵌入式tomcat服務器上啓用ssl?
如何配置我的springBoot應用程序以連接到我的雲提供商帶有SSL提供的json的MySQL實例?
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
問:我應該提供給我的「ca_certificate_base64」,其解碼爲一個名爲「信任」的文件,並把它放在我的資源文件夾(SpringBoot項目)? – xpagesbeast
我已經更新了答案。請讓我知道你是如何得到的。如果這不起作用,也許你可以在沒有ssl的github中創建一個最小的例子,我可以嘗試添加ssl並驗證修復工作。 –
我將jdbc更改爲不使用ssl,並且我能夠從我的筆記本電腦(springBoot項目)上對雲數據庫執行全面的檢查...成功我遵循您編寫的創建密鑰存儲庫的所有步驟,但有點困惑JAVA_OPTS環境變量。是否有我需要編輯的spring application.properties,以便Tomcat加載環境變量,還是需要在我的O/S(便攜式計算機)中創建環境變量「global」。我正在使用Ubuntu Linux工作站。 – xpagesbeast