Загрузка всей цепочки сертификатов в хранилище ключей для Tomcat 7

Среда: Tomcat 7.0 в Windows 2008 R2

Что нужно сделать

Заставьте Tomcat 7.0 использовать определенный групповой сертификат с сопровождающей цепочкой сертификатов, чтобы браузеры клиентов не выдавали ошибок. The provided certificate is a wildcard cert. This is non-negotiable and irrelevant to getting the certificate installed.

My problem is that I cannot get tomcat to use the chain (root certificates) in addition to the main cert.

What I've tried

At first it took me forever to get the certificate working with the provided key pair. References 2 and 3 showed me these steps to import a provided key pair as a "PrivateKeyEntry" which Tomcat likes better:

#on a CentOS server cuz easier than getting a windows tool for it
openssl pkcs12 -export -in wildcard-customer-2016.crt -inkey wildcard-customer-2016.key -out wildcard-customer-2016.p12 -name wildcard -CAfile rapidssl.crt -caname root

#back on windows
C:\Program Files\Java\jre7\bin\keytool -importkeystore -deststorepass tomcat -destkeystore c:\.keystore -srckeystore c:\certificate\wildcard-customer-2016\wildcard-customer-2016.p12 -srcstoretype PKCS12 -alias wildcard

But I don't know how to add the root certificate so that it uses that as well. You can see the command I used to build the .p12 file included a CAfile command. The importkeystore command when run with a "-trustcacerts" didn't add the root certs, although it did work with the *.customer.com cert.

Possible alternatives
Somebody explain how to configure my server.xml for using APR properly. Pretend I don't know where the files from the zip file go. (Reference 4)

References

  1. https://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html
  2. https://stackoverflow.com/questions/906402/importing-an-existing-x509-certificate-and-private-key-in-java-keystore-to-use-i
  3. http://cunning.sharp.fm/2008/06/importing_private_keys_into_a.html
  4. Create jks for tomcat using .key ,.ca and .cert file
1
задан 23 May 2017 в 14:33
1 ответ

, я использую следующие шаги, чтобы выполнить это, где

  1. HOSTNAME.key, содержащий незашифрованный закрытый ключ
  2. HOSTNAME.cer, содержащий открытый сертификат + Цепочка CA.

$ HOSTNAME должно быть полным доменным именем хоста (важно на шагах 2 и 3 для псевдонима).

openssl pkcs12 -export -out $HOSTNAME.pfx -inkey $HOSTNAME.key -in     $HOSTNAME.cer

Затем с помощью $ HOSTNAME.pfx

keytool -importkeystore -srckeystore $HOSTNAME.pfx -srcstoretype pkcs12 -srcstorepass pazzword -destkeystore $HOSTNAME.jks -deststoretype JKS -deststorepass pazzword -srcalias 1 -destalias $HOSTNAME

Наконец, в файле server.xml Tomcat

     keystoreFile="/etc/tomcat7/security/$HOSTNAME.jks"
     keystorePass="pazzword"
     keyAlias="$HOSTNAME"
     truststoreFile="/etc/tomcat7/security/mastercert.jks" 
     truststorePass="changeit"

Последняя часть (хранилище доверенных сертификатов) ), если вам нужно, чтобы Tomcat доверял дополнительному CA, поэтому он может не понадобиться для вашей установки. Таким образом, хранилище ключей - это место, где находится сертификат сервера, а хранилище доверенных сертификатов - это то, кому сервер будет доверять (если вы хотите выполнить взаимную аутентификацию и т. Д.).

1
ответ дан 3 December 2019 в 23:53

Теги

Похожие вопросы