mon*_*rix 7 ssl httpd openssl ssl-certificate certificate-authority
我有一个签名的 CA,由我的大学颁发。我使用他们的公钥文件生成了我的 CSR,如下所示:
openssl genrsa -out myservername.key 2048 (new key)
openssl req -new -key myservername.key -out myservername.csr
Run Code Online (Sandbox Code Playgroud)
我给他们发了 CSR,他们给我发回了签名的 .crt 文件。
我为我的 CA 密钥和证书创建了一个目录并将它们放在那里。
我的 httpd.conf 的相关部分如下所示:
<VirtualHost _default_:443>
SSLEngine on
SSLCACertificateFile /var/cosign/certs/CA/publickey.pem
SSLCertificateFile /var/cosign/certs/myserver.crt
SSLCertificateKeyFile /var/cosign/certs/myserver.key
DocumentRoot /var/www/html/
<Directory /var/www/html>
Options -Indexes
AllowOverride All
</Directory>
Run Code Online (Sandbox Code Playgroud)
但它没有将此证书用于 SSL。如果我执行此命令:
openssl s_client -connect localhost:443 -showcerts
Run Code Online (Sandbox Code Playgroud)
我明白了:
CONNECTED(00000003)
depth=0 C = --, ST = SomeState, L = SomeCity, O = SomeOrganization, OU = SomeOrganizationalUnit, CN = portcharlotte, emailAddress = root@portcharlotte
verify error:num=18:self signed certificate
verify return:1
depth=0 C = --, ST = SomeState, L = SomeCity, O = SomeOrganization, OU = SomeOrganizationalUnit, CN = portcharlotte, emailAddress = root@portcharlotte
verify return:1
---
Certificate chain
Run Code Online (Sandbox Code Playgroud)
我的 CSR 包含了正确的细节,而不是这个“SomeState”、“SomeCity”的废话,我猜这是默认的。
openssl 模块已安装并加载。
我在日志中遇到的唯一错误是:
[Fri Jan 25 13:27:40 2013] [warn] RSA server certificate is a CA certificate (BasicConstraints: CA == TRUE !?)
[Fri Jan 25 13:27:40 2013] [warn] RSA server certificate CommonName (CN) `portcharlotte' does NOT match server name!?
Run Code Online (Sandbox Code Playgroud)
我猜这种不匹配是因为它使用了错误的证书。
我的问题是,如何使它使用正确的?我错过了什么?
ada*_*ptr 11
SSLCACertificateFile /var/cosign/certs/CA/publickey.pem
除非该 PEM 文件实际上包含您希望授予访问权限的客户端证书的 CA 证书,否则这是不正确的;要为 apache 提供证书链,请SSLCertificateChainFile
改用。
Apache 必须具有实际证书和用于签署/生成端点证书的任何中间证书,直至并包括浏览器信任的根证书。
要验证他们给您的证书,请运行:
openssl verify -CApath /path/to/CA/certs -purpose sslserver -verbose /your/certificate
Run Code Online (Sandbox Code Playgroud)
除了证书问题之外,您还缺少SSLRequireSSL
vhost 中的指令;没有它,apache 将不会检查安全连接。
您也不应该_default_
用作虚拟主机,并且您缺少ServerName
.
使用 *:443 或 IP:443 作为虚拟主机。
每个 vhost 都必须设置有效的 ServerName,此外,SSL vhost 必须具有对应于证书 CN 的 ServerName。
例如:
<VirtualHost 1.2.3.4:443>
ServerName your.certificates.common.name
ServerAlias any.subject.alternate.names
DocumentRoot /your/protected/content
SSLEngine On
SSLCertificateChainFile /path/to/your/issuers/CA/cert/bundle
SSLCertificateFile /path/to/your/certificate.crt
SSLCertificateKeyfile /path/to/your/private.key
-OR-
SSLCertificateFile /path/to/your/combined.cert-and-keyfile
SSLRequireSSL
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
27136 次 |
最近记录: |