LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to configure SSL on Tomcat 5 (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-configure-ssl-on-tomcat-5-a-682640/)

vamsi_k 11-11-2008 11:18 AM

How to configure SSL on Tomcat 5
 
are the below steps correct :


# cd $CATALINA_HOME

# $JAVA_HOME/keytool -genkey -alias tomcat -keyalg RSA -keystore


{ $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA \
-keystore /path/to/my/keystore }

Enter keystore password : changeit

What is your first and last name? [Unknown]:

What is the name of your organizational unit? [Unknown] :

What is the name of your organization? [Unknown]:

What is the name of your City or Locality? [Unknown]:

What is the name of your State or Province? [Unknown]:

What is the two-letter country code for this unit? [Unknown]:

{ its asks the details are correct or not } correct? [no]: yes

Enter key password for (RETURN if same as keystore password): Hit Enter.


Tomcat will assume the password is “changeit” by default so it’s advised to leave it that way. Now let’s tell Tomcat to use the keystore file.


# cd $CATALINA_HOME/conf/

# vi server.xml

3. Look for “<!– Define a SSL HTTP/1.1 Connector on port 8443 –>”. Remove the <!– –> comments indicator and add the keystore info.

<!– Define a SSL HTTP/1.1 Connector on port 8443 –>

<Connector port=”8443” maxHttpHeaderSize=”8192″

maxThreads=”150″ minSpareThreads=”25″ maxSpareThreads=”75″

enableLookups=”false” disableUploadTimeout=”true”

acceptCount=”100″ scheme=”https” secure=”true”

keystoreFile=”/path/to/my/keystore”

clientAuth=”false” sslProtocol=”TLS” />


then

restarting the tomcat

Next

https://localhost:8443

TB0ne 11-11-2008 11:56 AM

Quote:

Originally Posted by vamsi_k (Post 3338448)
are the below steps correct :

# cd $CATALINA_HOME
# $JAVA_HOME/keytool -genkey -alias tomcat -keyalg RSA -keystore

{ $JAVA_HOME/bin/keytool -genkey -alias tomcat -keyalg RSA \
-keystore /path/to/my/keystore }

Enter keystore password : changeit
What is your first and last name? [Unknown]:
What is the name of your organizational unit? [Unknown] :
What is the name of your organization? [Unknown]:
What is the name of your City or Locality? [Unknown]:
What is the name of your State or Province? [Unknown]:
What is the two-letter country code for this unit? [Unknown]:
{ its asks the details are correct or not } correct? [no]: yes

Enter key password for (RETURN if same as keystore password): Hit Enter.

Tomcat will assume the password is “changeit” by default so it’s advised to leave it that way. Now let’s tell Tomcat to use the keystore file.


# cd $CATALINA_HOME/conf/
# vi server.xml
3. Look for “<!– Define a SSL HTTP/1.1 Connector on port 8443 –>”. Remove the <!– –> comments indicator and add the keystore info.
<!– Define a SSL HTTP/1.1 Connector on port 8443 –>

<Connector port=”8443” maxHttpHeaderSize=”8192″

maxThreads=”150″ minSpareThreads=”25″ maxSpareThreads=”75″
enableLookups=”false” disableUploadTimeout=”true”
acceptCount=”100″ scheme=”https” secure=”true”
keystoreFile=”/path/to/my/keystore”
clientAuth=”false” sslProtocol=”TLS” />

then

restarting the tomcat

Next

https://localhost:8443

Have you TRIED these steps? What was the result? And you don't say anything about what version/distro of Linux you're using, or anything about your environment.

vamsi_k 11-11-2008 08:43 PM

i did'nt try them. I searched in the Google and i got these steps.

os: centos 5.2

TB0ne 11-12-2008 08:05 AM

Quote:

Originally Posted by vamsi_k (Post 3338937)
i did'nt try them. I searched in the Google and i got these steps.

os: centos 5.2

Well, then...go try them, if you want to enable SSL. Post here if you're having problems......

vamsi_k 11-17-2008 06:14 AM

followed and did same as in 1 st post

vamsi_k 11-17-2008 06:15 AM

followed the same which are written in the 1 st post

but keystore file path edited in server.xml is : /usr/share/tomcat5

OS : centos 5.2

java version :
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)

