connecting to AWS documenDB from local using port forwarding set up

0

Hi All,

I have set up port forwarding using which I am able to connect to studio T3 host details as localhost:27017. But when I try connecting trough prgramatically via springboot application with rds-truststore.jks file I am getting bellow error

Caused by: java.security.cert.CertificateException: No subject alternative names matching IP address localhost found at java.base/sun.security.util.HostnameChecker.matchIP(HostnameChecker.java:165) ~[na:na] at java.base/sun.security.util.HostnameChecker.match(HostnameChecker.java:101) ~[na:na] at java.base/sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:455) ~[na:na] at java.base/sun.security.ssl.X509TrustManagerImpl.checkIdentity(X509TrustManagerImpl.java:415) ~[na:na] at java.base/sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229) ~[na:na] at java.base/sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:129) ~[na:na] at java.base/sun.security.ssl.CertificateMessage$T13CertificateConsumer.checkServerCerts(CertificateMessage.java:1341) ~[na:na] ... 23 common frames omitted

it is due to there is no reference of localhost in the rds-truststore.jks file..

How to add the localhost to rds-truststore.jks file ?

질문됨 3달 전258회 조회
2개 답변
1
수락된 답변

In my case below string helped in connecting to WS document DB from local machine

mongodb://<username>:<password>@localhost:27017/?tls=true&tlsInsecure=true

답변함 3달 전
profile picture
전문가
검토됨 2달 전
0

Try these:

  • Open the rds-truststore.jks file using keytool utility
  • keytool -keystore rds-truststore.jks -storepass <password> -list
  • Add the localhost alias to the truststore
  • keytool -keystore rds-truststore.jks -storepass <password> -alias localhost -import -file localhost.cer
  • Provide the path of the updated truststore in the springboot application configuration.
  • Restart the springboot application.
  • This will add the localhost certificate to the truststore and allow the application to connect to the database using localhost port forwarding without any certificate errors.
profile picture
전문가
답변함 3달 전
  • Thanks for answering, I did't try this as below connection string worked.

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