After you have created a new keystore and updated the client-truststore.jks
file, you must update a few configuration files in order to make it work. Note that keystores are used for multiple functions in WSO2 products, which includes securing the servlet transport, encrypting confidential information in configuration files etc. Therefore, you must update the relevant configuration files with the relevant keystore information. For example, you may have separate keystores for the purpose of encrypting passwords in configuration files, and for securing the servlet transport.
The wso2carbon.jks
kestore file, which is shipped with all WSO2 products, is used as the default keystore for all functions. However, in a production environment, it is recommended to create new keystores with keys and certificates.
If you want an easy way to locate all the configuration files that have references to keystores, you can use the grep
command as follows:
- Open a command prompt and go to the
<PRODUCT_HOME>/repository/conf/
directory where your product stores all configuration files. - Execute the following command:
grep -nr ".jks"
.
You will now get a list of configuration files and the list of keystore files that are referred to in each file. See the example below.
./axis2/axis2.xml:260: <Location>repository/resources/security/wso2carbon.jks</Location> ./axis2/axis2.xml:431: <Location>repository/resources/security/wso2carbon.jks</Location> ./carbon.xml:316: <Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location> ./carbon.xml:332: <Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location> ./identity.xml:180: <Location>${carbon.home}/repository/resources/security/wso2carbon.jks</Location> ./security/secret-conf.properties:21:#keystore.identity.location=repository/resources/security/wso2carbon.jks
You can update the relevant configuration files as follows:
Configuring the primary keystore
The primary keystore mainly stores the keys for encrypting administrator passwords as well as other confidential information. The Keystore
element in the carbon.xml
file, stored in the <PRODUCT_HOME>/repository/conf/
directory should be updated with details of the primary keystore. The default configuration is shown below.
<KeyStore> <Location>${carbon.home}/resources/security/wso2carbon.jks</Location> <Type>JKS</Type> <Password>wso2carbon</Password> <KeyAlias>wso2carbon</KeyAlias> <KeyPassword>wso2carbon</KeyPassword> </KeyStore> <TrustStore> <!-- trust-store file location --> <Location>${carbon.home}/repository/resources/security/client-truststore.jks</Location> <!-- trust-store type (JKS/PKCS12 etc.) --> <Type>JKS</Type> <!-- trust-store password --> <Password>wso2carbon</Password> </TrustStore>
You need to add in the following information:
<jks store password>
- <jks alias>
<jks store password(same as the key password)>
Configuring Secure Vault for password encryption
All passwords in configuration files are made secure by encrypting them using cipher text. When a password is encrypted, a keystore is required for creating the decryption crypto to resolve encrypted secret values. The secret-conf.properties
file, stored in the <PRODUCT_HOME>/repository/conf/security/
directory is used for this purpose. Therefore, you must update this file with the relevant keystore information.
##KeyStores configurations # #keystore.identity.location=repository/resources/security/wso2carbon.jks #keystore.identity.type=JKS #keystore.identity.alias=wso2carbon #keystore.identity.store.password=wso2carbon ##keystore.identity.store.secretProvider=<any implementation of org.apache.synapse.commons.security.secret.SecretCallbackHandler> #keystore.identity.key.password=wso2carbon ##keystore.identity.key.secretProvider=<any implementation of org.apache.synapse.commons.security.secret.SecretCallbackHandler> ##keystore.identity.parameters=enableHostnameVerifier=false;keyStoreCertificateFilePath=/home/esb.cer # #keystore.trust.location=repository/resources/security/client-truststore.jks #keystore.trust.type=JKS #keystore.trust.alias=wso2carbon #keystore.trust.store.password=wso2carbon ##keystore.trust.store.secretProvider=<any implementation of org.apache.synapse.commons.security.secret.SecretCallbackHandler>
Configuring a keystore for SSL connections
The catalina-server.xml
file stored in the <PRODUCT_HOME>/repository/conf/tomcat/
directory should be updated with the keystore used for certifying SSL connections to Carbon servers. Given below is the default configuration in the catalina-server.xml
file, which points to the default keystore in your product.
keystoreFile="${carbon.home}/repository/resources/security/wso2carbon.jks" keystorePass="wso2carbon"
Configuring a keystore for Java permissions
The sec.policy
file stored in the <PRODUCT_HOME>/repository/conf/
directory should be updated with details of the keystore used for enabling Java permissions for your server. The default configuration is shown below.
keystore "file:${user.dir}/repository/resources/security/wso2carbon.jks", "JKS";
Related Topics
- See how keystores are used in WSO2 products.
- Creating new keystores.
- Managing keystores using the management console.