惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LINUX DO - 热门话题
U
Unit 42
博客园 - 司徒正美
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
J
Java Code Geeks
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Hugging Face - Blog
Hugging Face - Blog
aimingoo的专栏
aimingoo的专栏
GbyAI
GbyAI
P
Privacy International News Feed
T
Threatpost
Microsoft Azure Blog
Microsoft Azure Blog
NISL@THU
NISL@THU
T
Tenable Blog
P
Privacy & Cybersecurity Law Blog
L
Lohrmann on Cybersecurity
The Last Watchdog
The Last Watchdog
AWS News Blog
AWS News Blog
C
Cisco Blogs
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
Microsoft Security Blog
Microsoft Security Blog
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
Y
Y Combinator Blog
人人都是产品经理
人人都是产品经理
C
Cybersecurity and Infrastructure Security Agency CISA
D
Darknet – Hacking Tools, Hacker News & Cyber Security
G
GRAHAM CLULEY
Google DeepMind News
Google DeepMind News
H
Help Net Security
A
Arctic Wolf
Stack Overflow Blog
Stack Overflow Blog
S
Security Affairs
S
Securelist
Application and Cybersecurity Blog
Application and Cybersecurity Blog
云风的 BLOG
云风的 BLOG
Last Week in AI
Last Week in AI
L
LangChain Blog
博客园 - 【当耐特】
L
LINUX DO - 最新话题
Security Archives - TechRepublic
Security Archives - TechRepublic
Blog — PlanetScale
Blog — PlanetScale
N
News | PayPal Newsroom
B
Blog RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
S
Security @ Cisco Blogs
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Troy Hunt's Blog

杂烩饭

使用 RustFS 自建对象存储 使用cURL命令管理对象存储(s3) AGENTS.md Prometheus使用kubeconfig做k8s的service 自动发现监控 定制Windows系统镜像iso 使用create-dmg工具制作dmg安装包 使用create-dmg工具制作dmg安装包 - 技术栈 superpowers Nexus仓库搭建记录 Git Merge代码冲突的解决方式 在 Linux 系统中安装与配置 OpenVPN:从入门到精通 使用 Easytier-web 管理 easytier 节点 ingress-nginx 去除指定context path 在macOS上使用MusicPlayer2听本地音乐 Kubernetes 1.34 + RHEL10 + Cilium + kube-vip 高可用集群部署 使用腾讯云CLS收集TKE(k8s)业务日志 容器调试工具之BusyBox 无Docker环境进行容器镜像操作 使用kubeadm部署一套高可用k8s集群1.34 for Ubuntu 正在运行的Docker容器增加端口映射 轻量级组网工具WireGuard 在Kubernetes中部署一个单节点Elasticsearch 使用openssl制作自签名双向认证(mTLS)证书 minio自建对象存储 ingress-nginx 使用自定义的nginx配置 P12格式证书与PEM格式转换 使用blackbox-exporter做域名监控 记一次MySQL字符集转换导致的故障 使用双向认证增加git仓库安全性 Prometheus自动监控K8S集群中的service Grafana 查询SQL 自定义变量 使用selenium来实现Grafana的自动截图
在 Nginx 中禁止 IP 直连与域名暴露
张理坤 · 2026-07-22 · via 杂烩饭

说明

比如漏洞扫描工具会扫描出这种漏洞(直接访问 https://1.1.1.1 ):
SSL Certificate Is About To Expire
SSL Certificate Name Hostname Mismatch
只是 Nginx 开放到公网,也并不会直接通过 IP 地址来访问,为了消除这个漏洞影响。

不返回数据

可以修改 nginx 的默认站点配置,直接返回 444(444 状态码是 Nginx 特有的,即直接关闭链接)

1
2
3
4
5
6
7
8
9
10
11
server {
listen 80 default_server;
listen 443 ssl default_server;

ssl_certificate /etc/nginx/ssl/xxxx.com.crt;
ssl_certificate_key /etc/nginx/ssl/xxxx.com.key;

server_name _;
return 444;
}

这是一个最简单的配置,配置完成后,浏览器访问效果:
image.png

虽然不返回数据了,但是还是会泄露证书信息。

禁止发送证书

加上配置:ssl_reject_handshake on

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
server {
listen 80 default_server;
listen 443 ssl default_server;

ssl_certificate /etc/nginx/ssl/xxxx.com.crt;
ssl_certificate_key /etc/nginx/ssl/xxxx.com.key;

server_name _;
ssl_reject_handshake on;
return 444;
}

server {
listen 80 ;
listen 443 ssl ;

ssl_certificate /etc/nginx/ssl/xxxx.com.crt;
ssl_certificate_key /etc/nginx/ssl/xxxx.com.key;

server_name a.xxxx.com;

default_type text/html;
return 200 "hello";
}

IP 地址直接访问的效果,不但被禁止打开。而且浏览器里看不到证书信息。

image.png

访问正常的域名正常:
image.png

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 杂烩饭