Encrypt the database access password

By default, the database access password is not hidden on Payara services.

Below are the steps to follow to hide it.


Windows:


Open a PowerShell prompt and navigate to the Payara bin folder:

cd 'C:\Program Files\Gespage\GespageCore\server\payara5\bin\'
Generic

We must then create an alias for the password (make a note of this alias, as it will be useful later in the procedure!).

.\asadmin create-password-alias MonAliasBDD
Generic

You will then be asked to enter the actual database access password twice.


A domain.password file is then automatically created in C:\Program Files\Gespage\GespageCore\server\payara5\glassfish\domains\domain1\conf\. This file is encrypted.


We must then edit the Gespage domain.xml file, located in C:\Program Files\Gespage\GespageCore\server\payara5\glassfish\domains\domain1\conf\, to enter our alias. I recommend using NotePad++ for ease of use.

At the beginning of the file is the database connection information.

Replace the ‘Password’ property with the name of our alias:


<property name="Password" value="${ALIAS=MonAliasBDD}"></property>
XML

example:



Finally, simply restart the Gespage Application Server service.


Linux:


Open a terminal and navigate to the Payara bin folder:

cd /opt/Gespage/GespageCore/server/payara5/bin/
Generic

We must then create an alias for the password (make a note of this alias, as it will be useful later in the procedure!).

./asadmin create-alias-password MonAliasBDD
Generic

You will then be asked to enter the actual password for accessing the database twice.


A domain.password file is then automatically created in /opt/Gespage/GespageCore/server/payara5/glassfish/domains/domain1/conf/. This file is encrypted.


We must then edit the Gespage domain.xml file using the following command:

sudo vim  /opt/Gespage/GespageCore/server/payara5/glassfish/domains/domain1/conf/domain.xml
Generic

At the beginning of the file is the database connection information.

You must replace the ‘Password’ property with the name of our alias:

<property name="Password" value="${ALIAS=MonAliasBDD}"></property>
XML

example:



Finally, simply restart Gespage using the following command:

sudo systemctl restart gespage-server
Generic


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article