[英]nginx ssl rejecting non matched server_name requests
server {
lerver {
listen 443 ssl;
server_name proxy.test.com;
ssl_certificate sni.crt;
ssl_certificate_key sni.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
root html;
index index.html index.htm;
}
}
server {
listen 443 default_server ssl;
server_name test.com;
ssl_certificate test-cn.crt;
ssl_certificate_key test-cn.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
root html;
index index.html index.htm;
}
}
我想用 ssl 配置 nginx 以接受 SNI 請求(來自客戶端的 ClientHello 中的 server_name 指令),拒絕與不匹配的 server_name SNI 請求的握手,並為非 SNI 請求提供默認證書(沒有 server_name 指令的 ClientHello)。
通過上述配置,我可以讓 nginx 接受對 proxy.test.com 的 SNI 請求。 但是對於 SNI 請求為 invalid-domain.com 的 ClientHello 和沒有 SNI 請求的 ClientHello,使用默認服務器塊。 如何讓 nginx 拒絕對 invalid-domain.com 的 SNI 請求,同時為非 SNI 請求設置默認服務器塊?
我遇到了 nginx 的這個新功能,如果請求的 server_name 與您在服務器指令中列出的內容不匹配,它甚至會在發送 server_hello 之前刪除請求。 我認為這將有助於完成您想要做的事情。 除非 SNI 與 proxy.test.com 匹配,否則以下配置應將所有請求丟棄到 443。
server {
listen 443 ssl;
ssl_reject_handshake on;
}
server {
listen 443 ssl;
server_name proxy.test.com;
ssl_certificate sni.crt;
ssl_certificate_key sni.key;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
root html;
index index.html index.htm;
}
}
鏈接到文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.