我正在为Apache 2
configurationSSL。 我的系统是Ubuntu Server 10.04 LTS
。 在我的虚拟主机configuration中,我有以下与SSL有关的设置:
SSLEngine On SSLCertificateKeyFile /etc/ssl/private/server.insecure.key SSLCertificateFile /etc/ssl/certs/portal.selfsigned.crt
(附注:我正在使用.insecure
作为密钥文件,因为该文件不是密码保护的,而且我想清楚地看到它是一个不安全的密钥文件)
所以,当我重新启动Apache,我得到以下消息:
Syntax error on line 39 of /etc/apache2/sites-enabled/500-portal-https: SSLCertificateKeyFile: file '/etc/ssl/private/server.insecure.key' does not exist or is empty Error in syntax. Not restarting.
但文件在那里,并不是空的(实际上它包含一个私钥):
sudo ls -l /etc/ssl/private/server.insecure.key -rw-r----- 1 root www-data 887 2012-08-07 15:14 /etc/ssl/private/server.insecure.key sudo ls -ld /etc/ssl/private/ drwx--x--- 2 root www-data 4096 2012-08-07 13:02 /etc/ssl/private/
我试图改变所有权,使用两个组www-data和ssl-cert。 我不确定在Ubuntu中哪个是正确的:在默认情况下,Ubuntu使用ssl-cert,但是另一方面,使用用户www-data运行的apache进程:它由用户root启动,但是在一些点,我不知道什么时候证书读取。
但无论如何,改变集团老板并没有改善这种状况。 我的问题是:
/etc/ssl/certs/portal.selfsigned.crt
)一起工作? 我认为Apache给出了一个误导性的错误信息,我想指出错误。
我发现错误。 这是因为我正在使用脚本来设置证书,我正在执行的步骤之一是apache2ctl configtest
。 错误来自这个命令,而不是从apache重新启动,这是什么误导我。 由于我以普通用户的身份运行apache2ctl命令,因此无法访问密钥文件,从而出现错误消息。
Facit:确保所有的apache命令都使用sudo运行,即使是仅用于语法validation( apache2ctl
)的命令,因为它们都需要访问密钥。
我也收到消息
SSLCertificateKeyFile: file '/path/to/file' does not exist or is empty
而/path/to/file
存在并且具有正确的权限,只是因为打开了SELinux,并且这个文件对于apache用户是无法访问的。
它看起来像这样:
$ sudo ls -laZ /etc/pki/tls/certs/ drwxr-xr-x. root root system_u:object_r:cert_t:s0 . drwxr-xr-x. root root system_u:object_r:cert_t:s0 .. -rw-------. root root unconfined_u:object_r:cert_t:s0 this-one-works.crt -rw-------. root root unconfined_u:object_r:admin_home_t:s0 this-one-is-unaccessable.crt
为了解决这个问题,我运行sudo restorecon -Rv /etc/pki/tls/certs/
– 它将修复问题文件的SELinux属性。
我已经做到了这一点,它帮助我在CentOS 5.7
server:~ # chcon -t cert_t /etc/pki/tls/private/my.key server:~ # ls -laZ /etc/pki/tls/private/
我收到了类似的消息:
SSLCertificateChainFile: file '/opt/bitnami/apache2/conf/DigiCertCA.crt\xe2\x80\x9d' does not exist or is empty
我的问题是我使用的文本编辑器放置了一个“正确的报价”ascii 148而不是一个正常的双引号ascii 34; 使用一个unixtypes的编辑器(如TextWrangler)把正确的报价和解决问题。
权限是错误的,但根据你的答案,这不是问题的原因:
drwx--x--- 2 root www-data 4096 2012-08-07 13:02 /etc/ssl/private/
/ etc / ssl / private通常属于基于debian的系统上的ssl-cert组。
只注意到了0710烫发,并想知道它可以用于什么。