acmesh-official / acme.sh

A pure Unix shell script implementing ACME client protocol
https://acme.sh
GNU General Public License v3.0
39.29k stars 4.96k forks source link

阿里云主机dnspod域名解析,在申请第二个域名的泛域名证书的时候出现invalid domian #2800

Closed chaihongjun closed 4 years ago

chaihongjun commented 4 years ago

阿里云主机,使用DNSPOD解析域名,通过dnsapi方式拿证书。有两个网站,第一个网站操作过程一切都OK,再申请第二个网站的证书的时候出现invalid domain错误。 这个是--log --debug 2 输出的信息(域名改成了sample.com非真实域名,但格式是这样的):

[Wed Mar 25 16:15:59 CST 2020] Running cmd: issue
[Wed Mar 25 16:15:59 CST 2020] _main_domain='sample.com'
[Wed Mar 25 16:15:59 CST 2020] _alt_domains='*.sample.com'
[Wed Mar 25 16:15:59 CST 2020] Using config home:/root/.acme.sh
[Wed Mar 25 16:16:00 CST 2020] ACME_DIRECTORY='https://acme-v02.api.letsencrypt.org/directory'
[Wed Mar 25 16:16:00 CST 2020] DOMAIN_PATH='/root/.acme.sh/sample.com'
[Wed Mar 25 16:16:00 CST 2020] Using ACME_DIRECTORY: https://acme-v02.api.letsencrypt.org/directory
[Wed Mar 25 16:16:00 CST 2020] _init api for server: https://acme-v02.api.letsencrypt.org/directory
[Wed Mar 25 16:16:00 CST 2020] GET
[Wed Mar 25 16:16:00 CST 2020] url='https://acme-v02.api.letsencrypt.org/directory'
[Wed Mar 25 16:16:00 CST 2020] timeout=
[Wed Mar 25 16:16:00 CST 2020] _CURL='curl -L --silent --dump-header /root/.acme.sh/http.header  --trace-ascii /tmp/tmp.bZd1gJ0vns  -g '
[Wed Mar 25 16:16:00 CST 2020] ret='0'
[Wed Mar 25 16:16:01 CST 2020] ACME_KEY_CHANGE='https://acme-v02.api.letsencrypt.org/acme/key-change'
[Wed Mar 25 16:16:01 CST 2020] ACME_NEW_AUTHZ
[Wed Mar 25 16:16:01 CST 2020] ACME_NEW_ORDER='https://acme-v02.api.letsencrypt.org/acme/new-order'
[Wed Mar 25 16:16:01 CST 2020] ACME_NEW_ACCOUNT='https://acme-v02.api.letsencrypt.org/acme/new-acct'
[Wed Mar 25 16:16:01 CST 2020] ACME_REVOKE_CERT='https://acme-v02.api.letsencrypt.org/acme/revoke-cert'
[Wed Mar 25 16:16:01 CST 2020] ACME_AGREEMENT='https://letsencrypt.org/documents/LE-SA-v1.2-November-15-2017.pdf'
[Wed Mar 25 16:16:01 CST 2020] ACME_NEW_NONCE='https://acme-v02.api.letsencrypt.org/acme/new-nonce'
[Wed Mar 25 16:16:01 CST 2020] ACME_VERSION='2'
[Wed Mar 25 16:16:01 CST 2020] _on_before_issue
[Wed Mar 25 16:16:01 CST 2020] _chk_main_domain='sample.com'
[Wed Mar 25 16:16:01 CST 2020] _chk_alt_domains='*.sample.com'
[Wed Mar 25 16:16:01 CST 2020] Le_LocalAddress
[Wed Mar 25 16:16:01 CST 2020] d='sample.com'
[Wed Mar 25 16:16:01 CST 2020] Check for domain='sample.com'
[Wed Mar 25 16:16:01 CST 2020] _currentRoot='dns_dp'
[Wed Mar 25 16:16:01 CST 2020] d='*.sample.com'
[Wed Mar 25 16:16:01 CST 2020] Check for domain='*.sample.com'
[Wed Mar 25 16:16:01 CST 2020] _currentRoot='dns_dp'
[Wed Mar 25 16:16:01 CST 2020] d
[Wed Mar 25 16:16:01 CST 2020] _saved_account_key_hash is not changed, skip register account.
[Wed Mar 25 16:16:01 CST 2020] Read key length:
[Wed Mar 25 16:16:01 CST 2020] Creating domain key
[Wed Mar 25 16:16:01 CST 2020] Use DEFAULT_DOMAIN_KEY_LENGTH=2048
[Wed Mar 25 16:16:01 CST 2020] Using config home:/root/.acme.sh
[Wed Mar 25 16:16:01 CST 2020] ACME_DIRECTORY='https://acme-v02.api.letsencrypt.org/directory'
[Wed Mar 25 16:16:01 CST 2020] Use length 2048
[Wed Mar 25 16:16:01 CST 2020] Using RSA: 2048
[Wed Mar 25 16:16:01 CST 2020] The domain key is here: /root/.acme.sh/sample.com/sample.com.key
[Wed Mar 25 16:16:01 CST 2020] _createcsr
[Wed Mar 25 16:16:01 CST 2020] Multi domain='DNS:sample.com,DNS:*.sample.com'
[Wed Mar 25 16:16:01 CST 2020] Getting domain auth token for each domain
[Wed Mar 25 16:16:01 CST 2020] d='*.sample.com'
[Wed Mar 25 16:16:01 CST 2020] d
[Wed Mar 25 16:16:01 CST 2020] url='https://acme-v02.api.letsencrypt.org/acme/new-order'
[Wed Mar 25 16:16:01 CST 2020] payload='{"identifiers": [{"type":"dns","value":"sample.com"},{"type":"dns","value":"*.sample.com"}]}'
[Wed Mar 25 16:16:01 CST 2020] RSA key
[Wed Mar 25 16:16:01 CST 2020] HEAD
[Wed Mar 25 16:16:01 CST 2020] _post_url='https://acme-v02.api.letsencrypt.org/acme/new-nonce'
[Wed Mar 25 16:16:01 CST 2020] _CURL='curl -L --silent --dump-header /root/.acme.sh/http.header  --trace-ascii /tmp/tmp.JXXNqjILu3  -g  -I  '
[Wed Mar 25 16:16:02 CST 2020] _ret='0'
[Wed Mar 25 16:16:02 CST 2020] POST
[Wed Mar 25 16:16:02 CST 2020] _post_url='https://acme-v02.api.letsencrypt.org/acme/new-order'
[Wed Mar 25 16:16:02 CST 2020] _CURL='curl -L --silent --dump-header /root/.acme.sh/http.header  --trace-ascii /tmp/tmp.JXXNqjILu3  -g '
[Wed Mar 25 16:16:03 CST 2020] _ret='0'
[Wed Mar 25 16:16:03 CST 2020] code='201'
[Wed Mar 25 16:16:03 CST 2020] Le_LinkOrder='https://acme-v02.api.letsencrypt.org/acme/order/81406850/2772786187'
[Wed Mar 25 16:16:03 CST 2020] Le_OrderFinalize='https://acme-v02.api.letsencrypt.org/acme/finalize/81406850/2772786187'
[Wed Mar 25 16:16:03 CST 2020] url='https://acme-v02.api.letsencrypt.org/acme/authz-v3/3555112753'
[Wed Mar 25 16:16:03 CST 2020] payload
[Wed Mar 25 16:16:03 CST 2020] POST
[Wed Mar 25 16:16:03 CST 2020] _post_url='https://acme-v02.api.letsencrypt.org/acme/authz-v3/3555112753'
[Wed Mar 25 16:16:03 CST 2020] _CURL='curl -L --silent --dump-header /root/.acme.sh/http.header  --trace-ascii /tmp/tmp.JXXNqjILu3  -g '
[Wed Mar 25 16:16:04 CST 2020] _ret='0'
[Wed Mar 25 16:16:04 CST 2020] code='200'
[Wed Mar 25 16:16:04 CST 2020] url='https://acme-v02.api.letsencrypt.org/acme/authz-v3/3555112757'
[Wed Mar 25 16:16:04 CST 2020] payload
[Wed Mar 25 16:16:04 CST 2020] POST
[Wed Mar 25 16:16:04 CST 2020] _post_url='https://acme-v02.api.letsencrypt.org/acme/authz-v3/3555112757'
[Wed Mar 25 16:16:04 CST 2020] _CURL='curl -L --silent --dump-header /root/.acme.sh/http.header  --trace-ascii /tmp/tmp.JXXNqjILu3  -g '
[Wed Mar 25 16:16:10 CST 2020] _ret='0'
[Wed Mar 25 16:16:10 CST 2020] code='200'
[Wed Mar 25 16:16:10 CST 2020] d='sample.com'
[Wed Mar 25 16:16:10 CST 2020] Getting webroot for domain='sample.com'
[Wed Mar 25 16:16:10 CST 2020] _w='dns_dp'
[Wed Mar 25 16:16:10 CST 2020] _currentRoot='dns_dp'
[Wed Mar 25 16:16:10 CST 2020] entry='"type":"dns-01","status":"pending","url":"https://acme-v02.api.letsencrypt.org/acme/chall-v3/3555112757/c85scg","token":"aJ8Mf9pfnrsaJ-5qKZnz_7NvJwnkqrNOqdjW5PhQywE"'
[Wed Mar 25 16:16:10 CST 2020] token='aJ8Mf9pfnrsaJ-5qKZnz_7NvJwnkqrNOqdjW5PhQywE'
[Wed Mar 25 16:16:10 CST 2020] uri='https://acme-v02.api.letsencrypt.org/acme/chall-v3/3555112757/c85scg'
[Wed Mar 25 16:16:10 CST 2020] keyauthorization='aJ8Mf9pfnrsaJ-5qKZnz_7NvJwnkqrNOqdjW5PhQywE.tq3JRYpisOaQ9WPH2fRp3KnkyuWvC7MU9uB4k2FvpnU'
[Wed Mar 25 16:16:10 CST 2020] dvlist='sample.com#aJ8Mf9pfnrsaJ-5qKZnz_7NvJwnkqrNOqdjW5PhQywE.tq3JRYpisOaQ9WPH2fRp3KnkyuWvC7MU9uB4k2FvpnU#https://acme-v02.api.letsencrypt.org/acme/chall-v3/3555112757/c85scg#dns-01#dns_dp'
[Wed Mar 25 16:16:10 CST 2020] d='*.sample.com'
[Wed Mar 25 16:16:10 CST 2020] Getting webroot for domain='*.sample.com'
[Wed Mar 25 16:16:10 CST 2020] _w='dns_dp'
[Wed Mar 25 16:16:10 CST 2020] _currentRoot='dns_dp'
[Wed Mar 25 16:16:10 CST 2020] entry='"type":"dns-01","status":"pending","url":"https://acme-v02.api.letsencrypt.org/acme/chall-v3/3555112753/LyJ9GA","token":"ncqLoGWlCk5uoruANHNyHrxYPFgMtOTrcHK7FcfkZxg"'
[Wed Mar 25 16:16:10 CST 2020] token='ncqLoGWlCk5uoruANHNyHrxYPFgMtOTrcHK7FcfkZxg'
[Wed Mar 25 16:16:10 CST 2020] uri='https://acme-v02.api.letsencrypt.org/acme/chall-v3/3555112753/LyJ9GA'
[Wed Mar 25 16:16:10 CST 2020] keyauthorization='ncqLoGWlCk5uoruANHNyHrxYPFgMtOTrcHK7FcfkZxg.tq3JRYpisOaQ9WPH2fRp3KnkyuWvC7MU9uB4k2FvpnU'
[Wed Mar 25 16:16:10 CST 2020] dvlist='*.sample.com#ncqLoGWlCk5uoruANHNyHrxYPFgMtOTrcHK7FcfkZxg.tq3JRYpisOaQ9WPH2fRp3KnkyuWvC7MU9uB4k2FvpnU#https://acme-v02.api.letsencrypt.org/acme/chall-v3/3555112753/LyJ9GA#dns-01#dns_dp'
[Wed Mar 25 16:16:10 CST 2020] d
[Wed Mar 25 16:16:10 CST 2020] vlist='sample.com#aJ8Mf9pfnrsaJ-5qKZnz_7NvJwnkqrNOqdjW5PhQywE.tq3JRYpisOaQ9WPH2fRp3KnkyuWvC7MU9uB4k2FvpnU#https://acme-v02.api.letsencrypt.org/acme/chall-v3/3555112757/c85scg#dns-01#dns_dp,*.sample.com#ncqLoGWlCk5uoruANHNyHrxYPFgMtOTrcHK7FcfkZxg.tq3JRYpisOaQ9WPH2fRp3KnkyuWvC7MU9uB4k2FvpnU#https://acme-v02.api.letsencrypt.org/acme/chall-v3/3555112753/LyJ9GA#dns-01#dns_dp,'
[Wed Mar 25 16:16:10 CST 2020] d='sample.com'
[Wed Mar 25 16:16:10 CST 2020] _d_alias
[Wed Mar 25 16:16:10 CST 2020] txtdomain='_acme-challenge.sample.com'
[Wed Mar 25 16:16:10 CST 2020] txt='mgAK5EHBFjLVCLhqSh2qAC5mdfuiaKoi3zoZQvPs26Q'
[Wed Mar 25 16:16:10 CST 2020] d_api='/root/.acme.sh/dnsapi/dns_dp.sh'
[Wed Mar 25 16:16:10 CST 2020] Found domain api file: /root/.acme.sh/dnsapi/dns_dp.sh
[Wed Mar 25 16:16:10 CST 2020] Adding txt value: mgAK5EHBFjLVCLhqSh2qAC5mdfuiaKoi3zoZQvPs26Q for domain:  _acme-challenge.sample.com
[Wed Mar 25 16:16:10 CST 2020] First detect the root zone
[Wed Mar 25 16:16:10 CST 2020] Domain.Info
[Wed Mar 25 16:16:10 CST 2020] url='https://dnsapi.cn/Domain.Info'
[Wed Mar 25 16:16:10 CST 2020] POST
[Wed Mar 25 16:16:10 CST 2020] _post_url='https://dnsapi.cn/Domain.Info'
[Wed Mar 25 16:16:10 CST 2020] _CURL='curl -L --silent --dump-header /root/.acme.sh/http.header  --trace-ascii /tmp/tmp.JXXNqjILu3  -g '
[Wed Mar 25 16:16:10 CST 2020] _ret='0'
[Wed Mar 25 16:16:10 CST 2020] Domain.Info
[Wed Mar 25 16:16:10 CST 2020] url='https://dnsapi.cn/Domain.Info'
[Wed Mar 25 16:16:10 CST 2020] POST
[Wed Mar 25 16:16:10 CST 2020] _post_url='https://dnsapi.cn/Domain.Info'
[Wed Mar 25 16:16:10 CST 2020] _CURL='curl -L --silent --dump-header /root/.acme.sh/http.header  --trace-ascii /tmp/tmp.JXXNqjILu3  -g '
[Wed Mar 25 16:16:11 CST 2020] _ret='0'
[Wed Mar 25 16:16:11 CST 2020] invalid domain
[Wed Mar 25 16:16:11 CST 2020] Error add txt for domain:_acme-challenge.sample.com
[Wed Mar 25 16:16:11 CST 2020] _on_issue_err
[Wed Mar 25 16:16:11 CST 2020] Please check log file for more details: /root/.acme.sh/acme.sh.log
[Wed Mar 25 16:16:11 CST 2020] url='https://acme-v02.api.letsencrypt.org/acme/chall-v3/3555112757/c85scg'
[Wed Mar 25 16:16:11 CST 2020] payload='{}'
[Wed Mar 25 16:16:11 CST 2020] POST
[Wed Mar 25 16:16:11 CST 2020] _post_url='https://acme-v02.api.letsencrypt.org/acme/chall-v3/3555112757/c85scg'
[Wed Mar 25 16:16:11 CST 2020] _CURL='curl -L --silent --dump-header /root/.acme.sh/http.header  --trace-ascii /tmp/tmp.JXXNqjILu3  -g '
[Wed Mar 25 16:16:12 CST 2020] _ret='0'
[Wed Mar 25 16:16:12 CST 2020] code='200'
[Wed Mar 25 16:16:12 CST 2020] url='https://acme-v02.api.letsencrypt.org/acme/chall-v3/3555112753/LyJ9GA'
[Wed Mar 25 16:16:12 CST 2020] payload='{}'
[Wed Mar 25 16:16:12 CST 2020] POST
[Wed Mar 25 16:16:12 CST 2020] _post_url='https://acme-v02.api.letsencrypt.org/acme/chall-v3/3555112753/LyJ9GA'
[Wed Mar 25 16:16:12 CST 2020] _CURL='curl -L --silent --dump-header /root/.acme.sh/http.header  --trace-ascii /tmp/tmp.JXXNqjILu3  -g '
[Wed Mar 25 16:16:24 CST 2020] Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 6
[Wed Mar 25 16:16:24 CST 2020] Here is the curl dump log:
[Wed Mar 25 16:16:24 CST 2020] == Info: Could not resolve host: acme-v02.api.letsencrypt.org; Unknown error
== Info: Closing connection 0
[Wed Mar 25 16:16:24 CST 2020] _ret='6'
[Wed Mar 25 16:16:24 CST 2020] code
[Wed Mar 25 16:16:24 CST 2020] socat doesn't exists.
[Wed Mar 25 16:16:24 CST 2020] Diagnosis versions: 
openssl:openssl
OpenSSL 1.0.2k-fips  26 Jan 2017
apache:
apache doesn't exists.
nginx:
nginx version: nginx/1.16.1
built by gcc 4.8.5 20150623 (Red Hat 4.8.5-39) (GCC) 
built with OpenSSL 1.1.1d  10 Sep 2019
TLS SNI support enabled
configure arguments: --prefix=/usr/local/nginx --user=www --group=www --with-http_stub_status_module --with-http_v2_module --with-http_ssl_module --with-http_gzip_static_module --with-http_realip_module --with-http_flv_module --with-http_mp4_module --with-openssl=../openssl-1.1.1d --with-pcre=../pcre-8.44 --with-pcre-jit --with-ld-opt=-ljemalloc --add-module=/usr/local/ngx_brotli --add-module=/root/oneinstack/src/pagespeed.1.13.35.2 --add-module=/root/oneinstack/src/ngx_http_geoip2_module-3.3
socat:
[Wed Mar 25 16:16:24 CST 2020] pid
[Wed Mar 25 16:16:24 CST 2020] No need to restore nginx, skip.
[Wed Mar 25 16:16:24 CST 2020] _clearupdns
[Wed Mar 25 16:16:24 CST 2020] dns_entries
[Wed Mar 25 16:16:24 CST 2020] skip dns.

生成的文件只有: sample.com.conf sample.com.csr sample.com.csr.conf sample.com.key 两处明显的提示:

  1. invalid domain Error add txt for domain
  2. Please refer to https://curl.haxx.se/libcurl/c/libcurl-errors.html for error code: 6 Could not resolve host: acme-v02.api.letsencrypt.org; Unknown error == Info: Closing connection 0

第一个错误如何解决? 第二个错误 指向的解释是 Couldn't resolve host. The given remote host was not resolved.

ubitsp commented 4 years ago

应该是dnspod的bug,响应的信息变成了中文,导致脚本判断出错,在dns_dp.sh修改一下,强制使用英文返回响应消息,还有把Action completed successful替换为Operation successful

chaihongjun commented 4 years ago

@ubitsp 帅哥,能不能说下具体强制使用英文返回响应消息,怎么修改

chaihongjun commented 4 years ago

@ubitsp 啊。看到你说的修改了。3Q

chaihongjun commented 4 years ago

按照 这个 https://github.com/acmesh-official/acme.sh/pull/2804/commits/233dc05c2cfa1b6e0b8c6acdffe5cb9d344d352a 已经解决了