别让 SSL 证书暴露了你的源站 IP
- 取得連結
- X
- 以電子郵件傳送
- 其他應用程式
杂谈
有很多站长(比如我)选择为自己的网站套上cdn,比起加速效果我相信更多人是为了保护自己那脆弱可怜幼小无助的源站ip不被人发现,不过有亿些平台 例如 https://search.censys.io/ 会通过nginx的‘特性’来批量扫描 https://ip 以通过ssl证书获取ip与源站的对应关系
大概的原理就是在使用nginx的服务器上如果你没有给你的ip绑定一个默认站点,那么访问 https://你的ip 就可以访问到你服务器上最新的站点,即使你像百度一样设置了405之类的状态码,也可以通过查看ssl证书来知道你这个ip对应的是哪个网站
别问人家不知道你的域名怎么知道的你的ip,问就是批量扫的,如果扫到了那就是简单的对应关系了
看到这个证书就能发现 [220.181.38.148] 对应的是 baidu.cn,那么反过来baidu.cn对应的源站IP之一就是220.181.38.148
所以说我就中招了(删库跑路中)
百度就更不用说了
至于解决方法也很简单(如果你还没中枪),这里用宝塔面板演示一遍(中枪了就赶紧换ip吧)
首先给你的服务器添加一个站点
添加完成以后把你的ip默认站点绑定为你刚刚新添加的站点
接下来访问 https://myssl.com/create_test_cert.html 来自定义一个ssl证书,这里我把我弄好的放在这,需要的可以自取
密钥(KEY)
-----BEGIN RSA PRIVATE KEY-----MIIEowIBAAKCAQEA3JC1fwAf2pFCZsRHBoxNUq2WCZzofhrctHok7c2JXawWOQa9kvYIKkEnWOIfHfmiF+6CGDr4yCgv17qs6ms2i3iIVS5uxarMp7TWQSRReRq5YH4Lr0sIHo5tWhQ5TDUmcVDKVwQIVZF16mP3a5gdKTf9O9TIGst9TB5teVGfwXCbyBZfvKa6dW4cq0nLnbc85jI+b9DRq21w/UfrwAbMjF5CwArTlW8WnkUkKiFXEyMz2mr4A7OiiPuhFcY3tiwkZS1/RpbJcNplLcR//SWELe/fKurAVinaZsR0NsfLM3ADoAZV2FnYqFP0SlmjopLcrr0dCyBy775jszSzkkdF8QIDAQABAoIBAQCKUM0gaWmQXQtw+qE3wAA1Wtn+CUHa4umI3BgQcJY2AdalyE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bKc+ITAE5QBRhCTQ0ah2Hq846ZiDAj6sYhMJuhUWegVGd0vh0rvtzvYNx7NGyxzoj6MxkDiYfFiuBhF2R9Tmq2UW9KCZkEBVLQ/YKQuvZZKFqR7WUU8GpCwzUm1FZbKtaCyRRvzLa5otghU2teKS5SKVI+Tpxvaspfu4eXBvveMgyWwDpKlzLCLgvoC9YNpbmdiVxNNkjwNsCAwEAAaN0MHIwDgYDVR0PAQH/BAQDAgGGMA8GA1UdJQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBSa8Z+5JRISiexzGLmXvMX4oAp+UzAdBgNVHQ4EFgQUKIEmBdE0Gj/Bcw+7k88VHD8Dv38wDQYJKoZIhvcNAQELBQADggEBAEl01ufit9rUeL5kZ31ox2vq648azH/r/GR1S+mXci0Mg6RrDdLzUO7VSf0JULJf98oEPr9fpIZuRTyWcxiP4yh0wVd35OIQBTToLrMOWYWuApU4/YLKvg4A86h577kuYeSsWyf5kk0ngXsL1AFMqjOkTc7p8PuW68S5/88Pe+Bq3sAaG3U5rousiTIpoN/osq+GyXisgv5jd2M4YBtl/NlDppZs5LAOjct+Aaofhc5rNysonKjkd44K2cgBkbpOMj0dbVNKyL2/2I0zyY1FU2MkURUHyMW5Qd5Q9g6Y4sDOIm6It9TF7EjpwMs42R30agcRYzuUsN72ZFBYFJwnBX8=-----END CERTIFICATE-----
然后把这个生成好的证书绑定到新建的站点
现在你就可以访问 https://你的ip 来查看证书效果了(下图是上面的证书的效果)
当然,如果你想当一个文明好市民,那你可以用下面这个证书
密钥(KEY)
-----BEGIN RSA PRIVATE KEY-----MIIEowIBAAKCAQEAqeaBTP1WqVuSjS3b/1Io1VyW+y4EGYZUGNovQTLQaGMihFF73birFJDCtiut5puIVzICH3A1VZSh19vMaGus2f5Uydg0M1qV8whCmA7mSDlF+ZSoSlRf1ntWU0oamfLRNAft07Cu1LZMaxW7SMIuutXu/bAImxqtHOygHKz8MMgqQz//Bv6T+IU1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Oupq7G7lwXkCyViTYAFa3wZ0BMQ4Bl9Q4j82R5IaoqG7WRIklwYnQh4gZ14uRde6Mr8yzvPRbAXKVoVh4NPqpE6jWMTP38mh94bKc+ITAE5QBRhCTQ0ah2Hq846ZiDAj6sYhMJuhUWegVGd0vh0rvtzvYNx7NGyxzoj6MxkDiYfFiuBhF2R9Tmq2UW9KCZkEBVLQ/YKQuvZZKFqR7WUU8GpCwzUm1FZbKtaCyRRvzLa5otghU2teKS5SKVI+Tpxvaspfu4eXBvveMgyWwDpKlzLCLgvoC9YNpbmdiVxNNkjwNsCAwEAAaN0MHIwDgYDVR0PAQH/BAQDAgGGMA8GA1UdJQQIMAYGBFUdJQAwDwYDVR0TAQH/BAUwAwEB/zAfBgNVHSMEGDAWgBSa8Z+5JRISiexzGLmXvMX4oAp+UzAdBgNVHQ4EFgQUKIEmBdE0Gj/Bcw+7k88VHD8Dv38wDQYJKoZIhvcNAQELBQADggEBAEl01ufit9rUeL5kZ31ox2vq648azH/r/GR1S+mXci0Mg6RrDdLzUO7VSf0JULJf98oEPr9fpIZuRTyWcxiP4yh0wVd35OIQBTToLrMOWYWuApU4/YLKvg4A86h577kuYeSsWyf5kk0ngXsL1AFMqjOkTc7p8PuW68S5/88Pe+Bq3sAaG3U5rousiTIpoN/osq+GyXisgv5jd2M4YBtl/NlDppZs5LAOjct+Aaofhc5rNysonKjkd44K2cgBkbpOMj0dbVNKyL2/2I0zyY1FU2MkURUHyMW5Qd5Q9g6Y4sDOIm6It9TF7EjpwMs42R30agcRYzuUsN72ZFBYFJwnBX8=-----END CERTIFICATE-----
这个证书的效果如下图,是一个空证书
到这里你那脆弱可怜幼小无助的源站ip就暂时安全了(或许吧)
当然,你可以自定义一下IP对应站点的页面,比如
<!DOCTYPE html><html><head><meta charset="utf-8"><title>404 Not Found</title></head><body><center><h1>别扫了,劳资的网站也是你能扫得到的?</h1></center><hr><center>https://search.censys.io/</center></body></html>
大家伙学会了以后千万别想方设法来找我的源站打 求求了(要打就打猪头🐷的)
参考链接
- 原文链接 (本人的博客) https://i0h.cn/archives/102
- 取得連結
- X
- 以電子郵件傳送
- 其他應用程式
留言
張貼留言