基本的な暗号化

このページの内容

お困りですか?

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

コミュニティに質問

Basic encryption is one of the three ways to encrypt database passwords in Bitbucket Data Center and Server. See also, Advanced encryption and Custom encryption.

For this method, we'll use Base64Cipher, which is a way to achieve simple obfuscation of the database password.

Step 1. Encrypt the password

  1. <Bitbucket-installation-directory>/tools/atlassian-password に移動します。

  2. Run the following command to encrypt your password:

java -cp "./*" com.atlassian.db.config.password.tools.CipherTool
See optional arguments
  • -- silent -s: limits logging to a minimum

  • -- help -h: すべてのパラメータを含むヘルプ メッセージを出力します

  • -- mode -m: パスワード処理方法を暗号化または 復号化として定義します。省略した場合は "encrypt" が使用されます

  • -- password -p: plain text password. If omitted, you'll be asked to enter it. We recommend that you omit this parameter so that your password is not stored in the history.

サンプル出力...
main DEBUG [db.config.password.DefaultCipherProvider] Initiate cipher provider class: com.atlassian.db.config.password.ciphers.base64.Base64Cipher
main DEBUG [password.ciphers.base64.Base64Cipher] Initiate Base64Cipher
main DEBUG [password.ciphers.base64.Base64Cipher] Encrypting data...
main DEBUG [password.ciphers.base64.Base64Cipher] Encryption done. Success!
Success!
For Jira, put the following lines in database config xml file:

<atlassian-password-cipher-provider>com.atlassian.db.config.password.ciphers.base64.Base64Cipher</atlassian-password-cipher-provider>
<password>ZGZnZGZn</password>

and restart the instance.

For Bitbucket, set the following properties in bitbucket.properties:

jdbc.password.decrypter.classname=com.atlassian.db.config.password.ciphers.base64.Base64Cipher
jdbc.password=ZGZnZGZn

and restart the instance.

Step 2. Add the encrypted password to the properties file

  1. Go to the Bitbucket home directory and back up the bitbucket.properties file. Move the backup to a safe place outside of your instance.

  2. In the bitbucket.properties file, replace the jdbc.password property with the password generated by CLI. Also, specify the jdbc.password.decrypter.classname property. For example:

    jdbc.password.decrypter.classname=com.atlassian.db.config.password.ciphers.base64.Base64Cipher
    jdbc.password=put-the-obfuscated-password-generated-by-the-cli-tool-here
  3. Bitbucket を再起動します。

パスワードの復号化

パスワードを復号化するには、-m decrypt パラメータを使用してコマンドを拡張します。

java -cp "./*" com.atlassian.db.config.password.tools.CipherTool -m decrypt

When asked for a password, provide the encrypted one from your bitbucket.properties file.

トラブルシューティング

Bitbucket fails to start after enabling database password encryption...

This means that Bitbucket couldn't connect to the database to access your configuration, most likely because of an error with decrypting your password.

To solve this problem, open <Bitbucket_home_directory>/log/atlassian-bitbucket.log, and check for DataSourcePasswordDecryptionException. For example:

com.atlassian.stash.internal.jdbc.DataSourcePasswordDecryptionException: java.lang.IllegalArgumentException: Illegal base64 character 25

The exception contains details about the error. If the error is java.lang.IllegalArgumentException, you will need to encrypt the password again.

'A fatal error has occurred' message displayed after restarting Bitbucket...

To investigate this problem, open <Bitbucket_home_directory>/log/atlassian-bitbucket.log, and check for JdbcSQLExceptions. The messages should be pretty clear as to what went wrong.

以下のメッセージが表示される場合があります。

 Wrong user name or password [28000-176]

This means that Bitbucket decrypted the password successfully, but the password itself is incorrect. You can verify that by completing these steps:

  1. Open the bitbucket.properties file, and copy the encrypted password.

  2. Decrypt the password.

  3. Check if the decrypted password is the same as the one in your backup bitbucket.properties file.

Disable database password encryption and revert changes...

To disable database password encryption, remove the jdbc.password.decrypter.classname property from the bitbucket.properties file, and change the value of jdbc.password to the unencrypted in your backup.

最終更新日 2021 年 6 月 21 日

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

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