diff --git a/web/admin/site/ssl_acme.py b/web/admin/site/ssl_acme.py
index db9ce77244..afe3786177 100644
--- a/web/admin/site/ssl_acme.py
+++ b/web/admin/site/ssl_acme.py
@@ -47,7 +47,7 @@ def create_acme():
apply_type = request.form.get('apply_type', 'file')
dnspai = request.form.get('dnspai','')
dns_alias = request.form.get('dns_alias','')
- return MwSites.instance().createAcme(site_name, domains, force, renew, apply_type, dnspai, email, wildcard_domain)
+ return MwSites.instance().createAcme(site_name, domains, force, renew, apply_type, dnspai, email, wildcard_domain,dns_alias)
diff --git a/web/static/app/site.js b/web/static/app/site.js
index 2b44e72919..5e4765db2f 100755
--- a/web/static/app/site.js
+++ b/web/static/app/site.js
@@ -2312,6 +2312,11 @@ function opSSLAcme(type, id, siteName, callback){
邮箱\
\
\
+
\
+
别名验证\
+
\
+
(可不填) 文档说明\
+ \
\
域名\
\
@@ -2334,9 +2339,11 @@ function opSSLAcme(type, id, siteName, callback){
if (val == 'file'){
$('#dnsapi_option').css('display','none');
$('#wildcard_domain_block').css('display','none');
+ $('#dns_alias').css('display','none');
} else {
$('#dnsapi_option').css('display','block');
$('#wildcard_domain_block').css('display','block');
+ $('#dns_alias').css('display','block');
}
});
@@ -2673,11 +2680,10 @@ function newAcmeHandApplyNotice(siteName, id, domains, data){
\
- 解析域名需要一定时间来生效,完成所以上所有解析操作后,请等待1分钟后再点击【验证】按钮
\
- 可通过CMD命令来手动验证域名解析是否生效: nslookup -q=txt _acme-challenge.xx.cn
\
- - 若您使用的是阿里云DNS,DnsPod作为DNS,可使用DNS接口自动解析
\
+ - 若您使用的是阿里云DNS,DnsPod等等作为DNS,可使用DNS接口自动解析
\
\
',
success:function(){
-
var list = '';
for (var i = 0; i < data.length; i++) {
list += '';
@@ -2720,6 +2726,8 @@ function newAcmeHandApplyNotice(siteName, id, domains, data){
if (apply_type == 'dns'){
pdata['dnspai'] = $('#dnsapi_option option:selected').val();
}
+ pdata['dns_alias'] = $("input[name='dns_alias']").val();
+
pdata['renew'] = 'true';
$.post('/site/create_acme',pdata,function(rdata){
showMsg(rdata.msg, function(){
@@ -2755,6 +2763,7 @@ function newAcmeSSL(siteName, id, domains){
pdata['dnspai'] = $('#dnsapi_option option:selected').val();
}
+ pdata['dns_alias'] = $("input[name='dns_alias']").val();
$.post('/site/create_acme',pdata,function(rdata){
showMsg(rdata.msg, function(){
if (rdata.status){
diff --git a/web/utils/site.py b/web/utils/site.py
index a996801e01..1c9c695682 100644
--- a/web/utils/site.py
+++ b/web/utils/site.py
@@ -2282,7 +2282,7 @@ def findAcmeHandDnsNotice(self, top_domain):
# acme手动申请方式
# https://github.com/acmesh-official/acme.sh/wiki/dns-manual-mode
- def createAcmeDnsTypeNone(self, site_name, domains, email, dnspai, wildcard_domain, force, renew):
+ def createAcmeDnsTypeNone(self, site_name, domains, email, dnspai, wildcard_domain, force, renew, dns_alias):
# print(site_name, domains, email, dnspai, wildcard_domain, force, renew)
acme_dir = mw.getAcmeDir()
log_file = self.acmeLogFile()
@@ -2302,6 +2302,9 @@ def createAcmeDnsTypeNone(self, site_name, domains, email, dnspai, wildcard_doma
cmd += "acme.sh --issue -d " + d + " "
cmd += " --dns --yes-I-know-dns-manual-mode-enough-go-ahead-please"
+ if dns_alias != '':
+ cmd += ' --domain-alias '+str(dns_alias)
+
if renew == 'true':
cmd += " --renew"
cmd += ' > ' + log_file
@@ -2341,7 +2344,7 @@ def createAcmeDnsTypeNone(self, site_name, domains, email, dnspai, wildcard_doma
mw.restartWeb()
return mw.returnData(True, '证书已更新!', result)
- def createAcmeDns(self, site_name, domains, email, dnspai, wildcard_domain, force, renew):
+ def createAcmeDns(self, site_name, domains, email, dnspai, wildcard_domain, force, renew, dns_alias):
dnsapi_option = thisdb.getOptionByJson('dnsapi', default={})
log_file = self.acmeLogFile()
cmd = 'echo "..." > '+ log_file
@@ -2349,7 +2352,7 @@ def createAcmeDns(self, site_name, domains, email, dnspai, wildcard_domain, forc
# 手动方式申请
if dnspai == 'none':
- return self.createAcmeDnsTypeNone(site_name, domains, email, dnspai, wildcard_domain, force, renew)
+ return self.createAcmeDnsTypeNone(site_name, domains, email, dnspai, wildcard_domain, force, renew, dns_alias)
if not dnspai in dnsapi_option:
return mw.returnData(False, '['+dnspai+']未设置!')
@@ -2375,6 +2378,10 @@ def createAcmeDns(self, site_name, domains, email, dnspai, wildcard_domain, forc
d = top_domain
else:
cmd += 'acme.sh --issue --dns '+str(dnspai)+' -d '+d
+
+ if dns_alias != '':
+ cmd += ' --domain-alias '+str(dns_alias)
+
cmd += ' > ' + log_file
# print(cmd)
result = mw.execShell(cmd)
@@ -2424,7 +2431,7 @@ def createAcmeDns(self, site_name, domains, email, dnspai, wildcard_domain, forc
mw.restartWeb()
return mw.returnData(True, '证书已更新!', result)
- def createAcme(self, site_name, domains, force, renew, apply_type, dnspai, email, wildcard_domain):
+ def createAcme(self, site_name, domains, force, renew, apply_type, dnspai, email, wildcard_domain, dns_alias):
domains = json.loads(domains)
if len(domains) < 1:
return mw.returnData(False, '请选择域名')
@@ -2452,7 +2459,7 @@ def createAcme(self, site_name, domains, force, renew, apply_type, dnspai, email
if apply_type == 'file':
return self.createAcmeFile(site_name, domains, email,force,renew)
elif apply_type == 'dns':
- return self.createAcmeDns(site_name, domains, email, dnspai, wildcard_domain,force, renew)
+ return self.createAcmeDns(site_name, domains, email, dnspai, wildcard_domain,force, renew, dns_alias)
return mw.returnData(False, '异常请求')
def createLet(self, site_name, domains, force, renew, apply_type, dnspai, email, wildcard_domain):