tengattack / certbot-dns-dnspod

A certbot dns plugin to obtain certificates using dnspod.
Other
64 stars 18 forks source link

请教一下,是不支持四级域名及四级范域名么? #8

Open jdkcn opened 3 years ago

jdkcn commented 3 years ago
~$ sudo docker run -it --rm --name certbot     -v "/etc/letsencrypt:/etc/letsencrypt"     -v "/var/lib/letsencrypt:/var/lib/letsencrypt"     -v "/root/.dnspod.ini:/etc/letsencrypt/.dnspod.ini"     certbot-dns-dnspod:0.24.0     certonly -a certbot-dns-dnspod:dns-dnspod     --certbot-dns-dnspod:dns-dnspod-credentials /etc/letsencrypt/.dnspod.ini     -d dev.example.net -d "*.dev.example.net" --debug
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugin legacy name certbot-dns-dnspod:dns-dnspod may be removed in a future version. Please use dns-dnspod instead.
Plugins selected: Authenticator certbot-dns-dnspod:dns-dnspod, Installer None
Requesting a certificate for dev.example.net and *.dev.example.net
Performing the following challenges:
dns-01 challenge for dev.example.net
dns-01 challenge for dev.example.net
Cleaning up challenges
Exiting abnormally:
Traceback (most recent call last):
  File "/opt/certbot/src/certbot-dns-dnspod/certbot_dns_dnspod/dns_dnspod.py", line 101, in _find_domain_id
    self.provider.authenticate()
  File "/usr/local/lib/python3.8/site-packages/lexicon/providers/base.py", line 74, in authenticate
    return self._authenticate()
  File "/usr/local/lib/python3.8/site-packages/lexicon/providers/dnspod.py", line 34, in _authenticate
    raise Exception(payload["status"]["message"])
Exception: 域名不正确,请输入主域名,如 dnspod.cn

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/bin/certbot", line 33, in <module>
    sys.exit(load_entry_point('certbot', 'console_scripts', 'certbot')())
  File "/opt/certbot/src/certbot/certbot/main.py", line 15, in main
    return internal_main.main(cli_args)
  File "/opt/certbot/src/certbot/certbot/_internal/main.py", line 1435, in main
    return config.func(config, plugins)
  File "/opt/certbot/src/certbot/certbot/_internal/main.py", line 1304, in certonly
    lineage = _get_and_save_cert(le_client, config, domains, certname, lineage)
  File "/opt/certbot/src/certbot/certbot/_internal/main.py", line 140, in _get_and_save_cert
    lineage = le_client.obtain_and_enroll_certificate(domains, certname)
  File "/opt/certbot/src/certbot/certbot/_internal/client.py", line 444, in obtain_and_enroll_certificate
    cert, chain, key, _ = self.obtain_certificate(domains)
  File "/opt/certbot/src/certbot/certbot/_internal/client.py", line 374, in obtain_certificate
    orderr = self._get_order_and_authorizations(csr.data, self.config.allow_subset_of_names)
  File "/opt/certbot/src/certbot/certbot/_internal/client.py", line 424, in _get_order_and_authorizations
    authzr = self.auth_handler.handle_authorizations(orderr, best_effort)
  File "/opt/certbot/src/certbot/certbot/_internal/auth_handler.py", line 70, in handle_authorizations
    resps = self.auth.perform(achalls)
  File "/opt/certbot/src/certbot/certbot/plugins/dns_common.py", line 60, in perform
    self._perform(domain, validation_domain_name, validation)
  File "/opt/certbot/src/certbot-dns-dnspod/certbot_dns_dnspod/dns_dnspod.py", line 55, in _perform
    self._get_dnspod_client().add_txt_record(domain, validation_name, validation)
  File "/opt/certbot/src/certbot/certbot/plugins/dns_common_lexicon.py", line 45, in add_txt_record
    self._find_domain_id(domain)
  File "/opt/certbot/src/certbot-dns-dnspod/certbot_dns_dnspod/dns_dnspod.py", line 113, in _find_domain_id
    raise result
