Page History
...
The first step is to update the
cipher-tool.properties
file and thecipher-text.properties
file with information of the passwords that you want to encrypt.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 thecipher-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. If required, you can add more passwords using the following format:
<alias>=<file_name>//<xpath>,<true/false>
. Note that the <alias> value should correspond to the value that is hard coded in the respective Carbon component. For example, if you want to encrypt a user store connection password in the user-mgt.xml file, the following should be added to thecipher-too
l.properties
file:Code Block UserManager.Configuration.Property.ConnectionPassword=repository/conf/user-mgt.xml//UserManager/Realm/UserStoreManager/org.wso2.carbon.user.core.ldap.ActiveDirectoryUserStoreManager/ConnectionPassword,false
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 thecipher-tool.properties
file:Code Block UserManager.AdminUser.Password=[admin]
Open a command prompt and go to the
<PRODUCT_HOME>/bin
directory, where the cipher tool scripts (for Windows and Linux) are stored.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
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 thecipher-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.- 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.
...