Enabling HTTPS on FlexDeploy (Tomcat)
Tomcat by default listens on http port 8000. Follow these instructions to change Tomcat to listen on an https port.
Stop the Tomcat server.
<FlexDeploy Home>/StopFlexDeploy.sh
Â
There are a few different ways that customers can get certificates.
Â
Create a Java Key Store to hold your SSL Certificate. You will need to update location to JDK, alias, and give appropriate path for the keystore location. Make sure it is NOT in the apache-tomcat-flexdeploy folder. The apache-tomcat-flexdeploy folder will be cleaned up with each upgrade, so it is important not to place all supporting files in the flexdeploy home folder or another subfolder instead. This example uses /home/oracle for the location.
/u01/java/jdk8/bin/keytool -genkey -alias mykeystorealias -keyalg RSA -keystore /home/oracle/flexdeploy.keystore
Â
Import your SSL certificate. You will need to adjust the JDK location, the keystore name, alias name, and the certificate file name.
When you are importing the SSL certificate, the certificate alias must be different than the keystore alias.
Otherwise you will see the error:
keytool error: java.lang.Exception: Public keys in reply and keystore don’t match
/u01/java/jdk8/bin/keytool -import -alias myalias -file mycert.cer -keystore /home/oracle/flexdeploy.keystore
To generate a self-signed certificate and import into the keystore, issue the following command, adjusting the paths and parameters as necessary.
Â
Edit <FlexDeploy Home>/apache-tomcat-flexdeploy/conf/server.xml. Modify the HTTP connector that is listening on port 80 as follows to listen on some port (not 443). Be sure to adjust keystore file path.
Â
In case the certificate is shared in .pfx format, you can use it as is
Or, you can convert it to jks format using below command
On Unix, privileged ports (less than 1024) cannot be opened by a non-root user. The solution is to forward traffic from 443 to the port used above (8443). As root, update iptable rule to redirect the traffic from 443 to 8443.
Also saving iptables will ensure the setting stays after a unix server restart.
To view the rule after:
You should see:
in the output of the command
Start the Tomcat server.
Â
Test in browser.
Â
New to certificates and the keytool utility?
Reference the Tomcat documentation for this.
Â
- style