1.11M Members

Setup SSL (self signed cert) with tomcat

 
0
 

I am mostly following this page:

http://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html

I used this command to create the keystore

keytool -genkey -alias tomcat -keyalg RSA -keystore /etc/tomcat6/keystore

and answered the prompts

Then i edited my server.xml file and uncommented/edited this line

<Connector port="8443" protocol="org.apache.coyote.http11.Http11Protocol" SSLEnabled="true"
           maxThreads="150" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS" 
           keystoreFile="/etc/tomcat6/keystore" 
           keystorePass="tomcat" />

Whole server.xml file: http://pastebin.com/yVRiNHi7

I'm using the protocl Http11Protocol instead of HTTP/1.1 incase there was an issue with it being autoconfigured to "APR" as suggested by the tomcat tutorial (not sure if I have that or how to find out if I do). However it seems to have no effect on whichever protocol I use.


then I go to the web.xml file for my project and add this into the file

<security-constraint>
            <web-resource-collection>
                    <web-resource-name>Security</web-resource-name>
                    <url-pattern>/*</url-pattern>
            </web-resource-collection>
            <user-data-constraint>
                    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
            </user-data-constraint>
    </security-constraint>

When I try to run my webapp I am met with this:

Unable to connect

Firefox can't establish a connection to the server at localhost:8443.

*   The site could be temporarily unavailable or too busy. Try again in a few
      moments.

*   If you are unable to load any pages, check your computer's network
      connection.

If I comment out the lines I've added to my web.xml file, the webapp works fine. My log file in /var/lib/tomcat6/logs says nothing. I can't figure out if this is a problem with my keystore file, my server.xml file or my web.xml file.... Any assistance is appreciated

I am using tomcat 6 on ubuntu.

You
Post:
Start New Discussion
View similar articles that have also been tagged: