Can I encrypt / hide database password in portal-ext.properties and tomcat server.xml?
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
Legacy Article
You are viewing an article from our legacy "FastTrack"
publication program, made available for informational purposes. Articles
in this program were published without a requirement for independent
editing or verification and are provided"as is" without
guarantee.
Before using any information from this article, independently verify its
suitability for your situation and project.
Issue
- Is there any way to hide database password in portal-ext.properties and in tomcat server.xml?
Environment
Resolution
- Recommendation:
-
Use environment variables to pass the database password:
One of the most secure way to initialize those secret environment variables would be to use a tool like Hashicorp Envconsul: https://github.com/hashicorp/envconsul
We made a demo during a Liferay User Group meeting in France where we used Envconsul in a docker environment: https://github.com/lgdd/liferay-vault-envconsul
-
Set up a JNDI connection, since it offloads the password handling to the app server. This means you will no longer need a clear-text password in the portal-ext.properties file.
- Encrypting database password in portal-ext.properties is not an available feature in DXP for now.
- Alternatives to hide database password in portal-ext.properties
- Encrypting database password in tomcat's server.xml is not an available feature. See their Official FAQ for reasoning and alternatives.
Did this article resolve your issue ?