自己署名証明書を使用する場合

このページの内容

お困りですか?

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

コミュニティに質問

アトラシアンの製品はSSLに対応しています。しかし、アトラシアンのサポートはその設定に対して支援は行いません。したがって、アトラシアンは、そのためのサポートの提供を保証できません

  • SSL証明書の変更に際してサポートが必要であれば、証明書の提供元のベンダーに相談してください。
  • If assistance with configuration is required, please raise a question on Atlassian Answers.


In order to trust a self-signed certificate, the public certificate need to be imported in the Java keystore that Bitbucket Data Center and Server uses. In this example, it is *.atlassian.com, and we cover how to install it below.

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

エンドポイントの公開証明書の取得とインポート

  1. Portecle アプリをダウンロードし、Bitbucket を実行するサーバーにインストールします。
    (warning) これはサードパーティ製のアプリケーションであり、アトラシアンのサポート対象外です。
  2. Ensure the <JAVA_HOME> variable is pointing to the same version of Java that Bitbucket uses. 
    (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. [Examine] メニューを選択し、[Examine SSL/TLS Connetcion] をクリックします。
  4. ターゲットとなるシステムの SSL ホストとポートを入力します。
  5. 読み込みが完了されるまで待ちます。完了したら、パブリック証明書を選択し、PEM をクリックします。
  6. 証明書をエクスポートし、保存します。
  7. Go back to the main screen and select the Open an existing keystore from disk option, select cacerts (for example $JAVA_HOME/lib/security/cacerts ) then enter the password (the default is changeit).
  8. [信頼済みの証明書をロードされたキーストアにインポートする] ボタンを選択します。
  9. ステップ 6 で保存した証明書を選択し、適切なエイリアス (例: confluence) を付与して、信頼済みであることを確認します。
    1. 次のようなエラーが表示される可能性があります。 
    2. これが発生した場合、[OK] をクリックして証明書を信頼済みとして許可します。
  10. キーストアをディスクに保存します。
  11. Bitbucket を再起動します。
  12. ホストに接続できることをテストします。 

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

  1. 証明書を取得します (google.comを、Bitbucket が接続しようとしているサーバーの 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
                    

    (info) 上記のコマンドは、環境に Sed for WindowsOpenSSL がインストールされている場合にのみ実行されます。Sed または OpenSSL をインストールしていないか、インストールする予定がない場合、代替手段として以下の手順を利用できます。次のコマンドを発行します。

    openssl s_client -connect google.com:443
                    

    Save the output to a file called  public.cert.  Edit the the public.cert file so it contains only what is between the BEGIN CERTIFCATE and END CERTIFICATElines. This is how your file should look like after you edited it:

    -----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-----
                    
  • 証明書をインポートします。

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

他のキーストアの場所

Java will normally use a system-wide keystore in $JAVA_HOME/jre/lib/security/cacerts, but it is possible to use a different keystore by specifying a parameter, -Djavax.net.ssl.trustStore=/path/to/keystore, where '/path/to/keystore' is the absolute file path of the alternative keystore.

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

デバッグ

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

  • 証明書が正しくないキーストアにインストールされている。
  • 接続しようとしている SSL サービスの証明書がキーストアに含まれていない。
最終更新日: 2023 年 1 月 4 日

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

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