服务热线:400-886-6615

当前位置: 网站首页 > 学院 > 网站运营

常见域名恶意解析指向至服务器的解决方法

发布时间:2021-01-07
阅读:894

标签

恶意解析 域名解析

一、恶意指向

目前存在一些用户将自己的域名解析指向他人的服务器,而那台服务器上事实并没有相应的站点,这种情况称之为恶意指向。但可能在服务器上设置了空主机头,访问这个域名时会直接访问指向了这个空主机头的站点内容,严重影响客户的备案工作。

为防止有效的恶意指向,对常见两种WEB服务器进行简单设置。


二、常见WEB服务器的解决方法

主要是绑定所有站点,禁用空主机头或默认站点,只能基于域名的访问方式,不使用基于IP,下面介绍IIS与APACHE的设置方法。


1、IIS的设置方法

IIS默认中,将任何站点都绑定到固定的域名,不可以留空主机头,这样没有绑定主机头的域名恶意指到此IP,默认会提示400错误,参考下图。


2、Apache 的设置方法

Apache可以通过禁用第一个虚拟站点。

打开apache的配置文件,通常是httpd.conf文件,使用基于域名的访问方式。必须有下面的指令,Apache的第一个虚拟站点即为默认站点,必须对此站点进行限制。

NameVirtualHost *

设置第一个虚拟站点,设置一个禁止访问的站点,apache则会提示403的禁止访问的错误。

    ServerName www.firstdisabledsite.com 
    DocumentRoot /www/domain

下面可以设置其它有效站点了

    ServerName www.otherdomain.tld
    DocumentRoot /www/otherdomain

 

三、检查方法介绍

Linux系统下可通过命令wget或curl,查看主机头信息,正常网站多为200、30X等错误,停止或禁止访问的多为40X错误。


1、正常网站(200)

root@hostname ~]#wget -S http://www.sina.com.cn 或 curl -I http://www.sina.com.cn
--14:34:32--  http://www.sina.com.cn/
           => `index.html.1'
Resolving www.sina.com.cn... 61.172.201.194
Connecting to www.sina.com.cn|61.172.201.194|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.0 200 OK
  Date: Wed, 09 Dec 2009 06:30:15 GMT
  Server: Apache/2.0.54 (Unix)
  Last-Modified: Wed, 09 Dec 2009 06:29:44 GMT
……

2、跳转的网站(301)

[root@hostname ~]# wget -S http://www.abc.com或 curl -I http:// http://www.abc.com
--14:36:36--  http://www.abc.com/
           => `index.html.2'
Resolving www.abc.com... 199.181.132.250
Connecting to www.abc.com|199.181.132.250|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 301 Moved Permanently
  Date: Wed, 09 Dec 2009 06:54:25 GMT
  Server: Apache
  Location: http://abc.go.com/
  Content-Length: 226
  Connection: Keep-Alive

3、停止的网站(404)

[root@hostname ~]# wget -S http://sample.srt.cn
--14:38:14--  http://sample.srt.cn/
           => `index.html'
Resolving sample.srt.cn... 192.168.0.1
Connecting to sample.srt.cn|192.168.0.1|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 400 Bad Request
  Content-Type: text/html
  Date: Wed, 09 Dec 2009 06:36:34 GMT
  Connection: close
  Content-Length: 39
14:38:14 ERROR 400: Bad Request

4、apache下禁止访问的站点(403)

[root@hostname ~]# wget -S http://sample1.srt.com.cn
--14:44:29--  http://sample1.srt.com.cn/
           => `index.html'
Resolving sample1.srt.com.cn... 1.2.3.234
Connecting to sample1.srt.com.cn|1.2.3.234|:80... connected.
HTTP request sent, awaiting response... 
  HTTP/1.1 403 Forbidden
  Date: Wed, 09 Dec 2009 06:43:42 GMT
  Server: Apache/2.2.3 (Red Hat)
  Content-Length: 405
  Connection: close
  Content-Type: text/html; charset=iso-8859-1
14:44:29 ERROR 403: Forbidden.