Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSL in Tomcat 7

Tags:

ssl

tomcat7

I am attempting to follow the instructions for setting up SSL in Tomcat 7 for a local app. I don't really understand what I am doing here, so please excuse the n00biness of my approach. I create a key store, as so:

keytool -genkey -alias tomcat -keyalg RSA
Enter keystore password:  changeit
Re-enter new password: changeit
What is your first and last name?
  [Unknown]:  Robert Bram
What is the name of your organizational unit?
  [Unknown]:  Developers
What is the name of your organization?
  [Unknown]:  MyBusiness
What is the name of your City or Locality?
  [Unknown]:  Melbourne
What is the name of your State or Province?
  [Unknown]:  Victoria
What is the two-letter country code for this unit?
  [Unknown]:  AU
Is CN=Robert Bram, OU=Developers, O=MyBusiness, L=Melbourne, ST=Victoria, C=AU correct?
  [no]:  yes

Enter key password for <tomcat>
        (RETURN if same as keystore password):

I then added a Connector port to my server.xml:

<Connector port="8443" maxThreads="200"
        scheme="https" secure="true" SSLEnabled="true"
        keystoreFile="${user.home}/.keystore" keystorePass="changeit"
        clientAuth="false" sslProtocol="TLS"/>

I exported the certificate:

keytool -export -alias tomcat -file tomcatcertfile.cer
Enter keystore password:  changeit
Certificate stored in file <tomcatcertfile.cer>

I restarted Tomcat. I load my app https://localhost:8443/blah/myapp in IE. It shows a certificate error.

I click on "Certificate Error" in address bar > click on View Certificates > click on Install Certificate > Next > tick Place all certificates in the following store > click Browse > click Trusted Root Certification Authorities > Next > Finish > Yes > OK > OK.

Now when I go to the page I see "The security certificate presented by this website was issued for a different website's address".

So.. what exactly am I doing wrong?

Thanks for any advice!

Rob :)

like image 622
Robert Mark Bram Avatar asked Sep 22 '11 04:09

Robert Mark Bram


1 Answers

Instead of entering your name, enter the hostname of the server.

like image 121
user207421 Avatar answered Sep 28 '22 06:09

user207421