SSL no funciona con Apache en Windows


12

Estoy usando un producto de un proveedor que tiene que usar Apache en Windows.

Tenemos nuestra propia CA.

Para fines de denominación:

AppServer - Server2012r2 - Apache 2.4

OldCertsha1 - Server2012r2

NewCertsha2 - Server2012r2

Creé la CSR en el AppServer usando los dos comandos a continuación.

genrsa –des3 –out name.sub.domain.com.key 2048

req –new –key name.sub.domain.com.key –out name.sub.domain.com.csr

Todo va bien

req -noout -text -in name.sub.domain.com.csr
Certificate Request:
    Data:
    Version: 0 (0x0)
    Subject: C=xx, ST=xx, L=xx, O=xx, OU=xx, CN=name.sub.domain.com
    Subject Public Key Info:
        Public Key Algorithm: rsaEncryption
        RSA Public Key: (2048 bit)
            Modulus (2048 bit):
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                e1:ae:5a:e8:26:81:fd:a0:49:f9:a3:c0:77:75:0f:
                321:rf
            Exponent: 65537 (0x10001)
    Attributes:
        a0:00
Signature Algorithm: sha1WithRSAEncryption
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d:9a:56:b4:22:e8:a5:1a:e8:43:1d:6f:ef:86:d8:
    aa:e4:b7:1d

Luego en el servidor de CA

https: // NewCertsha2 / CertSrv

Solicitar un certificado

Solicitud de certificado avanzado.

Envíe una solicitud de certificado utilizando un archivo CMC codificado en base 64 o PKCS # 10, o envíe una solicitud de renovación utilizando un archivo PKCS # 7 codificado en base 64.

Abra la CSR en el AppServer y pegue la información de CSR en el cuadro

-----BEGIN CERTIFICATE REQUEST-----
MIIC0zCCAbsCAQAwgY0xCzAJBgNVBAYTAlVTMREwDwYDVQQIEwhNaWNoaWdhbjER
MA8GA1UEBxMIRGVhcmJvcm4xFjAUBgNVBAoTDWRmY3VmaW5hbmNpYWwxDDAKBgNV
BAsTA2l2cjEyMDAGA1UEAxMpcDAxMWRjMDEtY3JlYzAzLmNlbnRyYWwuZGZjdWZp
bmFuY2lhbC5jb20wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCej1o0
EEq6UcgB4uhr9bYzA4u8pvxvaCE0JXCqW/8m8D2DBHnJFA2Ui4kEjQlKy1eRTfE0
6lRmowrsJVvvlz0pfsdfghksdkjfgsjskhgfksgfdfmjwHd1D/Bgg60AOPmUBIFl
rgaGcw9CasdkjlhaslkdjhsaklfjhdsfkhsldfjhsdlkjfhdlFOoGVtQdgticLqy
dzpLnAnqwezEnsdflsjhdfksdkfjhwsdkfjhLqKDx1b0z1n7tV4F8DS261dmm8+r
ONz9oYqZfdAFu55gG7sHgOn14P5gP2QIoV/c6CJ2hzbtlifKmZp2A+9F/csXTMIJ
w2sgfQzgv+UPEkH9AgMBAAGgADANBgkqhkiG9w0BAQUFAAOCAQEAMwjmg96iCLnB
uTF4LOoeA788NAt9cYdsWuaUsHptnw70Mj5wWIiaZYgY0hCvWPezRsgOfFrWinN0
y4n0trlyEYXJquBKZbxJZ2yscNMqOJyKl70Ckb83IwpIdhxRYr0JZffEmFlx+2yv
4rhFquS3HZpWtCLopRroQx1v74bYGZHBiz2cM4peowzqGrs8r5NKYYqLRiH00VTs
GEEB+Rihen4tnrn0Y1KLkumrSOrTghIrpQ0j2MZrmvhAIlcZ0W+6bJQcbl0lQ3Hv
STaH9EyIj+47jpMhpfazRPOjSDdFiokjchVDS0Wj/iQJlNDurU7xd+570gduZfcF
M4YoMCwv7Q==
-----END CERTIFICATE REQUEST-----

Servidor web de plantillas (10 años)

Aquí tengo dos opciones

DER codificado o Base 64 codificado

No importa cuál seleccione, descarga un archivo .cer y un archivo .p7b

Hice los mismos pasos en el servidor OldCertsha1 y obtuve los mismos resultados

Cuando edite el archivo httpd-ssl.conf, agregue lo siguiente y reinicie el servicio Apache2.4

SSLCertificateFile "E:/Apache24/conf/Certs/name.sub.domain.com.crt"

SSLCertificateKeyFile "E:/Apache24/conf/Certs/name.sub.domain.com.key"

Recibo los siguientes errores, diferentes errores para diferentes tipos de las opciones anteriores (codificado DER o codificado Base 64):

DER codificado:

