我处于以下情况。我需要设置与外部系统的双向集成。外部系统的管理员要求我发送两个 CSR,一个用于生成客户端证书,另一个用于生成服务器证书。他们寄给我相应的证书。我设置了通道 me-> they 成功(即:我可以调用他们的服务提供我的客户端证书),但我无法正确设置反向通道(即:我无法让我的 Apache 接受他们的客户端证书没有抱怨)。
连同我的服务器证书(我们称之为 my-server.pem),他们还向我发送了他们自己的客户端证书(我们称之为 their-client.pem)。该证书(他们的客户端.pem)由“自签名”CA 发出,该 CA 不在我的 Linux 系统中已经可用的那些知名 CA 中。我没有这个证书,我还不能从外部系统管理员那里得到它(他们不情愿...让我们搁置对此的任何评论...>-|)
这是我在 Apache 中设置 VirtualHost 的方式:
SSLEngine on
SSLCertificateFile /path/to/my-server.pem
SSLCertificateKeyFile /path/to/my-server-secret-key.key
SSLVerifyClient require
SSLCACertificateFile /path/to/their-client.pem
SSLVerifyDepth 0
Run Code Online (Sandbox Code Playgroud)
由于我没有 CA 证书,而且我完全可以说“只相信该客户端证书,没有其他人!”,我将客户端证书本身作为SSLCACertificateFile
,如以下答案中所建议的:
https:// security.stackexchange.com/questions/36069/use-client-certificate-using-self-signed-ca-while-using-web-certificate-of-a-pub
但是,这似乎不起作用。他们看到的错误是:
javax.net.ssl.SSLException: Received fatal alert: unknown_ca
Run Code Online (Sandbox Code Playgroud)
启用 SSL 日志并将其设置为调试后,我看到的是:
[ssl:debug] [pid 3396] ssl_engine_kernel.c(1381): [client <their-ip>:41474] AH02275: Certificate Verification, depth 1, CRL checking mode: none [subject: CN=Test CA,OU=Foo,O=Bar,C=it / issuer: CN=Test CA,OU=Foo,O=Bar,C=it / serial: 1BFE / notbefore: Dec 6 15:22:45 …
Run Code Online (Sandbox Code Playgroud) ssl certificate ssl-certificate certificate-authority apache-2.4