Base 64 encoding
We don't recommend Base64 encoding in production for securing secrets because it doesn't provide encryption, and therefore cannot guarantee sufficient data protection.
To add extra security to your Confluence site, you can encrypt the database password that is stored in the confluence.cfg.xml file.
For this method, we'll use Base64Cipher, which is a way to achieve simple obfuscation of the database password.
Step 1. Encrypt the password
To encrypt the database password:
- Go to
<install-directory>/bin
. Run the following command to encrypt your password.
java -cp "./*" com.atlassian.db.config.password.tools.CipherTool
Step 2. Add the encrypted password to the properties file
To add the encrypted password:
- Back up the
<home-directory>/confluence.cfg.xml
file. Move the backup to a safe place outside of your instance. In the
confluence.cfg.xml
file, replace thehibernate.connection.password
property with the password generated by the CLI. Also, specify thejdbc.password.decrypter.classname
property. For example:<jdbc.password.decrypter.classname>com.atlassian.db.config.password.ciphers.base64.Base64Cipher</jdbc.password.decrypter.classname> <hibernate.connection.password>your-obfuscated-password</hibernate.connection.password>
- Restart Confluence.
Decrypt the password
To decrypt the password, extend the command with the -m decrypt
parameter:
java -cp "./*" com.atlassian.db.config.password.tools.CipherTool -m decrypt
When asked for a password, provide the encrypted one from your confluence.cfg.xml
file.