Encrypting passwords in server.xml

To add extra security to your Bamboo instance, you can encrypt passwords to configure Connectors in the Tomcat’s server.xml file.

Before you begin

This solution is an obfuscation that can be used to secure information such as passphrases used by Bamboo to access its local keystores and other secrets. This doesn’t assure real security. For example, though stored locally using an encrypted format, an Apache Reverse Proxy will send the proxy secret in clear-text to Bamboo when using the AJP protocol. An attacker could act like Bamboo to obtain the password.

To improve security, use HTTPS and secure the server where Bamboo resides.

Bamboo provides the following protocols that extend Tomcat protocols with support for password encryption.

Show me available protocols...
Bamboo protocolTomcat protocol on which Bamboo protocol is basedAttributes for which password encryption is supported
com.atlassian.bamboo.tomcat.utils.Http11NioProtocolWithPasswordEncryption



Http11NioProtocol
  • KeystorePass
  • KeyPass
  • SSLPassword
  • TruststorePass
com.atlassian.bamboo.tomcat.utils.Http11Nio2ProtocolWithPasswordEncryption
Http11Nio2Protocol
  • KeystorePass
  • KeyPass
  • SSLPassword
  • TruststorePass
com.atlassian.bamboo.tomcat.utils.Http11AprProtocolWithPasswordEncryption
Http11AprProtocol
  • KeystorePass
  • KeyPass
  • SSLPassword
  • TruststorePass
com.atlassian.bamboo.tomcat.utils.AjpNioProtocolWithPasswordEncryption
AjpNioProtocol
  • secret
com.atlassian.bamboo.tomcat.utils.AjpNio2ProtocolWithPasswordEncryption
AjpNio2Protocol
  • secret
com.atlassian.bamboo.tomcat.utils.AjpAprProtocolWithPasswordEncryption
AjpAprProtocol
  • secret

Encrypting a single password

  1. Go to <Bamboo-installation-directory>/lib.
  2. Run the following command:

    java -jar atlassian-bamboo-tomcat-utils-<your bamboo version>.jar
  3. Enter your password when prompted.

    The encryption tool will generate two files: encryptedPassword and encryptionKey. Move those files to a safe location. You can also rename the files if you want.


Encrypting multiple passwords for one Connector

If you want to encrypt more than one password for a single Connector, you must use the same encryption key for all passwords. After you encrypt you first password, use the generated encryptionKey to encrypt the subsequent password by passing path to the key to the encryption tool:

java -jar atlassian-bamboo-tomcat-utils-*.jar /path/to/encryptionKey

The encryption tool will generate only the encryptedPassword file.


Using encrypted passwords in Connector configuration

To use encrypted passwords in Connector configuration, you need to set up the following properties:

  • protocol - use on of the Bamboo protocols described above

  • bambooEncryptionKey - specify a path to the encryptionKey file

Then you can use path to a proper encryptedPassword file in place of plain text password in the Connector configuration.

For example, configuration of a Http11Nio2 Connector with encrypted keystore and key passwords might look similarly to this:

<Connector
    protocol="com.atlassian.bamboo.tomcat.utils.Http11Nio2ProtocolWithPasswordEncryption"
    port="8443"

    (...)

    keystoreFile="/var/secrets/keystore/keystore"
    keystorePass="/var/secrets/keystore/encryptedKeystorePass"
    keyPass="/var/secrets/keystore/encryptedKeyPass"

    bambooEncryptionKey="/var/secrets/encryptionKey"
/>

Note that only one bambooEncryptionKey is specified, and both keystorePass and keyPass had to be encrypted with the same key.



Last modified on Nov 15, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.