Creé una clave y un csr en la consola, usando el ejecutable openssl. Luego envié la csr a una CA y obtuve el certificado. Ahora quiero importarlo a tomcat.tomcat no entrega el certificado intermedio (https)
Así que he creado un archivo PKCS # 12 de mi llave y mi certificado:
openssl pkcs12 -export -in mycert.cert -inkey mykey.pem -out key_and_cert.p12
y luego creó un almacén de claves que lo contiene:
keytool -importkeystore -deststorepass [password] -destkeystore keystore.jks -srckeystore key_and_cert.p12 -srcstoretype PKCS12 -srcstorepass [password]
Entonces importar la cadena de certificados intermedia. CRT:
keytool -import -trustcacerts -alias root -file chain.crt -keystore keystore.jks
Aquí la salida de "herramienta de claves -keystore keystore.jks -lista":
Keystore-Typ: JKS
Keystore-Provider: SUN
Ihr Keystore enthält 2 Einträge.
root, 14.11.2011, trustedCertEntry,
Zertifikatsfingerabdruck (MD5): [fingerprint]
1, 14.11.2011, PrivateKeyEntry,
Zertifikatsfingerabdruck (MD5): [fingerprint]
El Tomcat server.xml contiene:
<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" URIEncoding="UTF-8" compression="on"
sslProtocol="TLS"
keystoreFile="/[absolute-path]/keystore.jks"
keystorePass="[password]" />
Cuando reiniciar Tomcat, registra ningún error en catalina.out, todo parece estar bien. Pero cuando corro Firefox, informa
[domain] uses an invalid security certificate.
The certificate is not trusted because no issuer chain was provided.
(Error code: sec_error_unknown_issuer)
Running "openssl s_client -connect [dominio]: 443 -showcerts" devuelve
CONNECTED(00000003)
depth=0 C = DE, OU = Domain Control Validated, CN = [domain]
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 C = DE, OU = Domain Control Validated, CN = [domain]
verify error:num=27:certificate not trusted
verify return:1
depth=0 C = DE, OU = Domain Control Validated, CN = [domain]
verify error:num=21:unable to verify the first certificate
verify return:1
---
Certificate chain
0 s:/C=DE/OU=Domain Control Validated/CN=[domain]
i:/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Domain Validation CA - G2
-----BEGIN CERTIFICATE-----
[certificate from mycert.cert]
-----END CERTIFICATE-----
---
Server certificate
subject=/C=DE/OU=Domain Control Validated/CN=[domain]
issuer=/C=BE/O=GlobalSign nv-sa/CN=GlobalSign Domain Validation CA - G2
---
No client certificate CA names sent
---
SSL handshake has read 1777 bytes and written 289 bytes
---
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-AES256-SHA
Server public key is 2048 bit
Secure Renegotiation IS supported
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : SSLv3
Cipher : ECDHE-RSA-AES256-SHA
Session-ID: [session-id]
Session-ID-ctx:
Master-Key: [master-key]
Key-Arg : None
PSK identity: None
PSK identity hint: None
Start Time: 1321268519
Timeout : 7200 (sec)
Verify return code: 21 (unable to verify the first certificate)
---
creo que Tomcat no entrega el certificado intermedio aunque lo sabe ¿Qué puedo hacer para que tomcat lo entregue?
Información adicional: Al importar el certificado pkcs12, no hay ningún error de cadena de certificado, porque el comando -importkeystore no comprueba la cadena. También traté de importar primero el certificado intermedio y luego llamar a -importkeystore. Obtuve los mismos resultados.
edición: que acaba de intentar otra forma mediante la inserción de la cadena directamente en el PKCS # 12 certificado y obtener el siguiente error:
$ openssl pkcs12 -export -CAfile chain.pem -in mycert.cert -inkey mykey.pem -out key_and_cert.p12 -name tomcat -chain
Error unable to get issuer certificate getting chain.
Sin embargo, el certificado de la cadena está bien:
$ openssl verify chain.pem
chain.pem: OK
¿Tiene la raíz CA en su cadena PEM? – njzk2
¿Qué le ofrece "openssl verify -CAfile chain.pem mycert.cert"? – njzk2