基本的な暗号化

データベース パスワードの暗号化

このページの内容

お困りですか?

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

コミュニティに質問

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.

この方法ではデータベース パスワードのシンプルな難読化を実現する手段である、Base64 暗号化形式を使用します。

ステップ 1. パスワードを暗号化する

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

  2. 次のコマンドを実行してパスワードを暗号化します。

java -cp "./*" com.atlassian.db.config.password.tools.CipherTool
See optional arguments
  • -- silent -s: ログの記録を最小限に制限します。

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

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

  • -- password -p: プレーンテキスト パスワード。省略した場合、入力を求められます。パスワードが履歴に保存されないように、このパラメーターを省略することをお勧めします。

サンプル出力...
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.

ステップ 2. 暗号化されたパスワードをプロパティ ファイルに追加する

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

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

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