Where: | Is | |
---|---|---|
| Windows command prompt |
|
Windows PowerShell |
| |
Linux |
| |
| The alias for a username or password. The phixflow-secret.xml configuration file refers to the After you enter an alias, the keytool prompts you to enter the corresponding username or password. This is the actual value that the database requires to permit access. | |
<pathToKeystoreFile> | The full path to the keystore file, for example:
| |
<keytype> | Either PKCS12 or JCEKS. |
Tip |
---|
The keytool does not differentiate between the secrets it stores so it always prompts for a password. Sometimes you will need to enter a username and others a password. The following instructions explain which you need to enter. |
How to Set up a Keystore
Step 1 Create the keystore and the alias for the database username
1.1 Run the -importpass
command. In <keyAlias> specify the alias username for the PhixFlow database, for example phixflow-database-user
.
Windows:
Code Block |
---|
"%JAVA_HOME%\bin\keytool" -importpass -alias phixflow-database-user -keystore C:\secure\hidden.jks -storetype PKCS12 |
Linux:
Code Block |
---|
$JAVA_HOME/bin/keytool -importpass -alias phixflow-database-user -keystore /opt/secure/hidden.jks -storetype PKCS12 |
1.2 When prompted, enter the password you want to use for the keystore file, then re-enter to confirm it.
1.3 When prompted for the password or secret to be stored, enter the actual username for the PhixFlow database, for example phixflow
.
Step 2 Add the database password and alias to the keystore file
2.1. Repeat the -importpass
command. In <keyAlias> specify the alias password for the PhixFlow database, for example phixflow-database-password
.
Windows:
Code Block |
---|
"%JAVA_HOME%\bin\keytool" -importpass -alias phixflow-database-password -keystore C:\secure\hidden.jks -storetype PKCS12 |
Linux:
Code Block |
---|
$JAVA_HOME/bin/keytool -importpass -alias phixflow-database-password -keystore C:\secure\hidden.jks -storetype PKCS12 |
2.2 When prompted, enter the password for the keystore file. This is the same password you set in step 1.2. This time the password opens the keystore.
2.3 When prompted for the password or secret to be stored, enter the actual password for the PhixFlow database.
Step 3 Configure phixflow-datasource.xml
Edit phixflow-datasource.xml to add the aliases for the PhixFlow database username and password. For example:
Code Block |
---|
<property name="username"> <value>phixflow-database-user</value> </property> <property name="password"> <value>phixflow-database-password</value> </property> |
Step 4 Set the Environment Variable
Note |
---|
We recommend that you use an environment variable for the keystore password, as it provides additional security. |
Create an environment variable with the form <variable-name>:
<keystore-password>
In Windows | In Linux | |
---|---|---|
<variable-name> | In Windows: In the environment variable, specify any variable name you choose. | Use the For information about how to set environment variables in Linux, see: |
<keystore-password> | Specify the password for the keystore. |
Warning |
---|
Never add the keystore password to the profile for the Tomcat user. |
Step 5 Configure phixflow-secret.xml
Copy phixflow-secret.xml.example to phixflow-secret.xml and edit it to set the values as follows:
Required? | Property | Value | Example |
---|---|---|---|
Required | keystoreType | The type of the keystore, either PKCS12 or JCEKS |
|
Required | keystoreFile | The path to the keystore. |
|
Either (recommended) | keystorePassEnvironmentVariable | The name of the environment variable. Use |
|
Or | keystorePass | The password for the keystore. Use |
|
Warning |
---|
On startup, PhixFlow checks that there is one password mechanism, either |
Understanding How PhixFlow Uses A Keystore
When PhixFlow is running, it provides the account credentials to its database as follows:
- phixflow-datasource.xml stores alias credentials for the database. It requests actual credentials from phixflow-secret.xml.
- phixflow-secret.xml asks the keystore for the actual credentials.
- The keystore password is configured as an environment variable This file stores the location of the keystore file and optionally its password (2a in the diagram below).
- Alternatively, phixflow-secret.xml stores the location of the keystore file and optionally its password (2b in the diagram below)
- The keystore file returns the actual account credentials to phixflow-secret
- which, in turn, passes the actual credentials to phixflow-datasource.xml.
- phixflow-datasource.xml then uses the actual credentials to log into the database, so that PhixFlow can update it.
This is shown in the diagram below.
How PhixFlow authenticates to its database using a keystore
Details used in the diagram | ||
---|---|---|
Keystore file name | hidden.jks | |
Keystore password | storepw | |
Environment variable name | KEY_PASS | |
Environment variable value (the keystore password) | storepw | |
PhixFlow database credentials | Username | Password |
Actual |
| P*59word |
Alias | phixflow-database-user | phixflow-database-password |