【已记录】特定格式域名解析记录管理出错及分析
1.面板版本:9.2.02.操作系统版本:Windows103.浏览器版本:Edge 130.0.2849.68
4.故障现象:特定格式域名比如abc.com.cn,DNS接口为阿里API,点提交后,显示错误“此域名配置的dns账号不正确“,而像abc.com或abc.cn之类的没有问题。
5.故障分析:
a. 阿里后台log显示,DomainName为abc.comcn,漏掉了一个点,正确提交应为abc.com.cn
"requestParameters": {
20 "X-Acs-Public-Access": true,
21 "AcsProduct": "Alidns",
22 "DomainName": "abc.comcn",
23 "X-Acs-Ingress-Network": "crossdomain",
24 "ClientPort": 52286,
25 "X-Acs-Account-Site-Type": "domestic",
26 "X-Acs-Client-Request-Host": "alidns.cn-hangzhou.aliyuncs.com"
27},
b.定位了下代码应该是panel/class/sslModel/base.py这个文件中的extract_zone函数写的不够严谨
def extract_zone(self,domain_name, is_let_txt=False):
if is_let_txt:
domain_name = domain_name.lstrip("*.")
top_domain = "." + ".".join(domain_name.rsplit('.')[-2:])
new_top_domain = "." + top_domain.replace(".", "")
is_tow_top = False
if top_domain in self.top_domain_list:
is_tow_top = True
domain_name = domain_name[:-len(top_domain)] + new_top_domain
if domain_name.count(".") <= 1:
zone = ""
root = domain_name
acme_txt = "_acme-challenge"
else:
zone, middle, last = domain_name.rsplit(".", 2)
acme_txt = "_acme-challenge.%s" % zone
if is_tow_top:
last = top_domain[1:]
root = ".".join()
return root, zone, acme_txt
希望能尽快修改这个bug,谢谢
由于这个错误也会造成,像续定let's encrypt证书时,无法修改dns记录,而出错 您好,感谢您的反馈,已记录 搞定了,我自己改了下代码,现在好用了,同一个文件,同一个函数,再贴下文件路径/www/server/panel/class/sslModel/base.pydef extract_zone(self, domain_name, is_let_txt=False):
# Remove wildcard prefix if present
if is_let_txt:
domain_name = domain_name.lstrip("*.")
# Extract the top domain
split_name = domain_name.rsplit('.', 2)
if len(split_name) >= 2:
top_domain = '.' + split_name[-2] + '.' + split_name[-1]
else:
top_domain = '.' + domain_name
# Determine if the domain is in the top-level domain list
if top_domain in self.top_domain_list:
root = domain_name
zone = ''
acme_txt = "_acme-challenge"
else:
# Split the domain name to get the zone, root, and acme_txt
if domain_name.count(".") <= 1:
zone = ""
root = domain_name
acme_txt = "_acme-challenge"
else:
zone, middle, last = domain_name.rsplit(".", 2)
acme_txt = "_acme-challenge.%s" % zone
root = ".".join()
return root, zone, acme_txt
页:
[1]