DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
  1. DZone
  2. Coding
  3. Languages
  4. Install SSL Certificate on Tomcat Web Server

Install SSL Certificate on Tomcat Web Server

Learn how you can install an SSL certificate on an Apache Tomcat web server.

Jake Adley user avatar by
Jake Adley
·
Feb. 26, 19 · Tutorial
Like (2)
Save
Tweet
Share
13.86K Views

Join the DZone community and get the full member experience.

Join For Free

Tomcat Web Server: SSL Certificate Installation Procedure

To successfully install your SSL Certificate on a Tomcat web server, you need to configure the root (SSL) certificate, intermediate/primary certificate, and private key within the appropriate Keystore.

  • Download Certificate Files
  • Import Root Certificate
  • Import Intermediate Certificate
  • Install SSL Certificate

Perform the following steps when installing the SSL certificate on Tomcat Web Server.

Install SSL Certificate Into the Keystore

Step 1: Download and Extract the SSL Certificate

After order completion, Certificate Authority (CA) will send an email containing a *.zip file, which includes the root, intermediate, and primary certificate files. Download and extract the files on the Tomcat Web Server directory where the Keystore was added during the Certificate Signing Request (CSR) generation process.

Note: SSL certificate will work only with the same Keystore, which was created during the CSR generation process. Also, make sure to install all certificate files in the correct order on the Keystore.

Step 2: Import Root Certificate File

During the process of installing the SSL certificate to the Keystore, the password required is the same one that you created during the CSR generation process. Now, to import the Root certificate file, enter the following command/code:

keytool -import -trustcacerts -alias root -file RootCertFileName.crt -keystore keystore.key


After entering this command, if you receive a message that says “Certificate already exists in system-wide CA Keystore under alias <…> Do you still want to add it to your own Keystore? [no]:” then select Yes.

If this process is successfully completed, it will display this message: “Certificate was added to Keystore.”

Step 3: Import Intermediate Certificate File

Add the following command/code to import the intermediate certificate file:

keytool -import -trustcacerts -alias intermediate -file IntermediateCertFileName.crt -keystore keystore.key


If this process is successfully completed, it will display this message: “Certificate was added to Keystore.”

Step 4: Installing the Primary Certificate File

Add the following command/code to install the primary certificate file:

keytool -import -trustcacerts -alias tomcat -file PrimaryCertFileName.crt -keystore keystore.key


If this process is successfully completed, it will display this message: “Certificate was added to Keystore.”

After installing the SSL Certificate file into your Keystore, the next step is the server configuration for using the Keystore file.

SSL Connector Configuration

Note: Configuration of ‘SSL Connector’ must be required for Tomcat to accept a secure connection.

In the system’s home directory, Tomcat is mainly looking for the Keystore with file name .keystore and default password as ‘changeit.’ On Unix and Linux systems, the home directory will be /home/user-name/, and for Microsoft Windows systems, it will be C:\Documents and Settings\user-name\. Users can change the file location and password if required.

1. Copy Keystore file (your-domain-name.key) into the home directory
2. Now, using any text-editor open …~/conf/server.xml file.
3. If necessary, uncomment the SSL connector.
4. Locate the SSL connector for which the new Keystore will be used. Make sure the Connector Port is 443.
5. During configuration of SSL connector, add the exact location of the Keystore file name and also the correct KeystorePass.
6. If the Tomcat version is 7.0.X or 8.0.X, then replace the KeystorePass with Keypass.

Once the connector configuration process is finished, it will  look something like this:

<Connector className=”org.apache.catalina.connector.http.HttpConnector” port=”8443″ 
minProcessors=”5″ maxProcessors=”75″ enableLookups=”true” acceptCount=”10″ debug=”0″ 
scheme=”https” secure=”true”>
<Factory className=”org.apache.catalina.net.SSLServerSocketFactory” clientAuth=”false” protocol=”TLS” 
keystoreFile=”/working/mykeystore” keystorePass=”password”/>


7. Save the server.xml file and restart Tomcat server.

With this step, the SSL certificate is now successfully installed the on Tomcat web server.

Apache Tomcat Web server

Published at DZone with permission of Jake Adley. See the original article here.

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • AWS Cloud Migration: Best Practices and Pitfalls to Avoid
  • Building a Scalable Search Architecture
  • The 12 Biggest Android App Development Trends in 2023
  • Asynchronous HTTP Requests With RxJava

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: