2017-11-15 29 views
0

SELinuxを搭載したCentOSサーバーでApacheを起動できません。エラーログにはCentOSの秘密鍵でApacheを起動できません

[[email protected] httpd]# cat test-error_log 
[Wed Nov 15 05:42:34 2017] [error] Init: Private key not found 
[Wed Nov 15 05:42:34 2017] [error] SSL Library Error: 218529960 error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag 
[Wed Nov 15 05:42:34 2017] [error] SSL Library Error: 218640442 error:0D08303A:asn1 encoding routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1 error 
[Wed Nov 15 05:42:34 2017] [error] SSL Library Error: 218529960 error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag 
[Wed Nov 15 05:42:34 2017] [error] SSL Library Error: 218595386 error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error 
[Wed Nov 15 05:42:34 2017] [error] SSL Library Error: 67710980 error:04093004:rsa routines:OLD_RSA_PRIV_DECODE:RSA lib 
[Wed Nov 15 05:42:34 2017] [error] SSL Library Error: 218529960 error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag 
[Wed Nov 15 05:42:34 2017] [error] SSL Library Error: 218595386 error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error 

それは

[[email protected] private]# openssl rsa -in test.key -check -noout 
unable to load Private Key 
140598241089352:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1319: 
140598241089352:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:381:Type=RSA 
140598241089352:error:04093004:rsa routines:OLD_RSA_PRIV_DECODE:RSA lib:rsa_ameth.c:115: 
140598241089352:error:0D0680A8:asn1 encoding routines:ASN1_CHECK_TLEN:wrong tag:tasn_dec.c:1319: 
140598241089352:error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error:tasn_dec.c:381:Type=PKCS8_PRIV_KEY_INFO 
140598241089352:error:0907B00D:PEM routines:PEM_READ_BIO_PRIVATEKEY:ASN1 lib:pem_pkey.c:132: 

また、ここで失敗したパスは、confファイルである

[[email protected] conf]# cat /etc/httpd/conf.d/test.conf 
<VirtualHost *:443> 
ServerAdmin [email protected] 
DocumentRoot /var/www/html/test 
ServerName server.server.com 

SSLEngine on 
SSLProtocol all -SSLv2 -SSLv3 
SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW 
SSLCertificateFile /etc/pki/tls/certs/test.crt 
SSLCertificateKeyFile /etc/pki/tls/private/test.key 


ErrorLog logs/test-error_log 
CustomLog logs/test-access_log common 

私はまた、秘密鍵にスペースが含まれていない確認。これが間違っている他のアイデア?

また

[[email protected] etc]# ls -dZ /etc/pki/tls/private/ 
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /etc/pki/tls/private/ 
[[email protected] etc]# ls -dZ /etc/pki/tls/certs/ 
drwxr-xr-x. root root system_u:object_r:httpd_sys_content_t:s0 /etc/pki/tls/certs/ 

私はまた、秘密鍵とダッシュの適切な数のスペースが含まれていない確認しています。

EDIT:LSの出力-alの/ etc/PKI/TLS /プライベート/とLS -alの/ etc/PKI/TLS /本命/

[[email protected] ~]# ls -al /etc/pki/tls/certs/ 
total 1788 
drwxr-xr-x. 2 root root 4096 Nov 15 08:51 . 
drwxr-xr-x. 5 root root 4096 Feb 11 2015 .. 
-rw-r--r--. 1 root root 786601 Jul 14 2014 ca-bundle.crt 
-rw-r--r--. 1 root root 1005005 Jul 14 2014 ca-bundle.trust.crt 
-rw-------. 1 root root 1513 Feb 11 2015 localhost.crt 
-rwxr-xr-x. 1 root root  610 Jan 20 2015 make-dummy-cert 
-rw-r--r--. 1 root root 2242 Jan 20 2015 Makefile 
-rwxr-xr-x. 1 root root  829 Jan 20 2015 renew-dummy-cert 
-rw-r--r--. 1 root root 1208 Feb 11 2015 test.crt 
-rw-------. 1 root root 3258 Nov 15 08:51 test_1.cert 
[[email protected] ~]# ls -al /etc/pki/tls/private/ 
total 16 
drwxr-xr-x. 2 root root 4096 Nov 18 21:15 . 
drwxr-xr-x. 5 root root 4096 Feb 11 2015 .. 
-rw-------. 1 root root 1679 Feb 11 2015 localhost.key 
-rw-r--r--. 1 root root 1679 Nov 18 21:15 test.key 
[[email protected] ~]# 

答えて

0

はあなたが暗号化された秘密鍵ですか? があなたの秘密鍵が暗号化されているかどうかを確認するには:

grep ENCRYPTED /etc/pki/tls/private/test.key 

YESの場合、秘密鍵からパスワードを削除します。

openssl rsa -in /etc/pki/tls/private/test.key -out /etc/pki/tls/private/test-new.key 

チェックあなたの秘密鍵のヘッダー、次のようになります。

-----BEGIN RSA PRIVATE KEY----- 

とフッターを確認し、次のようになります。

-----END RSA PRIVATE KEY----- 

フッターの後にスペースまたは改行を削除します。

希望します。

+0

これは暗号化されておらず、開始時または終了時にはスペースをチェックしていません。他のアイデア? – MarshawxLynch

+0

'ls -al/etc/pki/tls/certs /'と 'ls -al/etc/pki/tls/private /'の内容をリストできますか? – sys0dm1n

+0

主な質問に追加されました。 – MarshawxLynch

関連する問題