使用Apache,我创建了一个HTTPS站点,其中包含一个名为secure的文件夹,我希望通过用户和密码访问该文件夹,并创建了另一个名为verysecure的文件夹,我希望通过证书身份验证访问该文件夹。
当我使用https://www.example.com/访问站点时,我会得到根目录中的默认index.html文件,就像预期的那样。当我访问https://www.example.com/secure/时,我提供用户和密码,并获取位于该文件夹中的index.html文件。当我访问https://www.example.com/verysecure/时,证书弹出窗口允许我选择我想要使用的证书,在这样做的时候,我就可以获得位于该文件夹中的index.html文件。
如何配置Nginx,使证书选择器弹出窗口只在我访问https://www.example.com/verysecure/时出现,而不是当我访问https://www.example.com/或https://www.example.com/secure/时?
发布于 2020-11-19 02:20:18
根据官方nginx开发论坛的这线程,你不能(虽然这个线程已经有10年的历史了,但是SSL/TLS重新握手仍然不支持nginx)。Igor Sysoev建议的唯一解决办法是使用可选的客户端证书验证。
ssl_verify_client optional;然后检查$ssl_client_verify变量值:
location /verysecure/
if ($ssl_client_verify != SUCCESS) {
# deny client
return 403;
# or process the request on some internal location, see
# http://nginx.org/en/docs/http/ngx_http_core_module.html#internal
# rewrite ^ /internal last;
}
...
}但是,使用此方法,证书选择器窗口将弹出(只有安装了正确证书的客户端的)在初始TLS握手时,而不仅仅是在访问/verysecure/ URI时。
https://stackoverflow.com/questions/64899709
复制相似问题