tomcat : 5.5 ( installed rpm's )


this is the error :

17-Nov-08 5:07:33 PM org.apache.tomcat.util.net.jsse.JSSESocketFactory getStore
SEVERE: Exception trying to load keystore /usr/share/tomcat5/.keystore
java.security.KeyStoreException: JKS
at java.security.KeyStore.getInstance(libgcj.so.7rh)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(tomcat-util-5.5.23.jar.so)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(tomcat-util-5.5.23.jar.so)
at org.apache.tomcat.util.net.jsse.JSSE14SocketFactory.getKeyManagers(tomcat-util-5.5.23.jar.so)
at org.apache.tomcat.util.net.jsse.JSSE14SocketFactory.init(tomcat-util-5.5.23.jar.so)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSocket(tomcat-util-5.5.23.jar.so)
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(tomcat-util-5.5.23.jar.so)
at org.apache.tomcat.util.net.PoolTcpEndpoint.startEndpoint(tomcat-util-5.5.23.jar.so)
at org.apache.coyote.http11.Http11BaseProtocol.start(tomcat-http-5.5.23.jar.so)
at org.apache.coyote.http11.Http11Protocol.start(tomcat-http-5.5.23.jar.so)
at org.apache.catalina.connector.Connector.start(catalina-5.5.23.jar.sot7n6f7.so)
at org.apache.catalina.core.StandardService.start(catalina-5.5.23.jar.sot7n6f7.so)
at org.apache.catalina.core.StandardServer.start(catalina-5.5.23.jar.sot7n6f7.so)
at org.apache.catalina.startup.Catalina.start(catalina-5.5.23.jar.sot7n6f7.so)
at java.lang.reflect.Method.invoke(libgcj.so.7rh)
at org.apache.catalina.startup.Bootstrap.start(bootstrap.jar.so)
at org.apache.catalina.startup.Bootstrap.main(bootstrap.jar.so)
17-Nov-08 5:07:33 PM org.apache.coyote.http11.Http11BaseProtocol start
SEVERE: Error starting endpoint
java.io.IOException: Exception trying to load keystore /usr/share/tomcat5/.keystore: JKS
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getStore(tomcat-util-5.5.23.jar.so)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.getKeystore(tomcat-util-5.5.23.jar.so)
at org.apache.tomcat.util.net.jsse.JSSE14SocketFactory.getKeyManagers(tomcat-util-5.5.23.jar.so)
at org.apache.tomcat.util.net.jsse.JSSE14SocketFactory.init(tomcat-util-5.5.23.jar.so)
at org.apache.tomcat.util.net.jsse.JSSESocketFactory.createSocket(tomcat-util-5.5.23.jar.so)
at org.apache.tomcat.util.net.PoolTcpEndpoint.initEndpoint(tomcat-util-5.5.23.jar.so)
at org.apache.tomcat.util.net.PoolTcpEndpoint.startEndpoint(tomcat-util-5.5.23.jar.so)
at org.apache.coyote.http11.Http11BaseProtocol.start(tomcat-http-5.5.23.jar.so)
at org.apache.coyote.http11.Http11Protocol.start(tomcat-http-5.5.23.jar.so)
at org.apache.catalina.connector.Connector.start(catalina-5.5.23.jar.sot7n6f7.so)
at org.apache.catalina.core.StandardService.start(catalina-5.5.23.jar.sot7n6f7.so)
at org.apache.catalina.core.StandardServer.start(catalina-5.5.23.jar.sot7n6f7.so)
at org.apache.catalina.startup.Catalina.start(catalina-5.5.23.jar.sot7n6f7.so)
at java.lang.reflect.Method.invoke(libgcj.so.7rh)
at org.apache.catalina.startup.Bootstrap.start(bootstrap.jar.so)
at org.apache.catalina.startup.Bootstrap.main(bootstrap.jar.so)
17-Nov-08 5:07:33 PM org.apache.catalina.startup.Catalina start
SEVERE: Catalina.start:
LifecycleException: service.getName(): "Catalina"; Protocol handler start failed: java.io.IOException: Exception trying to load keystore /usr/share/tomcat5/.keystore: JKS
at org.apache.catalina.connector.Connector.start(catalina-5.5.23.jar.sot7n6f7.so)
at org.apache.catalina.core.StandardService.start(catalina-5.5.23.jar.sot7n6f7.so)
at org.apache.catalina.core.StandardServer.start(catalina-5.5.23.jar.sot7n6f7.so)
at org.apache.catalina.startup.Catalina.start(catalina-5.5.23.jar.sot7n6f7.so)
at java.lang.reflect.Method.invoke(libgcj.so.7rh)
at org.apache.catalina.startup.Bootstrap.start(bootstrap.jar.so)
at org.apache.catalina.startup.Bootstrap.main(bootstrap.jar.so)
17-Nov-08 5:07:33 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 3622 ms

TB0ne 11-17-2008 11:02 AM

Quote:

Originally Posted by vamsi_k (Post 3344753)
followed the same which are written in the 1 st post

but keystore file path edited in server.xml is : /usr/share/tomcat5

OS : centos 5.2

java version :
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b02)
Java HotSpot(TM) Client VM (build 1.5.0_16-b02, mixed mode, sharing)

tomcat : 5.5 ( installed rpm's )


this is the error :

17-Nov-08 5:07:33 PM org.apache.tomcat.util.net.jsse.JSSESocketFactory getStore
SEVERE: Exception trying to load keystore /usr/share/tomcat5/.keystore
java.security.KeyStoreException: JKS

Ok...seems easy to understand. Either the file isn't there, or has incorrect permissions. Go fix it.

vamsi_k 11-27-2008 06:12 AM

File is existing in the path . I even tried providing complete 777 permissions to the file


All times are GMT -5. The time now is 02:12 PM.