最近接到客户反馈,网站已经在多个方面上做好了源站IP保密工作,并且在接入高防cdn之后源站服务器仍然遭受到多次ddos攻击,通过多方面排查基本确定泄露网站源站服务器IP的原因是因为ssl证书。
市面上很多工具爬虫24小时不停的抓取扫描IP,这类的工具网站通过无差别HTTP/HTTPS请求所有的IP,并将抓取到的IP地址所对应的网站记录到网站,以至于有些攻击者可以通过这类的网站可以直接查询到网站源站IP,因此我们在搭建网站的时候一定要做好屏蔽安全工作。
排查是否属于上述问题:通过https://你的源站IP,如果可以访问并且浏览器左上角锁的标志中显示了你的域名ssl证书那么就存在泄露的风险。
解决方案
宝塔面板用户可添加一个随意的网站1.1.1.1(域名或者IP随意),然后删除宝塔创建网站默认生成的全部文件,然后为这个随意添加的网站配置一个无效的证书(本文下方会为大家提供一个无效的证书使用),配置好证书之后在宝塔面板后台:【网站】-【默认站点】中心选择刚才添加的这个随意的网站作为默认站点。
证书(PEM格式)
-----BEGIN CERTIFICATE-----
MIID2TCCAsGgAwIBAgICQyIwDQYJKoZIhvcNAQELBQAwczELMAkGA1UEBhMCQ04x
EDAOBgNVBAgMB1RpYW5qaW4xEDAOBgNVBAcMB1RpYW5qaW4xFTATBgNVBAoMDENI
SU5BU1NMIEluYzEpMCcGA1UEAwwgQ0hJTkFTU0wgQ2VydGlmaWNhdGlvbiBBdXRo
b3JpdHkwHhcNMjIwNzE2MTQ1MDE0WhcNMjMwNzE2MTQ1MDE0WjB/MQswCQYDVQQG
EwJDTjEQMA4GA1UECAwHdGlhbmppbjEKMAgGA1UECgwBMTELMAkGA1UECwwCaXQx
JjAkBgNVBAMMHXd3dy5kc2dmc2RnZHNnZHNnc2Rnc2Rnc2QuY29tMR0wGwYJKoZI
hvcNAQkBFg4xOTExMDA2QHFxLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC
AQoCggEBAL0OnjqcAUkfvH05du4JpelkrGUHWeZgO/iyxf12oOJV1x7YzEYIJLL6
++PMt4yQEO5tApDg4Evi7R+fOmVd8fSY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RsinUloN0Yrmk2rQtMeiVHxxK4uoa
57TVmDUxbkSxiEDQYAHIRYufSiB6HlvM28YLs+B63QF6ahX4SAtMr30KPw5HLDgc
O76dyv9sSWb2mMe5jd+uqcQXnV10zH49HDMFRdMgtvECgYEA9TBOzBTR2Pivh1N5
TAl1+uIv9Vq780+PIHHBKSf7WkZ78ekK7SyDKL0sTDTyy8IUOiatyPH5CSoqLYAz
AGswsXGzdZjxTPiulrDuMIpPIf3Ch06xNe7/1WaHrdqLRZPZp7FQJsFC+U1/gL9a
7Uaq+UQy/JBccdrV6YMFThZYmsc=
-----END PRIVATE KEY-----
以上证书为随意生成的一个无效域名ssl证书,可用于预防ssl证书泄露IP所导致的风险问题,证书过期也可以继续使用,不影响预防IP泄露风险的效果(有动手能力的朋友也可以自行生成ssl证书)。