【发布时间】:2017-07-04 06:30:02
【问题描述】:
我为两种方式的 ssl 配置了一个 Spring Boot 服务,以使用证书验证客户端。它位于 nginx 代理服务器后面。因此要求配置 nginx 以提供来自客户端的透明 https 连接,并将客户端证书转发到要验证的 web 服务(后端)。还可以为不需要客户端身份验证的其他服务配置一种方式 ssl。
类似:
|客户| -->httpS + 客户端证书--->|NGINX|--->httpS + 客户端证书--->|服务1|
|客户| ------------>httpS------------>|NGINX| ------------>http------------>|服务2|
我的 nginx 配置:
server {
listen 443;
server_name xx.xx.xx.xxx;
ssl on;
ssl_certificate /path/to/server/cert.crt;
ssl_certificate_key /path/to/server/key.key;
ssl_client_certificate /path/to/ca.crt;
ssl_verify_client optional;
location /service1/ {
proxy_pass https://service1:80/;
#Config to forward client certificate or to forward ssl connection(handshake) to service1
}
location /service2/ {
proxy_pass http://service2:80/;
#http connection
}
}
另外,有没有办法从证书中获取公用名来验证客户端并在 nginx 中做出决定?因为使用 CA 是不够的。
谢谢..
【问题讨论】:
标签: ssl nginx https certificate x509