这里说的域名注册商不是域名分销或代理商, 进入正题。在此以前先说下项目中用到的几个知识点。html
a什么是域名?数据库
域名(Domain Name),是由一串用点分隔的名字组成的Internet上某一台计算机或计算机组的名称,用于在数据传输时标识计算机的电子方位(有时也指地理位置,地理上的域名,指代有行政自主权的一个地方区域)。域名是一个IP地址上有“面具” 。一个域名的目的是便于记忆和沟通的一组服务器的地址(网站,电子邮件,FTP等)。域名做为力所能及难忘的互联网参与者的名称,世界上第一个注册的域名是在1985年1月注册的,详细了解请看百度百科。api
b如何成为一个域名注册商安全
申请注册商不是经过ICANN服务器
只有申请根域名才是。通过ICANN认证的企业,须要公司规模、技术实力、服务标准、市场、资金情况等多方面具有较高的标准。从ICANN官方网站了解到,2010年后申请认证的企业,认证标准及难度较以往认证难度增长近一倍。经过ICANN认证后,还要向VeriSign(受ICANN委托的公司,负责.com/.net/.tv域名的注册管理业务)等管理公司申请相关域名的注册接口,再次对认证企业进行审核。很是复杂的程序。dom
c作为一个域名注册商还须要帮助客户解决域名解析,并提供WHOIS查询.ide
上面说到经过ICANN认证并向(这里以VeriSign为例)申请注册接口后,VeriSign会提供一些测试环境的帐号和资料,只有在测试环境中把诸如域名查询/域名生成/域名续期/域名转移等功能实现,最后能过VeriSign测试验收后才会进入正式帐号的下发流程。本着有图才有真像的原则这里上一张图。工具
VerSign的在线客服通常是周1-5在线,他们的中文客服部在澳大利亚的墨尔本,上午10点后才在线。他们的客服在你要修改敏感信息如IP白名单修改等操做时要经过电话(他只会打你在ICANN上留的电话)进行安全短语确认后才能进行。下面是一些资料.测试
注册商产品和工具http://www.verisign.com/zh_CN/channel-resources/domain-registry-products/epp-sdks/index.xhtml#chat网站
在线调试https://epptool-ctld.verisign-grs.com/epptool/
RFC 5730:扩展供应协议文档http://tools.ietf.org/html/rfc5730
由于Verisign只提供JAVA的DEMO,对JAVA不熟,只得用C#来写。下面这些东西不能少:一台带独立IP的服务器,一个Verisign支持的证书,和他们服务器的链接过程请看下图
这里用到了双向认证和非对称加密。下面是他们的服务器支持的证书类型,不在下面列表的证书可能会被他们的服务器拒绝链接。
Verisign supports SSL certificates from the Certificate Authority (CA) providers Symantec, Thawte, GeoTrust, and GoDaddy. All issued certificates must chain up to one of the following supported root CA certificates, grouped by provider:
Symantec
VeriSign Class 2 Public Primary Certification Authority - G3
VeriSign Class 3 Public Primary Certification Authority - G3
VeriSign Class 4 Public Primary Certification Authority - G3
VeriSign Trust Network
VeriSign Universal Root Certification Authority
VeriSign Class 3 Public Primary Certification Authority - G5
Class 1 Public Primary Certification Authority
VeriSign Class 1 Public Primary Certification Authority - G3
Class 3 Public Primary Certification Authority
VeriSign Class 3 Public Primary Certification Authority - G4
Symantec Class 1 Public Primary Certification Authority - G6
Symantec Class 2 Public Primary Certification Authority - G6
Thawte
Thawte Primary Root CA
Thawte Premium Server CA
Thawte Server CA
Thawte Primary Root CA - G2
Thawte Primary Root CA - G3
GeoTrust Primary Certification Authority - G2
GeoTrust
GeoTrust Universal CA
GeoTrust Primary Certification Authority
GeoTrust Universal CA 2
GeoTrust Global CA
GeoTrust Global CA 2
Equifax Secure Certificate Authority
GeoTrust Primary Certification Authority - G3
GoDaddy
Starfield Secure Certification Authority
Go Daddy Root Certificate Authority - G2
Starfield Secure Certification Authority
ValiCert Class 2 Policy Validation Authority
Starfield Class 2 Certification Authority
Starfield Root Certificate Authority - G2
Starfield Services Root Certificate Authority - G2
Go Daddy Class 2 Certification Authority
Starfield Services Root Certificate Authority
当时在验收测试时也花了很多精力,他们的验收文档是英文的,在这里我发下他们的验收流程,但愿对之后哪位兄弟有帮助
你须要完成全部27个指令,而后把开始时间,结束时间,还有开始OT&E1第一个指令的时间,和OT&E2最后一个指令的时间给咱们。
The start and end times for the test below
The domain name used during the test
The EPP server transaction ID from the operation in Step # 1 below. This is the Epp
Session command for the OT&E1 account.
The EPP server transaction ID from the operation in Step # 27 below. This is the
Epp Quit command for the OT&E2 account.
Extensible Provisioning Protocol
Registrar Acceptance Criteria
1,登陆帐号1
2,用帐号1查询一个可用域名
3,用帐号1购买一个域名年限2
4,建立子命名服务器1的使用命名服务器添加新建立的域命令你OT&E1账户登陆--建立一个域名服务器
5建立子新建立的域的名称服务器2使用添加名称空间命令你OT&E1账户登陆--再建立一个域名服务器
6更新域链接子域名服务器到新建立的域使用OT&E1账户登陆域的命令--把这两个域名服务器加到域名上去
7更新域添加域ClientHold客户状态,ClientUpdateProhibited、ClientDeleteProhibited ClientTransferProhibited内部
一个命令用OT&E1账户登陆--给域名添加ClientHold,
ClientUpdateProhibited, ClientDeleteProhibited, and ClientTransferProhibited这几种状态
8域上执行一个信息来验证使用STATUS-FULL更新用OT&E1账户登陆--用info指令查询该域名
9更新域删除域ClientHold客户状态,
ClientUpdateProhibited、ClientDeleteProhibited ClientTransferProhibited
用OT&E1账户登陆--给域名去除ClientHold,
ClientUpdateProhibited, ClientDeleteProhibited, and ClientTransferProhibited这几种状态
10域上执行一个信息来验证使用STATUS-FULL更新用OT&E1账户登陆
11用OT&E1账户更新域名密码
12更新的孩子命名服务器的IP地址1新建立的域的使用OT&E1账户登陆--修改域名服务器1的IP地址
13用帐号1发送HELLO
14用帐号1更新域名使用年限+2年
15登陆第二个帐号
16用帐号2查询INFO彻底状态
17用帐号2发起域名转移请求
18用帐号2发起域名转移查询
19用帐号1批准域名转移
20用帐号1执行POLL-REQUEST
21用帐号1执行POLL-ACK
22用帐号1发起域名转移请求
23用帐号2进行转移查询
24用帐号2进行转移拒绝
25用帐号2进行域名同步,日期为下个月15号
26退出帐号1
27退出帐号2
这里讲下咱们平时去查一个域名的WHOIS信息是怎么来的?
基于RFC 954提供的WHOIS协议
http://www.rfc-base.org/txt/rfc-954.txt
域名的查询主要是基于RFC 954提供的WHOIS协议。在上述过程当中,
咱们其实是访问了InterNIC站点的WHOIS服务器,
该服务器从WHOIS数据库中查询咱们所须要的内容。
WHOIS服务器是一个基于"查询/响应"的TCP事务服务器,
它运行在SRI-NIC机器上(26.0.0.73或10.0.0.51),向用户提供internet范围内的目录服务。
本地主机上的用户程序能够经过Internet访问该服务器,其过程主要有下面三步:
(1)在TCP服务端口43(十进制)链接SRI-NIC服务主机;
(2)发送一个命令,以回车和换行(<CRLF>)结尾;
(3)接受相应命令的返回信息,一旦输出结束,服务器将关闭链接。
命令的格式很是简单。能够直接输入域名
用Socket去链接whois提供的服务器。Whois服务的默认端口是43,查询的话就是把域名往这边发送过去,
Whois服务器在收到你的请求后就会返回纯文本的格式
第一步是查询终级WhoIS服务器。
第二步根据上面提供的所在Whois服务器而后再进行,进一步的详细查询 ,
这时把两个结果合到一块儿才能获得咱们想要的详细信息。
顶级域名 whois 服务器列表大全
http://www.liqwei.com/network/protocol/2014/916.shtml
文章下面提供一个简单的whois查询服务器和一个简单的whois查询客户端
最后讲下域名解析,咱们采用的是第三方托管的方案,也就是在咱们平台上注册的域名咱们会把DNS地址指向第三方的地址,而后调用他们的API进行解析服务,为了不广告嫌疑,这里不公开咱们使用的第三方DNS服务商,这里要说的是在接入他们的API过程当中遇到的一些坑,对方API只提供PHP样例,其中的参数签名以下:
$apiKey = 'your apiKey'; $apiSecret = 'your apiSecret'; // 参数 $parameters = array( 'apiKey' => $apiKey, 'domain' => 'yourdomain.com', 'timestamp' => time() ); // 按键名排序 ksort($parameters); $hashString = ''; foreach($parameters as $key => $value){ $hashString .= ($hashString ? '&' : '') . $key . '=' . $value; } $parameters['hash'] = md5($hashString . $apiSecret); ?>
而后就遇到了用C#写的MD5加密后的签名和PHP生成的不匹配等问题,这里贴下在网上找的可用方案:
/// <summary> /// 计算参数签名 /// </summary> /// <param name="params">请求参数集,全部参数必须已转换为字符串类型</param> /// <param name="secret">签名密钥</param> /// <returns>签名</returns> public static string getSignature(IDictionary<string, string> parameters, string secret) { // 先将参数以其参数名的字典序升序进行排序 IDictionary<string, string> sortedParams = new SortedDictionary<string, string>(parameters); IEnumerator<KeyValuePair<string, string>> iterator = sortedParams.GetEnumerator(); // 遍历排序后的字典,将全部参数按"key=value"格式拼接在一块儿 StringBuilder basestring = new StringBuilder(); while (iterator.MoveNext()) { string key = iterator.Current.Key; string value = iterator.Current.Value; if (!string.IsNullOrEmpty(key) && !string.IsNullOrEmpty(value)) { if (!string.IsNullOrEmpty(basestring.ToString())) { basestring.Append("&"); } basestring.Append(key).Append("=").Append(value); } } basestring.Append(secret); return md5(basestring.ToString(), "utf-8").ToLower(); }
public static string md5(string str, string encodingStr) { try { MD5CryptoServiceProvider mmdd5 = new MD5CryptoServiceProvider(); byte[] hashvalue = mmdd5.ComputeHash(Encoding.GetEncoding(encodingStr).GetBytes(str)); mmdd5.Dispose(); return BitConverter.ToString(hashvalue).Replace("-", "").ToLower(); } catch { return String.Empty; } }
夜深了,就先写这么多了,之后有空再扩展,有兄弟也作域名注册商这一块的能够多交流一下,搞碗汤圆,睡~