[Wed Jan 11 08:37:44.471616 2017] [proxy:error] [pid 4804:tid 1780] (OS 10061)No connection could be made because the target machine actively refused it.  : AH00957: HTTP: attempt to connect to 127.0.0.1:8080 (127.0.0.1) failed
[Wed Jan 11 08:37:44.471616 2017] [proxy:error] [pid 4804:tid 1780] AH00959: ap_proxy_connect_backend disabling worker for (127.0.0.1) for 60s
[Wed Jan 11 08:37:44.471616 2017] [proxy_http:error] [pid 4804:tid 1780] [client ::1:61346] AH01114: HTTP: failed to make connection to backend: 127.0.0.1, referer: https://name.sub.domain.com/knoahsoft/faces/client/index1.jspx?_afPfm=5600447c
[Wed Jan 11 13:13:56.437605 2017] [ssl:emerg] [pid 20860:tid 540] AH02562: Failed to configure certificate name.sub.domain.com:443:0 (with chain), check E:/Apache24/conf/Certs/name.sub.domain.com.cer
[Wed Jan 11 13:13:56.437605 2017] [ssl:emerg] [pid 20860:tid 540] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: TRUSTED CERTIFICATE) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Wed Jan 11 13:13:56.437605 2017] [ssl:emerg] [pid 20860:tid 540] SSL Library Error: error:140DC009:SSL routines:SSL_CTX_use_certificate_chain_file:PEM lib
[Wed Jan 11 13:14:14.375459 2017] [ssl:emerg] [pid 23800:tid 544] AH02562: Failed to configure certificate name.sub.domain.com:443:0 (with chain), check E:/Apache24/conf/Certs/name.sub.domain.com.cer
[Wed Jan 11 13:14:14.375459 2017] [ssl:emerg] [pid 23800:tid 544] SSL Library Error: error:0906D06C:PEM routines:PEM_read_bio:no start line (Expecting: TRUSTED CERTIFICATE) -- Bad file contents or format - or even just a forgotten SSLCertificateKeyFile?
[Wed Jan 11 13:14:14.375459 2017] [ssl:emerg] [pid 23800:tid 544] SSL Library Error: error:140DC009:SSL routines:SSL_CTX_use_certificate_chain_file:PEM lib

Base 64 codificada:

[Wed Jan 11 14:35:15.024474 2017] [ssl:emerg] [pid 141796:tid 508] AH02577: Init: SSLPassPhraseDialog builtin is not supported on Win32 (key file E:/Apache24/conf/Certs/name.sub.domain.com.key)
[Wed Jan 11 14:35:15.024474 2017] [ssl:emerg] [pid 141796:tid 508] AH02564: Failed to configure encrypted (?) private key name.sub.domain.com:443:0, check E:/Apache24/conf/Certs/name.sub.domain.com.key
[Wed Jan 11 14:35:15.024474 2017] [ssl:emerg] [pid 141796:tid 508] SSL Library Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Wed Jan 11 14:35:15.024474 2017] [ssl:emerg] [pid 141796:tid 508] SSL Library Error: error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error
[Wed Jan 11 14:35:15.024474 2017] [ssl:emerg] [pid 141796:tid 508] SSL Library Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Wed Jan 11 14:35:15.024474 2017] [ssl:emerg] [pid 141796:tid 508] SSL Library Error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error (Type=RSA)
[Wed Jan 11 14:35:15.024474 2017] [ssl:emerg] [pid 141796:tid 508] SSL Library Error: error:04093004:rsa routines:OLD_RSA_PRIV_DECODE:RSA lib
[Wed Jan 11 14:35:15.024474 2017] [ssl:emerg] [pid 141796:tid 508] SSL Library Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Wed Jan 11 14:35:15.024474 2017] [ssl:emerg] [pid 141796:tid 508] SSL Library Error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error (Type=PKCS8_PRIV_KEY_INFO)
[Wed Jan 11 14:36:12.355215 2017] [ssl:emerg] [pid 145468:tid 512] AH02577: Init: SSLPassPhraseDialog builtin is not supported on Win32 (key file E:/Apache24/conf/Certs/name.sub.domain.com.key)
[Wed Jan 11 14:36:12.355215 2017] [ssl:emerg] [pid 145468:tid 512] AH02564: Failed to configure encrypted (?) private key name.sub.domain.com:443:0, check E:/Apache24/conf/Certs/name.sub.domain.com.key
[Wed Jan 11 14:36:12.355215 2017] [ssl:emerg] [pid 145468:tid 512] SSL Library Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Wed Jan 11 14:36:12.355215 2017] [ssl:emerg] [pid 145468:tid 512] SSL Library Error: error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error
[Wed Jan 11 14:36:12.355215 2017] [ssl:emerg] [pid 145468:tid 512] SSL Library Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Wed Jan 11 14:36:12.355215 2017] [ssl:emerg] [pid 145468:tid 512] SSL Library Error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error (Type=RSA)
[Wed Jan 11 14:36:12.355215 2017] [ssl:emerg] [pid 145468:tid 512] SSL Library Error: error:04093004:rsa routines:OLD_RSA_PRIV_DECODE:RSA lib
[Wed Jan 11 14:36:12.355215 2017] [ssl:emerg] [pid 145468:tid 512] SSL Library Error: error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag
[Wed Jan 11 14:36:12.355215 2017] [ssl:emerg] [pid 145468:tid 512] SSL Library Error: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error (Type=PKCS8_PRIV_KEY_INFO)

