Encrypting Database Connection Information

This chapter explains how to encrypt the database connection information in the 3RABBITZ_HOME/tomcat/conf/server.xml file.

Encrypting the Connection Information in the Console

  1. Open the Console.

  2. Run the following command.

encrypt-db-info -url jdbc:h2:h2/database; -username USERNAME -password PASSWORD

The -url, -username, and -password options are the attribute values of the Resource tag in the 3RABBITZ_HOME/tomcat/conf/server.xml file.

To change the key used for encryption, set 3rabbitz.key in the startup script options. For details, see Setting Startup Script Options.

Editing the server.xml File

  1. Open the 3RABBITZ_HOME/tomcat/conf/server.xml file.

  2. Edit it as follows.

    • Add the factory attribute to the Resource tag. The value is com.threerabbitz.tomcat.EncryptedDataSourceFactory.

    • Replace url, username, password, and other values of the Resource tag with the encrypted values.

<Resource
    factory="com.threerabbitz.tomcat.EncryptedDataSourceFactory"
    name="jdbc/Base" auth="Container"
    type="javax.sql.DataSource" maxTotal="100"
    maxIdle="30"
    maxWaitMillis="10000"
    username="fb2bd8d08a621ac930e1c48437a1a192"
    password="fb2bd8d08a621ac930e1c48437a1a192"
    driverClassName="org.apache.derby.jdbc.EmbeddedDriver"
    url="5b8b7503ea5ac9e8ad889c9f9010c8ca550efbf0f43a9a0220af47252fec226f" />

You must encrypt all of url, username, password. You cannot encrypt only some of them.

To check the encrypted database connection information, enter the following command in the Console.

get-encrypted-db-info

Restarting ManualWorks

Restart ManualWorks.