Junaid Shirwani
Junaid Shirwani

Reputation: 336

Configuring SSL on tomcat version 8.0.28

Although this question has been asked before but not answered and i have some of my own observations as well.

I followed the tutorial for configuring SSL on tomcat 8 but to no avail.

I generated a key with the keytool -keygen command , then setup the connector with keystoreFile pointing to the keystore i created.

I followed these steps in tomcat 7 and it works perfectly fine.

But when i do the same for tomcat version 8, I get a timeout error .

Is there something else i have to configure in order to achieve this or am i doing something wrong

The steps i followed for tomcat v7

1-generate a key with keytool. keytool is provided by java. -goto java bin in command prompt -type this command

"keytool -genkey -alias tomcat -keyalg RSA
         -keystore <your_keystore_filename>"

-this will create a keystore file in java bin folder.

2-using this file configure tomcat in server.xml . -find ssl connector tag -change it to the follwing

"<Connector port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol"  SSLEnabled="true"
          maxThreads="150" scheme="https" secure="true"
          clientAuth="false" sslProtocol="TLS"
       keystoreFile="F:/Software Backup/ApacheTomcat/ApacheTomcat8.0.28/apache-tomcat-8.0.28-windows-x64/apache-tomcat-8.0.28/conf/theKey" 
       keystorePass="changeit" />"

-keystoreFile is the path to where the key created in the first step is located. -keystorePass is the pass you will set when creating the key.

-now when you access "https//localhost:8443" ssl should have been configured.

It just doenst work on tomcat 8.

EDIT:Even this solution does not work for me.

SSL in Tomcat 8: server & client JKS + client public cer

Created another key named server.jks with keytool. Then configured port 8443 in the following way .

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
       maxThreads="150" scheme="https" secure="true"
       clientAuth="false" sslProtocol="TLS" 
       keystoreFile="F:/Software Backup/ApacheTomcat/ApacheTomcat8.0.28/apache-tomcat-8.0.28-windows-x64/apache-tomcat-8.0.28/conf/server.jks"
       keystorePass="changeit" />

port 8443 is listening when i checked with netstat

netstat -na | find "8443"

Upvotes: 0

Views: 1315

Answers (1)

Mohamed NAOUALI
Mohamed NAOUALI

Reputation: 2132

you just need to update your protocol to protocol="org.apache.coyote.http11.Http11NioProtocoland update your server.xml file like this:

<Connector SSLEnabled="true" clientAuth="false" keystoreFile="${user.home}/server.jks" keystorePass="changeit" maxThreads="150" port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="https" secure="true" sslProtocol="TLS"/>

Upvotes: 0

Related Questions