If you use self-signed certificates

このページの内容

お困りですか?

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

コミュニティに質問

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

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

If you're on a Bitbucket version 8.8 or above, you can configure your webhook to skip certificate verification.

If you're on a Bitbucket version lower than 8.8, in order to trust a self-signed certificate, the public certificate need to be imported in the Java keystore that Bitbucket Data Center uses. In this example, it is *.atlassian.com, and we cover how to install it below.

If you're unable to install Portecle on the server or prefer the command line please see our Command Line Installation section below.

Obtain and import the endpoint's public certificate

  1. Download and install the Portecle app onto the server that runs Bitbucket.
    (warning) This is a third-party application and not supported by Atlassian.
  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. Select the Examine menu and then click Examine SSL/TLS Connection:
  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. Restart Bitbucket.
  12. ホストに接続できることをテストします。 

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

  1. Fetch the certificate, replacing google.com with the FQDN of the server Bitbucket is attempting to connect to:
    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) The command above will only be executed if you have Sed for Windows as well as  OpenSSL installed on your environment. If you don't have Sed or OpenSSL or you don't want to install it, use the instructions below as an alternative. Issue the following command:

    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 年 2 月 7 日

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

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