上下文:安装了 SSL 的生产服务器。运行 Apache 服务器。 PHP.
问题:对于特定的 url,例如(例如:www.domain.com/whatever/edit/*),我想要求用户使用他们的证书来验证他们的特定任务。
我读到这种身份验证方式称为双向身份验证 SSL。不知道我说的对不对。
我试过的服务器配置如下
<VirtualHost _default_:433>
ServerAdmin webmaster@localhost
DocumentRoot /Applications/MAMP/htdocs/smartdataprotection/web/
Options FollowSymLinks
Options Indexes FollowSymLinks MultiViews
LogLevel warn
ErrorLog /var/log/apache2/error.log
CustomLog /var/log/apache2/ssl_access.log combined
SSLEngine on
SSLCertificateFile /Applications/MAMP/htdocs/certificates/server.cer
SSLCertificateKeyFile /Applications/MAMP/htdocs/certificates/server.key
SSLOptions +StdEnvVars
# Below for 2 way ssl
SSLVerifyClient require
SSLVerifyDepth 10
SSLCACertificateFile /Applications/MAMP/htdocs/certificates/ca.cer
我想得到的是类似于以下屏幕截图的内容:
非常感谢您提供任何帮助,我们将非常欢迎并非常感谢。
问候。
最佳答案
我认为你错过了 SSLCipherSuite
directive .在 apache 文档中:
This complex directive uses a colon-separated cipher-spec string consisting of OpenSSL cipher specifications to configure the Cipher Suite the client is permitted to negotiate in the SSL handshake phase.
另外,通常您希望在特定位置使用证书登录站点,而不是直接在 www.yourdomain.com 中,例如在带有转到 wwww.yourdomain.com/yourApp/loginCert
的按钮链接中所以你必须配置 <Location>
在<VirtualHost>
里面.
最后检查 SSLCACertificateFile
directive中指示的文件,此文件是 PEM
中 CA 证书的串联格式,它颁发允许登录您的站点的证书,如果您的证书不是由此文件中的 CA 之一颁发的,它们将不会显示在浏览器弹出窗口中。
配置可能如下所示:
<VirtualHost _default_:433>
...
<Location /yourApp/loginCert>
SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
SSLCACertificateFile conf/trustedCA.cer
SSLVerifyClient required
SSLVerifyDepth 10
SSLOptions +StdEnvVars +ExportCertData +OptRenegotiate
</Location>
希望对您有所帮助,
关于php - PHP 证书。两种方式的身份验证 ssl。 Apache ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28285046/