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. Open a command prompt and go to the <PRODUCT_HOME>/bin directory, where we stored the ciphertool.sh script is stored. 

  2. Run the ciphertool.sh script using the command prompt as shown below:

    Code Block
    ./ciphertool.sh -Dconfigure
    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.

  3. When the above command is executed, the following message is prompted:  "[Please Enter Primary KeyStore Password of Carbon Server : ]". Enter the keystore password (which is "wso2carbon" for the default keystore). 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 secret-conf.properties file from the <PRODUCT_HOME>/repository/conf/security/ folder and see that the default configurations are changed.

...

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 store 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.