Enter keystore password: mylittlesecretFor all questions, you can provide any answer of your choosing, except "your first and last name". This has to be the fully qualified host name of your Tomcat server, which is "localhost" in our case.
What is your first and last name?
[Unknown]: localhost
What is the name of your organizational unit?
[Unknown]: cs144
What is the name of your organization?
[Unknown]: UCLA
What is the name of your City or Locality?
[Unknown]: Los Angeles
What is the name of your State or Province?
[Unknown]: California
What is the two-letter country code for this unit?
[Unknown]: US
Is CN=localhost, OU=cs144, O=UCLA, L=Los Angeles, ST=California, C=US correct?
[no]: yes
Enter key password for <cs144.tomcat>
(RETURN if same as keystore password):
Once it finishes, keytool will create a keystore file /etc/tomcat7/ssl.keystore and store a newly-generated a public and private key pair there. Make sure that the file /etc/tomcat7/ssl.keystore has been generated.
NOTE: The generated public key is stored in the form of certificate. A certificate is nothing more than a statement like "the name of this host is localhost and its public key is XX:XX:...:XX:XX. This certificate is valid from XX/XX/XX until XX/XX/XX". All certificates need to be signed by a certificate authority (CA), but since you have not asked any third party CA to sign your certificate, it has been signed "by itself". This type of certificate is referred to as a "self-signed certificate". When web browsers see a self-signed certificate, they will complain that they cannot "trust" it, because it has not been signed by one of their trusted CAs.
<!-- Define a SSL HTTP/1.1 Connector on port 8443 --> This connector uses the JSSE configuration, when using APR, the connector should be using the OpenSSL style configuration described in the APR documentation --> <!-- <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false" sslProtocol="TLS" /> -->Remove the comment around <Connector> element (highlighted as red) and add the following two attributes to the Connector element to indicate the location and the password of the keystore:
keystoreFile="/etc/tomcat7/ssl.keystore" keystorePass="mylittlesecret"(If you used a different password from "mylittlesecret" when you created the keystore, please replace it with your own password.) Since the server.xml file is owned by root, you need to edit the file with the root permission, such as:
cs144@class-vm:~$ sudo nano /etc/tomcat7/server.xml
cs144@class-vm:~$ sudo /etc/init.d/tomcat7 restart
For the purpose of this project, threfore, we ignore this warning and proceed to our next step. In practice, however, most users will be turned away by a warning message like this, being too scared of what they see, so you will have to obtain a certificate signed by one of the trusted CAs.