gpt4 book ai didi

ssl - 强制 nginx 验证上游证书

转载 作者:太空宇宙 更新时间:2023-11-03 12:51:45 26 4
gpt4 key购买 nike

我正在尝试在代理路径的每一层建立 TLS。我看到的是 Nginx 允许上游拥有自签名证书。有什么方法可以锁定将流量传递到上游时接受的权限吗?

end-user  --1-->  nginx01  --2-->  nginx02  --N-->  nginxN

nginx01 具有受信任的证书,最终用户可以毫无问题地进行连接。nginx02 有一个自签名证书,当我 proxy_pass 到 https://nginx02我没有在最终用户浏览器或 nginx01 日志中看到任何投诉。我希望被拒绝。如果我按预期从 nginx01 curl nginx02,我会收到 ssl 拒绝。

有什么方法可以强制 nginx01 验证 nginx02 证书吗?

运行 nginx 1.6.3-8 的 CentOS 7。

/etc/hosts
10.21.10.99 upstream.example.com

curl https://upstream.example.com
# ssl rejection

curl https://upstream.example.com --cacert ./upstream.example.com.crt
# works fine (200)

# nginx configuration
server {
listen 443;
ssl on;
ssl_certificate /etc/nginx/security/full_chain.crt;
ssl_certificate_key /etc/nginx/security/ingress.example.com.key;
server_name ingress.example.com;
location / {
proxy_pass https://upstream.example.com;
}
}

最佳答案

使用

proxy_ssl_verify on;
proxy_ssl_trusted_certificate /path/to/your_selfsigned_ca_cert.pem

有关更多详细信息,您可以引用 nginx 代理文档 here

关于ssl - 强制 nginx 验证上游证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36507852/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com