Sto usando un prodotto di un fornitore che deve usare Apache su Windows.
Abbiamo la nostra CA.
Ai fini della denominazione:
AppServer - Server2012r2 - Apache 2.4
OldCertsha1 - Server2012r2
NewCertsha2 - Server2012r2
Ho creato il CSR sull'AppServer usando i due comandi seguenti.
genrsa –des3 –out name.sub.domain.com.key 2048
req –new –key name.sub.domain.com.key –out name.sub.domain.com.csr
Va tutto bene
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
Quindi sul server CA.
https: // NewCertsha2 / CertSrv
Richiedi un certificato
richiesta di certificato avanzata.
Invia una richiesta di certificato utilizzando un file CMC o PKCS # 10 con codifica base 64 o invia una richiesta di rinnovo utilizzando un file PKCS # 7 con codifica base 64.
Apri il CSR sull'AppServer e incolla le informazioni CSR nella casella
-----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-----
Template Web Server (10 anni)
Qui ho due scelte
Codifica DER o codifica Base 64
Indipendentemente da quale seleziono, scarica un file .cer e un file .p7b
Ho fatto gli stessi passi sul server OldCertsha1 e ho ottenuto gli stessi risultati
Quando modifico il file httpd-ssl.conf aggiungo quanto segue e riavvio il servizio Apache2.4
SSLCertificateFile "E:/Apache24/conf/Certs/name.sub.domain.com.crt"
SSLCertificateKeyFile "E:/Apache24/conf/Certs/name.sub.domain.com.key"
Ottengo i seguenti errori, diversi errori per tipi diversi dalle scelte sopra (codificato DER o codificato Base 64):
Codificato DER:
[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 codificata:
[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)
Ho letto un paio di articoli in cui si dice che i file CER e CRT sono intercambiabili semplicemente rinominandoli.
Se rinomino cer per crt e aggiorno httpd-ssl.conf, ricevo molti errori nei registri di cui circa 100:
[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
Ora il fornitore ripone i file server.crt, server.cre, server.csr e server.key che hanno caricato al momento della consegna della scatola, se cambio le due righe in httpd-ssl.conf a quelle che avevano riavviato bene e tutto funziona ma ricevo l'avviso SSL
SSLCertificateFile "E:/Apache24/conf/Certs/server.crt"
SSLCertificateKeyFile "E:/Apache24/conf/Certs/server.key"
Qualcuno può dirmi cosa potrei fare di sbagliato, se hai bisogno di vedere le configurazioni chiedi semplicemente che le metterò.
Aggiornare:
Ho preso il loro server.csr aperto la pagina CertSrv su OldCertsha1 e NewCertsha2, quando ho usato il modello Web Server Web Server (10 anni) ho ricevuto un errore:
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. ".
Quindi ho provato lo stesso errore del server Web (5 anni), quindi ho stanco che il (server Web) non abbia ricevuto un errore e abbia scaricato i file cer e p7b con codifica DER o Base 64.
Modificato Server.cer con codifica Base 64 in server.crt, rinominato server.crt precedente in server1.crt e riavviato apache,
Nessun errore ha funzionato perfettamente,
Perché? Cosa ho fatto di sbagliato fin dall'inizio?
Questa è stata la prima volta che ho lavorato con SSL e Apache e utilizzando la mia CA, cosa ho fatto di sbagliato? L'unica cosa che mi viene in mente è che ho usato il modello Web Server (10 anni), ma per me non ha davvero senso.
Se visualizzo entrambi i file crt entrambi hanno le stesse informazioni
Il certificato è destinato ai seguenti scopi
- Garantire l'identità di un computer remoto
Rilasciato a: name.sub.domain.com
Rilasciato da: OldCertsha1
L'unica vera differenza dalla scheda Generale è per quanto tempo sono validi, il cst dal mio CSR è valido per 10 anni, il CRT dal loro CSR è valido per 2 anni.
Analizzerò più approfonditamente le altre parti dell'SSL e vedrò se domani trovo delle differenze.