Unable to Connect to SSL Services Due to 'PKIX Path Building Failed' Error
プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。
サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
このページの内容はサポート対象外のプラットフォームに関連しています。したがって、アトラシアン サポートではこのページの記載内容のサポートの提供は保証されません。この資料は情報提供のみを目的として提供されています。内容はお客様自身の責任でご利用ください。
要約
Accessing SSL-encrypted applications or websites (HTTPS, LDAPS, IMAPS, etc.) throws an exception, and the connection is refused.
ログの確認
The connection refused error can occur when attempting to establish a secure connection to any of the following:
- Active Directory server, Jira User server or Crowd
- メール サーバー
- アプリケーション リンクを使用した別の Atlassian アプリケーション
- Atlassian Marketplace
- アトラシアン移行サービス
For example, the following error appears in the UI when Using the Jira Issues Macro:
Error rendering macro: java.io.IOException: Could not download: https://siteURL/jira/secure/IssueNavigator.jspa?view=rss&&type=12&type=4&type=3&pid=10081&resolution=1&fixfor=10348&sorter/field=issuekey&sorter/order=DESC&sorter/field=priority&sorter/order=DESC&tempMax=100&reset=true&decorator=none
While the following appears in the application log:
javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Check the truststore with SSLPoke
SSL Poke を使用して接続を検証する
Try the Java class SSLPoke
to see if your truststore contains the right certificates. This class lets you connect to an SSL service, send a byte of input, and watch the output.
- SSLPoke.class をダウンロードします。
Execute the class as documented below, changing the URL and port appropriately. Take care that you are running the same Java your application (Confluence, Jira, etc.) is running with. If you used the installer you will need to use
<application-home>/jre/java
Replace atlassian.com with your domain below.
$JAVA_HOME/bin/java SSLPoke jira.atlassian.com 443
A mail server would be of the form
mail.atlassian.com 465
接続に失敗すると、以下のように出力されます。
$JAVA_HOME/bin/java SSLPoke jira.example.com 443
sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:387)
at sun.security.validator.PKIXValidator.engineValidate(PKIXValidator.java:292)
at sun.security.validator.Validator.validate(Validator.java:260)
at sun.security.ssl.X509TrustManagerImpl.validate(X509TrustManagerImpl.java:324)
at sun.security.ssl.X509TrustManagerImpl.checkTrusted(X509TrustManagerImpl.java:229)
at sun.security.ssl.X509TrustManagerImpl.checkServerTrusted(X509TrustManagerImpl.java:124)
at sun.security.ssl.ClientHandshaker.serverCertificate(ClientHandshaker.java:1351)
at sun.security.ssl.ClientHandshaker.processMessage(ClientHandshaker.java:156)
at sun.security.ssl.Handshaker.processLoop(Handshaker.java:925)
at sun.security.ssl.Handshaker.process_record(Handshaker.java:860)
at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1043)
at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1343)
at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:728)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:138)
at SSLPoke.main(SSLPoke.java:31)
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
at sun.security.provider.certpath.SunCertPathBuilder.build(SunCertPathBuilder.java:145)
at sun.security.provider.certpath.SunCertPathBuilder.engineBuild(SunCertPathBuilder.java:131)
at java.security.cert.CertPathBuilder.build(CertPathBuilder.java:280)
at sun.security.validator.PKIXValidator.doBuild(PKIXValidator.java:382)
... 15 more
To get more details from a failed connection, use the
-Djavax.net.debug=ssl
parameter. For example:
java -Djavax.net.debug=ssl SSLPoke jira.example.com 443
接続に成功すると、以下のように表示されます。
$JAVA_HOME/bin/java SSLPoke jira.example.com 443
Successfully connected
If -Djavax.net.ssl.trustStore
is present in your JVM arguments, Java will use that truststore instead of the default (cacerts). You can verify whether the -Djavax.net.ssl.trustStore
parameter is causing problems by running the SSLPoke
test using the same JVM argument which will execute SSLPoke using your custom truststore. For example:
$JAVA_HOME/bin/java -Djavax.net.ssl.trustStore=/my/custom/truststore -Djavax.net.debug=ssl SSLPoke jira.atlassian.com 443
これに失敗する (トラストストアに適切な証明書が含まれていないことが確認された) 場合、「SSL サービスへの接続」の手順に従い、定義したカスタム トラストストアに証明書をインポートする必要があります。
Import the certificates to the truststore
- ターゲット インスタンスの公開証明書が、「SSL サービスへの接続」の手順に従って、トラストストアにインポートされていることを確認します。
- JRE/JDK が複数ある場合があるため、証明書が正しいトラストストアにインポートされていることを確認します。「JVM にパブリック SSL 証明書をインポートする方法」を参照してください。
- 適切なトラストストアが使用中であることを確認します。
-Djavax.net.ssl.trustStore
が設定されている場合、デフォルトのトラストストアの場所が上書きされるため、確認が必要です。 - このエラーが LDAP サーバーを LDAPS 経由で連携させるときに発生していて、複数の LDAP サーバーが存在する場合、LDAP ユーザー ディレクトリ構成の [Follow referrals] オプションの選択を解除します。詳細については「LDAP ディレクトリへの接続」をご確認ください。あるいは、他の LDAP サーバーの SSL 証明書を Confluence のトラストストアにインポートします。
- アンチウイルス ツールの「SSL スキャン」によって SSL/TLS がブロックされているかどうかを確認します。ブロックされていたら、この機能を無効化するか、ターゲット アドレスを除外するように設定します (方法については製品マニュアルをご確認ください)。
- Exchange などのメール サーバーに接続する場合、認証情報としてプレーン テキストが許可されていることを確認します。
- ターゲット サーバーが SSL を適切に提供するように構成されていることを確認します。これは SSL サーバー テスト ツールで行えます。
- これらすべてに失敗する場合、ご利用のトラストストアが古くなっている可能性がああります。ご利用のアプリケーションでサポートされている最新のバージョンに Jira をアップグレードしてください。
重要
トラストストアは JVM の初期化時に一度のみ読み取られるため、新しい証明書をインポートしたあとはソースのアプリケーション サービスを再起動してください。
Further details on truststores
Java は SSL (例: HTTPS、IMAPS、LDAPS) 経由で他のアプリケーションに接続しようとするときに、信頼できるアプリケーションにのみ 接続できます。Java において信頼のやりとりは、トラストストアを持って行います (通常 $JAVA_HOME/lib/security/cacerts
)。これは既知のすべての認証局 (CA) 証明書の一覧を含み、Java はこれらの CA のいずれかによって署名された証明書、またはそのキーストア内にある公開証明書のみを信頼します。たとえば、アトラシアン証明書を見ると、*.atlassian.com であることがわかります。証明書は、中間証明書である DigiCert High Assurance EV Root CA と DigiCert High Assurance CA-3 によって署名されています。これらの中間証明書は Entrust.net Secure Server CA のルート証明書で署名されています。
これらの 3 つの証明書の組み合わせは証明書チェーンと呼ばれます。これらはすべて Java トラストストア (cacerts
) 内にあるため、Java はこれらによって署名されたすべての証明書 (この場合は *.atlassian.com) を信頼します。あるいは、*. atlassian.com 証明書がトラストストア内にある場合、Java はそのサイトも信用します。
この問題は、自己署名 (CA が署名していない) 証明書、または Java トラストストアに存在しない証明書チェーンによって引き起こされます。Java はその証明書を信用せず、アプリケーションへの接続に失敗します。
For details on how to examine a website's certificate chain, see the section, View a certificate, in Secure Website Certificate.
SSL Poke の詳細
アトラシアンの SSL Poke のソース コードはこちらで確認できます。
SSL Poke のフォーク バージョンはコミュニティで提供されています。ここでは Java 11 やプロキシなどの追加の機能がサポートされます。
次のような良い例があります。