This documentation is for WSO2 Carbon 4.4.0. View documentation for the latest release.
Page Comparison - Encrypting Passwords with Cipher Tool (v.22 vs v.23) - Carbon 4.4.0 - WSO2 Documentation
Due to a known issue do not use JDK1.8.0_151 with WSO2 products. Use JDK 1.8.0_144 until JDK 1.8.0_162-ea is released.

Versions Compared

Key

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

...

  1. In any WSO2 product that is based on Carbon 4.4.0, you can install the Cipher Tool feature from the WSO2 feature repository. See the related topics for instructions on installing featuresis installed by default.
  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, cipher-text.properties and cipher-tool.properties files should already include the most common passwords that require encryption. For example, see the default files that are 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
    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]

    If required, you can edit the information in these files. That is, if there are other passwords from configuration files that you want to encrypt, you can add the details to these files. For example, in WSO2 Storage Server, you will want to configure the "root" password in the rss-config.xml file. 

    • Add the following to the cipher-tool.properties file:

      Code Block
      #rss-config.xml passwords
      #RSSConfiguration.DEFAULT.WSO2RSS1.Password=rss-config.xml//RSSConfiguration/Environments/Environment[Name='DEFAULT']/RSSInstances/RSSInstance[Name='WSO2RSS1']/DataSourceConfiguration/Definition/Password,true
    • Add the following to the cipher-text.properties file:

      Code Block
      #rss-config.xml passwords
      #RSSConfiguration.DEFAULT.WSO2RSS1.Password=[root]

...

  1. Open a command prompt and go to the <PRODUCT_HOME>/bin directory, where we stored the ciphertool.sh script. Run  Run the ciphertool.sh script using one of the command prompt as shown belowfollowing commands:

    • Use the command given below to simply execute the script. You will be required to provide the keystore password (for authentication) in a later step.

      Code Block
      ./ciphertool.sh -Dconfigure
    • Use the command given below if you want to provide the keystore password as you run the script. The default keystore password is "wso2carbon".

      Code Block
      ./ciphertool.sh -Dconfigure -Dpassword=wso2carbon
    Note

    The Cipher Tool reads the alias values and their corresponding plain text passwords from the cipher-text.properties file. Shown below is an example of an alias and the corresponding plain text password (in square brackets):

    Code Block
    UserManager.AdminUser.Password=[admin]

    If a password is not specified in the cipher-text.properties file for an alias, the user needs to provide it through the command-line. Check whether the alias is a known password alias in Carbon configurations. If the tool modifies the configuration element and file, you must replace the configuration element with the alias name. Define a Secret Callback in the configuration file and add proper name spaces for defining the Secure Vault.

  2. When the above command is executed, the following message is promptedThis step is required only if you did not provide the keystore password in step 1. The following message will be prompted, requesting for the keystore password:  "[Please Enter Primary KeyStore Password of Carbon Server : ]". Enter the keystore password (which is "wso2carbon" for the default keystore). If  

  3. If the script execution completed successfully, you will see the following message: "Secret Configurations are written to the property file successfully".

  4. Now, to verify the password encryption: 
    • Open the cipher-text.properties file and see that the plain text passwords are replaced by a cipher value.
    • Open the relevant configuration files (e.g., rss-config.xml file) and see that the passwords are encrypted. 

    • Open the secret-conf.properties file stored in the <PRODUCT_HOME>/repository/conf/security/ folder and see that the default configurations are changed.

...