keytool -genkey -alias serverkeys -keyalg RSA -keystore server.keystore -storepass 123456 -keypass 123456 -dname "CN=localhost, OU=MYOU, O=MYORG, L=MYCITY, ST=MYSTATE, C=MY"
By default, GateIn Portal 3.8 is available only through HTTP. This section describes how to enable HTTPS.
If you do not have your own X.509 certificate, you can make a simple certificate using the keytool command:
keytool -genkey -alias serverkeys -keyalg RSA -keystore server.keystore -storepass 123456 -keypass 123456 -dname "CN=localhost, OU=MYOU, O=MYORG, L=MYCITY, ST=MYSTATE, C=MY"
Now, your key is stored in server.keystore.
You need to import your key into the Oracle JDK keystore which is required for running gadget features.
keytool -importkeystore -srckeystore server.keystore -destkeystore $JAVA_HOME/jre/lib/security/cacerts
On OS X cacerts file is located at $JAVA_HOME/lib/security/cacerts.
Since your Oracle JDK keystore has a different password than the one used for the key you created in the first step, you need to change your key password to match the new keystore password. I you have not changed it yet, it is the default JDK trustore pasword: "changeit".
keytool -keypasswd -alias serverkeys --keystore $JAVA_HOME/jre/lib/security/cacerts
In $JBOSS_HOME/standalone/configuration/standalone.xml file, add an HTTPS connector to web subsystem configuration. Change certificate-key-file and password to values appropriate for your keystore - here we assume the keystore password is "changeit":
<subsystem xmlns="urn:jboss:domain:web:1.2" default-virtual-server="default-host" native="false"> ... <connector name="https" protocol="HTTP/1.1" socket-binding="https" scheme="https" secure="true"> <ssl name="https" key-alias="serverkeys" password="changeit" certificate-key-file="${java.home}/jre/lib/security/cacerts"/> </connector> ... </subsystem>
You can now access the portal using HTTPS: https://localhost:8443/portal.
In tomcat/conf/server.xml file, comment the following lines:
<Connector port="8080" protocol="HTTP/1.1" maxThreads="150" connectionTimeout="20000" redirectPort="8443" URIEncoding="UTF-8" emptySessionPath="true"/>
Then uncomment these lines and add the appropriate keystoreFile and keystorePass values:
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" keystoreFile="${java.home}/jre/lib/security/cacerts" keystorePass="changeit" />
Restart GateIn Portal. If your configuration is correct, you can access the portal via HTTPS, usually https://localhost:8443/portal.