This documentation is for WSO2 Carbon 4.4.3. View documentation for the latest release.
Page Comparison - Encrypting Passwords with Cipher Tool (v.21 vs v.22) - Carbon 4.4.3 - WSO2 Documentation

Versions Compared

Key

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

...

  1. The first step is to update the cipher-tool.properties file and the cipher-text.properties file with information of the passwords that you want to encrypt. 

    1. Open the cipher-tool.properties file stored in the <PRODUCT_HOME>/repository/conf/security folder. The file should contain information about the files in which the passwords (that require encryption) are located as shown below:

      Code Block
      <alias>=<file_name>//<xpath>,<true/false>

      For example, if you want to encrypt the admin user password in the user-mgt.xml file, the following should be added to the cipher-tool.properties file:

      Code Block
      UserManager.AdminUser.Password=repository/conf/user-mgt.xml//UserManager/Realm/Configuration/AdminUser/Password,false
      Info

      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' indicating 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. 

    2. Open the cipher-text.properties file stored in the <PRODUCT_HOME>/repository/conf/security folder. This file should contain the secret alias names and the corresponding plain text passwords (enclosed within square brackets) as shown below.

      Code Block
      <alias>=[plain_text_password]

      For example, if you want to encrypt the admin user password in the user-mgt.xml file, the following should be added to the cipher-tool.properties file:

      Code Block
      UserManager.AdminUser.Password=[admin]
    Info

    By default, the cipher-tool.properties and cipher-text.properties files that are shipped with your product pack will contain information on the most common passwords that require encryption. If a required password is missing in the default files, you can add them manually. For example, if you want to encrypt the password that is used to connect to an LDAP user store (configured in the user-mgt.xml file), add the following: 

    1. Add a new entry to the cipher-tool.properties file as shown below. Note that the <alias> value should be the same value that is hard coded in the relevant Carbon component. In this example (LDAP user store connection password), there are two possible alias values you can use as shown below.

      • Using the UserStoreManager.Property.ConnectionPassword alias:

        Code Block
        UserStoreManager.Property.ConnectionPassword=user-mgt.xml//UserManager/Realm/UserStoreManager/Property[@name='ConnectionPassword'],true
      • Using the UserManager.Configuration.Property.ConnectionPassword alias:

        Code Block
        UserManager.Configuration.Property.ConnectionPassword=user-mgt.xml//UserManager/Realm/UserStoreManager/Property[@name='ConnectionPassword'],true
    2. Add a new entry to the cipher-text.properties file corresponding to the new entry in the cipher-tool.properties file:

      Code Block
      //Use the alias corresponding to the value in the cipher-tool.properties file.
      #UserStoreManager.Property.ConnectionPassword=[password]
      #UserManager.Configuraton.Property.ConnectionPassword=[password]
    3. Save the information.

  2. Open a command prompt and go to the <PRODUCT_HOME>/bin directory, where the cipher tool scripts (for Windows and Linux) are stored. 

  3. Execute the cipher tool script from the command prompt using the command relevant to your OS: 

    • On Linux: ./ciphertool.sh -Dconfigure

    • On Windows: ./ciphertool.bat -Dconfigure

  4. The following message will be prompted:  "[Please Enter Primary KeyStore Password of Carbon Server : ]". Enter the keystore password (which is "wso2carbon" for the default keystore) and proceed. If the script execution is successful, you will see the following message: "Secret Configurations are written to the property file successfully".

    Note

    If you are using the cipher tool for the first time, the-Dconfigure command will first initialize the tool for your product. The tool will then start encrypting the plain text passwords you specified in the cipher-text.properties file.

    Shown below is an example of an alias and the corresponding plain text password (in square brackets) in the cipher-text.properties file:

    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 namespaces for defining the Secure Vault.

  5. 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 secret-conf.properties file from the <PRODUCT_HOME>/repository/conf/security/ folder and see that the default configurations are changed.

...