certbot.errors.PluginError: Unexpected error determining zone identifier for dev.example.net: 域名不正确,请输入主域名,如 dnspod.cn
Please see the logfiles in /var/log/letsencrypt for more details.
tengattack commented 3 years ago

之前测试过,应该是支持的,能发下具体的域名吗?可能是 dnspod 修改接口了, 我看下

jdkcn commented 3 years ago

密钥是对的。我申请 example.net *.example.net 成功的。

是需要具体的域名您才能排查么?

tengattack commented 3 years ago

不需要, 我稍后试下

tengattack commented 3 years ago

是和 #7 同样的问题,现在已经修复 https://github.com/tengattack/certbot-dns-dnspod/commit/fc995c29397b38a22fa390ed1befb56195e54b25

可以更新下到最新的代码试下看看~

image

jdkcn commented 3 years ago

感谢我去试试。

jdkcn commented 3 years ago

又出现新的错误了。

Encountered exception during recovery: TypeError: delete_record() got an unexpected keyword argument 'type'
Exiting abnormally:
Traceback (most recent call last):
  File "/usr/local/bin/certbot", line 33, in <module>
    sys.exit(load_entry_point('certbot', 'console_scripts', 'certbot')())
  File "/opt/certbot/src/certbot/certbot/main.py", line 15, in main
    return internal_main.main(cli_args)
  File "/opt/certbot/src/certbot/certbot/_internal/main.py", line 1435, in main
    return config.func(config, plugins)
  File "/opt/certbot/src/certbot/certbot/_internal/main.py", line 1304, in certonly
    lineage = _get_and_save_cert(le_client, config, domains, certname, lineage)
  File "/opt/certbot/src/certbot/certbot/_internal/main.py", line 140, in _get_and_save_cert
    lineage = le_client.obtain_and_enroll_certificate(domains, certname)
  File "/opt/certbot/src/certbot/certbot/_internal/client.py", line 444, in obtain_and_enroll_certificate
    cert, chain, key, _ = self.obtain_certificate(domains)
  File "/opt/certbot/src/certbot/certbot/_internal/client.py", line 374, in obtain_certificate
    orderr = self._get_order_and_authorizations(csr.data, self.config.allow_subset_of_names)
  File "/opt/certbot/src/certbot/certbot/_internal/client.py", line 424, in _get_order_and_authorizations
    authzr = self.auth_handler.handle_authorizations(orderr, best_effort)
  File "/opt/certbot/src/certbot/certbot/_internal/auth_handler.py", line 70, in handle_authorizations
    resps = self.auth.perform(achalls)
  File "/opt/certbot/src/certbot/certbot/plugins/dns_common.py", line 60, in perform
    self._perform(domain, validation_domain_name, validation)
  File "/opt/certbot/src/certbot-dns-dnspod/certbot_dns_dnspod/dns_dnspod.py", line 55, in _perform
    self._get_dnspod_client().add_txt_record(domain, validation_name, validation)
  File "/opt/certbot/src/certbot/certbot/plugins/dns_common_lexicon.py", line 48, in add_txt_record
    self.provider.create_record(type='TXT', name=record_name, content=record_content)
TypeError: create_record() got an unexpected keyword argument 'type'
tengattack commented 3 years ago

这个看起来是 certbot 和 lexicon 的兼容性问题 https://github.com/AnalogJ/lexicon/pull/341 修改了字段的名称,certbot 看起来没改,可以修改 /opt/certbot/src/certbot/certbot/plugins/dns_common_lexicon.py 文件,找到 create_recorddelete_record 使用的地方,先临时将后面的 type 修改为 rtype,修改完这两处应该就好了

晚些时候我看看怎么兼容下

tengattack commented 3 years ago

已经有修复 PR 了,等待合并

https://github.com/certbot/certbot/pull/8819