Foren

How to encrypt the database password in portal-ext.properties

Liferay User, geändert vor 6 Jahren.

How to encrypt the database password in portal-ext.properties

New Member Beiträge: 15 Beitrittsdatum: 05.01.15 Neueste Beiträge
Hi All,
I have provided database connection string in portal-ext.properties and using service builder to fetch the data from database in liferay.
jdbc.*.driverClassName=driver
jdbc.*.url=connectionurl
jdbc.*.username=dbusername
jdbc.*.password=dbpassword

But I do not want to specify the password in the property file.
Either I need to encrypt the password in portal-ext.properties file and use it , or I need to read the connection string from the custom property file (where the password is encrypted) and use Custom datasource class.
I have created a custom datasource java class which extends DriverManagerDataSource and this class will ecrypt/decrypt the database password while connecting. But I am not sure how will I configure this class as a datasource in ext-spring,xml.

ext-spring.xml
<bean id="customDataSource" class="org.springframework.jdbc.datasource.LazyConnectionDataSourceProxy">
<property name="targetDataSource"> <bean class="com.liferay.portal.dao.jdbc.util.DataSourceFactoryBean">
<property name="propertyPrefix" value="jdbc.*." /> </bean> </property>
</bean>

Please suggest


Thanks
thumbnail
Samuel Kong, geändert vor 6 Jahren.

RE: How to encrypt the database password in portal-ext.properties

Liferay Legend Beiträge: 1902 Beitrittsdatum: 10.03.08 Neueste Beiträge
Password encryption in portal-ext.properties is not supported. If you don't want to enter your database info in portal-ext.properties, you can use your application server's built in mechanism to manage the database connection. Please refer to Installing Liferay Portal Manually