質問
Heroku Postgresとの接続で、以下のエラーが発生します。
原因と回避策を教えてください。
FATAL: no pg_hba.conf entry for host “xxx.xxx.xxx.xxx”, user “xxxxxxxxx", database “xxxxxxxxxxx”, SSL off
SSL error: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
回答
前提としまして、PostgreSQLコネクターはオンプレミス版のPostgreSQLに対してのみ動作検証を行っており、Heroku Postgresへの接続は保証しておりません。
以下、各エラーについて説明いたします。
FATAL: no pg_hba.conf entry for host “xxx.xxx.xxx.xxx”, user “xxxxxxxxx", database “xxxxxxxxxxx”, SSL off
SSL接続をしていないために発生するエラーです。
SSL error: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Javaのキーストアにサーバ証明書がインポートされていないために発生するエラーです。
以下の外部資料によりますと、Heroku Postgresへの接続では、クライアントへのサーバ証明書のインポートが必要と記載されております。
■外部リソースから Private または Shield の Heroku Postgres データベースに接続する
https://devcenter.heroku.com/ja/articles/heroku-postgres-via-mtls
ただし、HULFT Squareでは、キーストアにサーバ証明書をインポートすることができないため、上記方法にてHeroku Postgresに接続することはできません。
補足
以下の外部情報によりますと、接続時のURLに以下のパラメータを追加することで、サーバ証明書のチェックを回避できる可能性がございます。
■SSL 検証なしで Heroku Postgres に接続する
https://pleiades.io/help/datagrip/how-to-connect-to-heroku-postgres.html
sslmode:require
sslfactory:org.postgresql.ssl.NonValidatingFactory
ただし、本パラメータの追加による接続時の影響や接続可否につきましては弊社のサポート対象外となりますので、Herokuのサポート窓口にご確認ください。
コメント
0件のコメント
記事コメントは受け付けていません。