Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The instructions on this page explain how plain text passwords in configuration files can be encrypted using the secure vault implementation that is built into WSO2 products. Note that you can customize the default secure vault configurations in the product by implementing a new secret repository, call back handler etc. Read about the Secure Vault implementation in WSO2 products.

...

  1. In any WSO2 product that is based on Carbon 4.4.0 or a later version, you can install the  the Cipher Tool feature from the WSO2 feature repository. See Installing Features for instructions on how features are installed from the WSO2 feature repositorywill be installed by default.

    Note

    If you are a developer who is building a Carbon product, see the topic on enabling Cipher Tool for password encryption for instructions on how to include the Cipher Tool feature in your product build.

  2. Open the cipher-text.properties file and the cipher-tool.properties file from the <PRODUCT_HOME>/repository/conf/security folder. 
  3. In any WSO2 product that is based on Carbon 4.4.0 or a later version, the following files should be updated with the required information: 
    • The cipher-tool.properties file should contain information about the files in which the passwords (that require encryption) are located. Either the relative path or the absolute path of each file starting from <PRODUCT_HOME> should be given. The last value that follows the file path is set to 'true' or 'false' (which is a boolean value), which indicates whether or note the value to be encrypted is an attribute. 

      By default, the file that is shipped with your product pack will contain information on the most common passwords that require encryption. For example, see the default file that is created for Carbon Kernel:

      Expand
      titleDefault cipher-tool.properties
      Code Block
      # Important: This properties file contains all the aliases to be used in carbon components. If any property need to be secured, you need to add alias name, file name and the xpath as follows:.
      # The value goes as, the <file_name>//<xpath>,<true/false>
      # where <file_name> - is the file (along with the file path) to be secured,
      #       <xpath> - is the xpath to the property value to be secured
      #       <true / false> - This is true if the last parameter in the xpath is parameter (starts with [ and ends with ]) and you want its value to be replaced with "password"
      
      Carbon.Security.KeyStore.Password=repository/conf/carbon.xml//Server/Security/KeyStore/Password,false
      Carbon.Security.KeyStore.KeyPassword=repository/conf/carbon.xml//Server/Security/KeyStore/KeyPassword,false
      Carbon.Security.TrustStore.Password=repository/conf/carbon.xml//Server/Security/TrustStore/Password,false
      UserManager.AdminUser.Password=repository/conf/user-mgt.xml//UserManager/Realm/Configuration/AdminUser/Password,false
      Datasources.WSO2_CARBON_DB.Configuration.Password=repository/conf/datasources/master-datasources.xml//datasources-configuration/datasources/datasource[name='WSO2_CARBON_DB']/definition[@type='RDBMS']/configuration/password,false
      Server.Service.Connector.keystorePass=repository/conf/tomcat/catalina-server.xml//Server/Service/Connector[@keystorePass],true
    • The cipher-text.properties file should contain the secret alias names and the corresponding plain text passwords (enclosed within square brackets). For example, see the default file that is created for Carbon Kernel:

      Expand
      titleDefault cipher-text.properties
      Code Block
      # By default, This file contains the secret alias names and the plain text passwords enclosed with '[]' brackets
      # In Production environments, It is recommend to replace these plain text password by the encrypted values. CipherTool can be used for it.
      Carbon.Security.KeyStore.Password=[wso2carbon]
      Carbon.Security.KeyStore.KeyPassword=[wso2carbon]
      Carbon.Security.TrustStore.Password=[wso2carbon]
      UserManager.AdminUser.Password=[admin]
      Datasources.WSO2_CARBON_DB.Configuration.Password=[wso2carbon]
      Server.Service.Connector.keystorePass=[wso2carbon]

...

Changing encrypted passwords

To change any password which we have encrypted already, follow the below steps:

  1. Be sure to shut down the server.

  2. Open a command prompt and go to the <PRODUCT_HOME>/bin directory, where we have stored the ciphertool.sh script.

  3. Execute the following command:

    Code Block
    ./ciphertool.sh -Dchange
  4. It will prompt for the primary keystore password. Enter the keystore password (which is "wso2carbon" for the default keystore).

  5. The alias values of all the passwords that you encrypted will now be shown in a numbered list. 

  6. The system will then prompt you to select the alias of the password which you want to change. Enter the list number of the password alias.

  7. The system will then prompt you (twice) to enter the new password. Enter your new password.

  8. The password should now be changed and encrypted.