Certbot 申请的 https 证书续期报错的解决方案

之前用Certbot申请了Let's Encrypt的免费ssl证书,前几天邮件提醒快到期了,可我明明记得加了定时任务去自动续期。
于是去看了下日志,发现执行certbot renew的时候报错了,手动执行也是同样的报错,大致错误如下:

Could not choose appropriate plugin: The manual plugin is not working; there may be problems with your existing configuration. The error was: PluginError('An authentication script must be provided with --manual-auth-hook when using the manual plugin non-interactively.',). Skipping.

搜索后得知是因为验证域名所有者失败,没有指定--manual-auth-hook参数。
Let's Encrypt有多种验证方式,常用的有http和dns方式,由于我是在homestead虚拟机里面申请的证书,无法使用http方式,所以之前申请证书用的是dns方式,也就是创建TXT记录。
我用的是DNSPod,便根据DNSPod提供的API自己写了一个脚本,这里分享给大家。

Certbot DNS Authenticator For DNSPod

Installing

$ wget https://raw.githubusercontent.com/al-one/certbot-auth-dnspod/master/certbot-auth-dnspod.sh
$ chmod +x certbot-auth-dnspod.sh

Config

Get Your DNSPod Token From https://www.dnspod.cn/console/user/securit...

Token Format: ID,Token See: https://www.dnspod.cn/docs/info.html#commo...

$ export DNSPOD_TOKEN="your dnspod token"

or

$ echo "your dnspod token" > /etc/dnspod_token

or

$ echo "your dnspod token" > /etc/dnspod_token_$CERTBOT_DOMAIN
# echo "your dnspod token" > /etc/dnspod_token_laravel.run

Usage

$ certbot certonly --manual --preferred-challenges dns-01 --email mail@domain.com -d laravel.run -d *.laravel.run --server https://acme-v02.api.letsencrypt.org/directory --manual-auth-hook /path/to/certbot-auth-dnspod.sh

or

$ certbot renew --manual-auth-hook /path/to/certbot-auth-dnspod.sh

or add crontab

0 2 1 * * sh -c 'date "+\%Y-\%m-\%d \%H:\%M:\%S" && /usr/bin/certbot renew --manual-auth-hook /path/to/certbot-auth-dnspod.sh' >> /var/log/certbot-renew.log 2>&1
本作品采用《CC 协议》,转载必须注明作者和本文链接
《L01 基础入门》
我们将带你从零开发一个项目并部署到线上,本课程教授 Web 开发中专业、实用的技能,如 Git 工作流、Laravel Mix 前端工作流等。
《L02 从零构建论坛系统》
以构建论坛项目 LaraBBS 为线索,展开对 Laravel 框架的全面学习。应用程序架构思路贴近 Laravel 框架的设计哲学。
讨论数量: 2

按照步骤来弄的,报这个错误
SSLError: HTTPSConnectionPool(host='acme-v02.api.letsencrypt.org', port=443): Max retries exceeded with url: /directory (Caused by SSLError(SSLError("bad handshake: Error([('SSL routines', 'tls_process_server_certificate', 'certificate verify failed')],)",),)),这个是什么原因呢

4年前 评论
Alone (楼主) 4年前
maht (作者) 4年前
Alone (楼主) 4年前
Alone (楼主) 4年前
maht (作者) 4年前
maht (作者) 4年前
Alone (楼主) 4年前
maht (作者) 4年前
Alone (楼主) 4年前
maht (作者) 4年前
Alone (楼主) 4年前
maht (作者) 4年前
maht (作者) 4年前

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!