SSL サービスに接続する

このページの内容

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

アトラシアンのアプリケーションはSSLに対応しています。しかし、アトラシアンのサポートはその設定に対して支援は行いません。つまり、アトラシアンはSSLに関するあらゆるサポートの提供の保証はできません

  • SSL証明書の変更に際してサポートが必要であれば、証明書の提供元のベンダーに相談してください。
  • 設定に関してサポートが必要であれば、Atlassian Answers に質問をあげてください。

本ページでは、JIRA、Confluence等のウェブアプリケーションを SSL ラッピングされた多種プロトコル経由の SSL 上で外部サーバーに接続して取得する手順について説明します。 SSL サービスは以下の作業を実行する場合に必要です。

  • Confluence マクロで https://... URL を参照する。
  • IMAPS サーバーを使用して JIRA でメールを取得する。
  • SMTP over SSL (SSL) を使用して JIRA でメールを送信する。
  • SSL 上で LDAP ディレクトリに接続する。
  • SSL 上で Trusted Applications を設定する。

JIRA 自体を SSL 上で実行する場合は、SSL または HTTPS 上で JIRA アプリケーションを実行または SSL を使った JIRA と Apache の統合をご参照下さい。

tip/resting Created with Sketch.

自動的にSSL証明書を追加します!

We now have a JIRA SSL Atlassian Labs plugin for this process. Please install and use the plugin before going through these docs.

On this page:

問題症状が発生した場合

SSL で暗号化された URL (HTTPS、LDAPS、IMAPS など) にアクセスしようとすると、例外をスローし、JIRA が接続を拒否する。例:

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
 at com.sun.mail.imap.IMAPStore.protocolConnect(IMAPStore.java:441)
 at javax.mail.Service.connect(Service.java:233)
 at javax.mail.Service.connect(Service.java:134)

これは自己署名で暗号化されたページにアクセスする際に Chrome で発生する以下のエラーと同じですが、Java は「とにかく続行」することができないため、証明書を拒否します。

原因

Whenever JIRA attempts to connect to another application over SSL (e.g.: HTTPS, IMAPS, LDAPS), it will only be able to connect to that application if it can trust it. The way trust is handled in the Java world (this is what JIRA is written in) is that you have a keystore (typically $JAVA_HOME/lib/security/cacerts) or also known as the trust store. This contains a list of all the known CA certificates and Java will only trust certificates that are signed by those CA certificate or public certificates that exist within that keystore. For example, if we look at the certificate for Atlassian:

We can see the *.atlassian.com certificate has been signed by the intermediate certificates, DigiCert High Assurance EV Root CA and DigiCert High Assurance CA-3. These intermediate certificates have been signed by the root Entrust.net Secure Server CA. Those three certificates combined are referred to as the certificate chain. As all of those CA certificates are within the Java keystore (cacerts), Java will trust any certificates signed by them (in this case, *.atlassian.com). Alternatively, if the *.atlassian.com certificate was in the keystore, Java would also trust that site.

この問題は、自己署名 (認証局の署名がない) がされた証明書、または Java キーストアに存在しない証明書チェーンから発生します。問題が発生すると、JIRA は証明書を信用しなくなるため、アプリケーション接続が出来なくなります。

ソリューション

In order to resolve this, the public certificate need to be imported in the Java keystore that JIRA uses. In the example above, this is *.atlassian.com and we cover how to install it below.

お客様のサーバーに Portecle をインストールすることができない場合や、コマンドラインの利用をご希望の場合は、このページ下部にある コマンドラインを使用したインストール セクションをご覧ください。

サーバーの公開証明書を取得、インポートする

  1. Portecle アプリをダウンロードし、JIRA を起動させるサーバーにインストールします。
    (warning)このアプリケーションはサードパーティー製であり、アトラシアンではサポート対象外です。
  2. Ensure the <JAVA_HOME> variable is pointing to the same version of Java that JIRA uses. See our Setting JAVA_HOME docs for further information on this.
    (info) If running on a Linux/UNIX server, X11 will need to be forwarded when connecting to the server (so you can use the GUI), as below:

    ssh -X user@server
  3. [調査] メニューを選択し、[SSL/TLS 接続の調査] をクリックします。
  4. ターゲットとなるシステムの SSL ホストとポートを入力します。
  5. 読み込みが完了されるまで待ちます。完了したら、パブリック証明書を選択し、PEM をクリックします。
  6. 証明書をエクスポートし、保存します。
  7. メインの画面に戻り、[ディスクから既存のキーストアを開く] オプションから cacerts ファイル (例: $JAVA_HOME/lib/security/cacerts) を選択し、パスワード (既定では changeit) を入力します。
  8. [信頼済みの証明書をロードされたキーストアにインポートする] ボタンを選択します。
  9. ステップ 6 で保存した証明書を選択し、適切なエイリアス (例: confluence) を付与して、信頼済みであることを確認します。
    1. 次のようなエラーが表示される可能性があります。 
    2. これが発生した場合、[OK] をクリックして証明書を信頼済みとして許可します。
  10. キーストアをディスクに保存します。
  11. Jira を再起動します。
  12. ホストに接続できることをテストします。

コマンド ラインを使用したインストール

  1. 証明書を取得する (以下のコマンドのgoogle.comを JIRA が接続しようとしているサーバーの FQDN に置き換えます) 。
    対象サーバーが Unix の場合:

    openssl s_client -connect google.com:443 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > public.crt

    Windows の場合:

    openssl s_client -connect google.com:443 < NUL | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' > public.crt

    上記コマンドは、動作環境にインストールされた Windows 対応 Sed OpenSSL のみで実行出来ます。(info)どちらもインストールしていない、またはインストールする予定がない場合は、以下の使用説明書を別対策としてお使い下さい。以下のコマンドを発行します。

    openssl s_client -connect google.com:443

    出力を public.cert. というファイルに保存します。public.cert ファイルを編集し、BEGIN CERTIFCATEEND CERTIFICATE の間の内容だけを含むようにします。編集後は次のようになります。

    -----BEGIN CERTIFICATE-----
    < Certificate content as fetched by the command line. 
    Don't change this content, only remove what is before 
    and after the BEGIN CERTIFICATE and END CERTIFICATE. 
    That's what your Sed command is doing for you :-) >
    -----END CERTIFICATE-----
  2. 証明書をインポートします。

    <JAVA_HOME>/keytool -import -alias <server_name> -keystore <JAVA_HOME>/lib/security/cacerts -file public.crt

 

他のキーストアの場所

Java は通常 $JAVA_HOME/jre/lib/security/cacerts にあるシステムレベルのキーストアを使用しますが、-Djavax.net.ssl.trustStore=/path/to/keystore のパラメータを指定することで、異なるキーストアを使用できます。2/path/to/keystore" の部分を、使用するキーストアの絶対パスに置き換えます。

ただし、この設定は推奨されません。これは、Java にカスタム キーストア (例: 自己署名証明書を含むもの) を使うように指定すると、 Java は $JAVA_HOME/jre/lib/security/cacerts に含まれる署名認証局のルート証明書へのアクセスや、認証局が署名したほとんどの SSL サイトへのアクセスを行えなくなるためです。代わりに、新しい証明書 (自己署名証明書など) をシステムレベルのキーストア (上記) に追加することをおすすめします。

デバッグ

次のような問題が発生する場合があります。

  • 証明書が正しくないキーストアにインストールされている。
  • 接続しようとしている SSL サービスの証明書がキーストアに含まれていない。
参考情報
Last modified on Mar 26, 2018

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.