13

宝塔面板Let’s Encrypt无法自动续签免费SSL证书失效怎么解决

 2 years ago
source link: https://www.huhexian.com/15456.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

宝塔面板Let’s Encrypt无法自动续签免费SSL证书失效怎么解决

青山 2021-12-0711:42:10评论1232字

今天我的另一个网站打开的时候,突然提示SSL过期,检查之后发现是Let's Encrypt免费SSL证书到期了,我记得宝塔是可以自动续期的,貌似之前经常需要手动去续,网上查了一下资料,发现有不少网友有遇到这种问题,那就简单多了,不用自己动脑子了。有需要的可以借鉴一下。

宝塔面板Let’s Encrypt无法自动续签免费SSL证书失效怎么解决任务计划日志报错如下:
  1. -共需要续签 1 张证书
  2. |-正在续签第 1 张,域名: ['www.xxx.cn']..
  3. |-正在创建订单..
  4. |-正在获取验证信息..
  5. |-正在验证域名..
  6. |-正在发送CSR..
  7. |-正在下载证书..
  8. Traceback (most recent call last):
  9. File "/www/server/panel/class/acme_v2.py", line 692, in save_cert
  10. self.sub_all_cert(key_file, pem_file)
  11. File "/www/server/panel/class/acme_v2.py", line 714, in sub_all_cert
  12. if to_cert_init['issuer'] != cert_init['issuer'] and to_cert_init['issuer'].find("Let's Encrypt") == -1:
  13. AttributeError: 'NoneType' object has no attribute 'find'
  14. |-续签成功!

看到这里应该是是acme_v2的脚本问题。看似成功实际上根本就没有成功。 于是定位到 /www/server/panel/class/acme_v2.py 714 行,

  1. if to_cert_init['issuer'] != cert_init['issuer'] and to_cert_init['issuer'].find("Let's Encrypt") == -1:

我们需要把这个语句修改一下,如下:

  1. if to_cert_init['issuer'] != cert_init['issuer'] and str(to_cert_init['issuer']).find("Let's Encrypt") == -1:

这样就可以解决续约问题了。

还有老旧版本会存在一键证书卡死在“正在申请证书”

先执行cd /www/server/panel/class

再执行python acme_v2.py 会发现

  1. Traceback (most recent call last): File "acme_v2.py", line 40, in import dns.resolver ImportError: No module named dns.resolver

此种情况一般是宝塔面板安装时或者安装后有交叉 Python 版本存在,Python2 和 3 的 pip 混乱导致 dnspython 无法安装 此时执行:

  1. pip install dnspython
  2. pip2 install dnspython

再次申请证书即可正常使用,最新版不存在这个问题,如果上面命令还是无法解决你的问题最好是安装新版宝塔面板为妙。


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK