tengattack / certbot-dns-aliyun

A certbot dns plugin to obtain certificates using aliyun.
Other
267 stars 59 forks source link

目前最新版本certbot/certbot:v0.38.0执行失败,应该是默认使用了python3导致 #7

Closed wisheen closed 5 years ago

wisheen commented 5 years ago

上一版本certbot/certbot:v0.37.2正常。新版本提示找不到alidns模块

tengattack commented 5 years ago

晚点我看看是啥原因

opsarno commented 5 years ago

我这边与楼上的报错一样。

系统

# lsb_release -a
LSB Version:    :core-4.1-amd64:core-4.1-noarch
Distributor ID: CentOS
Description:    CentOS Linux release 7.6.1810 (Core) 
Release:    7.6.1810
Codename:   Core

创建 Python 虚拟机环境,并安装相关工具包

yum install python36 -y

mkdir -p /opt/soft/tool/certbot/
cd /opt/soft/tool/certbot/
python3 -m venv venv
source venv/bin/activate

pip install certbot certbot-nginx certbot-dns-aliyun

包版本信息

# pip list
Package             Version    
------------------- -----------
acme                0.38.0     
asn1crypto          0.24.0     
certbot             0.38.0     
certbot-dns-aliyun  0.23.0.dev0
certbot-nginx       0.38.0     
certifi             2019.9.11  
cffi                1.12.3     
chardet             3.0.4      
ConfigArgParse      0.14.0     
configobj           5.0.6      
cryptography        2.7        
distro              1.4.0      
dns-lexicon         3.3.3      
future              0.17.1     
idna                2.8        
josepy              1.2.0      
mock                3.0.5      
parsedatetime       2.4        
pip                 19.2.3     
pycparser           2.19       
pyOpenSSL           19.0.0     
pyparsing           2.4.2      
pyRFC3339           1.1        
pytz                2019.2     
PyYAML              5.1.2      
requests            2.22.0     
requests-file       1.4.3      
requests-toolbelt   0.9.1      
setuptools          39.2.0     
six                 1.12.0     
tldextract          2.2.1      
urllib3             1.25.6     
zope.component      4.5        
zope.deferredimport 4.3.1      
zope.deprecation    4.4.0      
zope.event          4.4        
zope.hookable       4.2.0      
zope.interface      4.6.0      
zope.proxy          4.3.2      

根据文档配置 RAM AK 等信息,执行命令抛错信息如下

# more /tmp/tmpd15apu4u/log
2019-09-28 11:53:25,652:DEBUG:certbot.log:Exiting abnormally:
Traceback (most recent call last):
  File "/opt/soft/tool/certbot/venv/bin/certbot", line 10, in <module>
    sys.exit(main())
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot/main.py", line 1348, in main
    plugins = plugins_disco.PluginsRegistry.find_all()
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot/plugins/disco.py", line 208, in find_all
    plugin_ep = PluginEntryPoint(entry_point)
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot/plugins/disco.py", line 50, in __init__
    self.plugin_cls = entry_point.load()
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/pkg_resources/__init__.py", line 2324, in load
    return self.resolve()
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/pkg_resources/__init__.py", line 2330, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot_dns_aliyun/dns_aliyun.py", line 5, in <module>
    import alidns
ModuleNotFoundError: No module named 'alidns'
2019-09-28 11:53:25,652:ERROR:certbot.log:An unexpected error occurred:
tengattack commented 5 years ago

现已修复,尝试更新至 0.38.0 版本: https://pypi.org/project/certbot-dns-aliyun/

@opsarno @wisheen

opsarno commented 5 years ago
(venv) [root@arno certbot]#  certbot certonly -a certbot-dns-aliyun:dns-aliyun --certbot-dns-aliyun:dns-aliyun-credentials /root/.secrets/certbot/aliyun.ini -d opsarno.com -d "*.opsarno.com"
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator certbot-dns-aliyun:dns-aliyun, Installer None
Cert is due for renewal, auto-renewing...
Renewing an existing certificate
Performing the following challenges:
dns-01 challenge for fandenggui.com
Cleaning up challenges
Encountered exception during recovery: 
Traceback (most recent call last):
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot/auth_handler.py", line 69, in handle_authorizations
    resps = self.auth.perform(achalls)
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot/plugins/dns_common.py", line 58, in perform
    self._perform(domain, validation_domain_name, validation)
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot_dns_aliyun/dns_aliyun.py", line 56, in _perform
    self._get_alidns_client().add_txt_record(domain, validation_name, validation)
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot_dns_aliyun/alidns.py", line 70, in add_txt_record
    domain = self._find_domain_id(domain)
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot_dns_aliyun/alidns.py", line 47, in _find_domain_id
    'KeyWord': domain_name,
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot_dns_aliyun/alidns.py", line 108, in _request
    for key in sorted(params.iterkeys()):
AttributeError: 'dict' object has no attribute 'iterkeys'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot/error_handler.py", line 124, in _call_registered
    self.funcs[-1]()
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot/auth_handler.py", line 220, in _cleanup_challenges
    self.auth.cleanup(achalls)
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot/plugins/dns_common.py", line 77, in cleanup
    self._cleanup(domain, validation_domain_name, validation)
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot_dns_aliyun/dns_aliyun.py", line 59, in _cleanup
    self._get_alidns_client().del_txt_record(domain, validation_name, validation)
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot_dns_aliyun/alidns.py", line 81, in del_txt_record
    domain = self._find_domain_id(domain)
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot_dns_aliyun/alidns.py", line 47, in _find_domain_id
    'KeyWord': domain_name,
  File "/opt/soft/tool/certbot/venv/lib64/python3.6/site-packages/certbot_dns_aliyun/alidns.py", line 108, in _request
    for key in sorted(params.iterkeys()):
AttributeError: 'dict' object has no attribute 'iterkeys'
An unexpected error occurred:
AttributeError: 'dict' object has no attribute 'iterkeys'
Please see the logfiles in /var/log/letsencrypt for more details.
(venv) [root@arno certbot]# more /var/log/letsencrypt

*** /var/log/letsencrypt: directory ***

@tengattack 又有了新的错误。

tengattack commented 5 years ago

非常抱歉,这次我进行了 dry-run,更新至 0.38.1 应该能解决问题

@opsarno

opsarno commented 5 years ago

@tengattack 解决啦,谢谢。