Configure the APR advanced mode and SSL Certificate of Tomcat 7 in centos

Source: Internet
Author: User
Tags openssl rsa pkcs12 ssl certificate startssl

I use the free certificate provided by startssl here, startssl certificate application can refer to the following link: http://www.setsea.net/wordpress/post/2011/04/21/881.html
After the application is completed, you will have three files: SSL. CRT (Public Key), SSL. Key (key), SSL. p12 (Certificate in PKCS12 format)

Run the following command to view the certificate information:

$ keytool -list -rfc -keystore ssl.p12 -storetype pkcs12

View the certificate information, mainly to view the alias attributes, the keystore is generated below to use, generally such a string "xxx@163.com startcom Ltd. ID", xxx@163.com is the mailbox when you register startssl.

Run the following command to generate the keystore

$ Keytool-importkeystore-srckeystore keystore. p12-srcstoretype PKCS12-destkeystore keystore-srcalias "startcom Ltd. ID of the xxx@163.com"-destkeypass changeit

Srcalias is the alias found above. The default destkeypass password is changeit.

Next, merge the certificate (mainly because Firefox requires us to provide the root certificate of the Certificate Issuer)
Download the startssl CA certificate from startssl:

$ wget http://cert.startssl.com/certs/ca.pem

Download the startssl class1 sub CA certificate from startssl:

$ wget http://cert.startssl.com/certs/sub.class1.server.ca.pem

Merge SSL, sub. class1.server. Ca. Pem, Ca. pem

$ cat sub.class1.server.ca.pem >> ssl.crt$ cat ca.pem >> ssl.crt

Set tomcat to start without entering the private key password

$ cp ssl.key ssl.key.tmp $ openssl rsa -in ssl.key.tmp -out ssl.key 

Put the generated keystore, SSL. CRT, and SSL. Key in the conf directory of Tomcat, and modify the conf/server. xml configuration.
Add the following Configuration:

<Connector port="9443" protocol="HTTP/1.1" SSLEnabled="true"maxThreads="150" scheme="https" secure="true"keystoreFile="${catalina.base}/conf/keystore" keystorePass="changeit " keystoreType="PKCS12" SSLCertificateFile="${catalina.base}/conf/ssl.crt"               SSLCertificateKeyFile="${catalina.base}/conf/ssl.key"               SSLCACertificateFile="${catalina.base}/conf/ssl.crt"clientAuth="false" sslProtocol="TLS" />

The three parameters are used.
Sslcertificatefile sub class1 Certificate
Sslcertificatekeyfile sub class1 certificate Password
Sslcacertificatefile root certificate (Firefox does not trust this parameter because it needs to attach the startssl root certificate because it is issued to you ).

Start Tomcat.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.