Leí un par de artículos que dicen que los archivos CER y CRT son intercambiables, solo cámbieles el nombre.

Si cambio el nombre del cer a crt y actualizo httpd-ssl.conf, obtengo muchos errores en los registros, aproximadamente 100 de estos:

[Wed Jan 11 14:06:43.943865 2017] [autoindex:error] [pid 70976:tid 1784] [client 10.1.41.110:50933] AH01276: Cannot serve directory E:/KnoahSoft/EmpPhotos/: No matching DirectoryIndex (index.html) found, and server-generated directory index forbidden by Options directive

Ahora el proveedor puso el archivo server.crt, server.cre, server.csr y server.key que cargaron cuando se entregó la caja, si cambio las dos líneas en httpd-ssl.conf a lo que tenían, se reiniciará bien y todo funciona pero recibo la advertencia SSL

SSLCertificateFile "E:/Apache24/conf/Certs/server.crt"

SSLCertificateKeyFile "E:/Apache24/conf/Certs/server.key"

¿Alguien puede decirme qué podría estar haciendo mal? Si necesita ver las configuraciones, solo pregunte si las colocaré.

Actualizar:

Tomé su server.csr, abrí la página CertSrv en OldCertsha1 y NewCertsha2, cuando utilicé la plantilla del servidor web del servidor web (10 años) recibí un error:

Your Request Id is 118. The disposition message is "Denied by Policy Module The certificate validity period will be shorter than the WebServer(10Years) Certificate Template specifies, because the template validity period is longer than the maximum certificate validity period allowed by the CA. Consider renewing the CA certificate, reducing the template validity period, or increasing the registry validity period. ". 

Entonces probé el mismo error del Servidor web (5 años) y luego cansé al (Servidor web) no recibí un error y descargué los archivos cer y p7b codificados con DER o codificados con Base 64.

Cambió la base 64 codificada server.cer a server.crt, renombró el antiguo server.crt a server1.crt y reinició apache,

Ningún error funcionó perfectamente,

¿Por qué? ¿Qué hice mal desde el principio?

Esta fue la primera vez que trabajé con SSL y Apache y utilicé mi propia CA, ¿qué hice mal? Lo único que se me ocurre es que utilicé la plantilla de servidor web (10 años), pero eso no tiene sentido para mí.

Si veo ambos archivos CRT, ambos tienen la misma información

El certificado está destinado a los siguientes propósitos

  • Asegurar la identidad de una computadora remota

Emitido a: name.sub.domain.com

Emitido por: OldCertsha1

La única diferencia real de la pestaña General es cuánto tiempo son válidos, el cst de mi csr es válido durante 10 años, el crt de su csr es válido durante 2 años.

Profundizaré en las otras partes del SSL y veré si puedo encontrar diferencias mañana.


expta.com/2010/08/… pero podría ser demasiado tarde si tienes un montón de certs y no hay automatización
Jacob Evans

preste atención al error "AH02577: Init: SSLPassPhraseDialog incorporado no es compatible con Win32", desactive el cifrado de la clave rsa e intente nuevamente.
ezra-s

Respuestas:


11

Primero, Apache siempre usará base64, las extensiones de archivo son irrelevantes (pem, crt, cer).

En segundo lugar, no puede emitir un certificado por más tiempo que la autoridad de certificación.

10 años es demasiado, no me sorprendería ver que los navegadores comienzan a marcarlos como inseguros.

Si todavía tiene los certificados emitidos, puede validarlos con openssl.

/security//a/56699/84379


10

Base 64 en todas partes, por favor :-).

Su línea httpd.conf

SSLCertificateKeyFile "E: /Apache24/conf/Certs/name.sub.domain.com.key"

está especificando un archivo de clave cifrado. Apache en Windows no es compatible con la frase de contraseña de descifrado en tiempo de ejecución ... Ver línea de registro de errores:

[Mié 11 de enero 14: 35: 15.024474 2017] [ssl: emerg] [pid 141796: tid 508] AH02577: Init: SSLPassPhraseDialog incorporado no es compatible con Win32 (archivo de clave E: /Apache24/conf/Certs/name.sub. dominio.com.key)

Tendrá que descifrar previamente su archivo de clave:

openssl rsa -in name.sub.domain.com.key -out name.sub.domain.com.decryped.key

proporcionando la frase de contraseña cuando se le solicite. Corrija httpd.conf y reinicie Apache.

Al usar nuestro sitio, usted reconoce que ha leído y comprende nuestra Política de Cookies y Política de Privacidad.
Licensed under cc by-sa 3.0 with attribution required.