certbot-auto报错,无法更新证书解决
在使用Let’s Encrypt 的免费证书后,需要每三个月更新一次证书,因为免费证书的有效日期只有三个月,而certbot-auto提供了一个方法,续签证书
./certbot-auto renew --quiet
该命令将检查服务器上的证书是否将在未来30天内过期,如果是,则进行更新,后面可以加上–quiet 指令告诉 certbot 不要生成输出。
可以将其放到计划任务中,每天执行
不过目前证书有效期已经不到一个月了,但是证书并没有去更新
查看了定时任务,发现命令有被执行,但是证书并没有更新
Jan 12 03:00:01 localhost CROND[15033]: (root) CMD (/linggan/certbot-auto renew --quiet)
Jan 12 03:01:01 localhost CROND[15085]: (root) CMD (run-parts /etc/cron.hourly)
Jan 12 03:01:01 localhost run-parts(/etc/cron.hourly)[15085]: starting 0anacron
手动执行命令:
[root@localhost ~]# ./certbot-auto renew
Upgrading certbot-auto 1.10.1 to 1.11.0...
Couldn't download https://raw.githubusercontent.com/certbot/certbot/v1.11.0/letsencrypt-auto-source/letsencrypt-auto. <urlopen error [Errno 111] Connection refused>
发现报错 Couldn’t download https://raw.githubusercontent.com
原因是:certbot-auto将始终尝试从最新版本中获取自身的最新版本
解决办法:将其版本锁定,不在获取新的更新信息就可以了
在更新命令后加–no-self-upgrade
./certbot-auto renew --no-self-upgrade
问题解决
更新成功,可以继续白嫖三个月了
也可以在hosts文件中添加解析
[root@localhost ~]# vim /etc/hosts
199.232.4.133 raw.githubusercontent.comZZ
再次执行命令./certbot-auto renew
[root@localhost ~]# ./certbot-auto renew
Upgrading certbot-auto 1.10.1 to 1.11.0...
Replacing certbot-auto...
Your system is not supported by certbot-auto anymore.
Certbot will no longer receive updates.
Please visit https://certbot.eff.org/ to check for other alternatives.
Saving debug log to /var/log/letsencrypt/letsencrypt.log
....
Performing the following challenges:
http-01 challenge for yxonline.art
Waiting for verification...
Cleaning up challenges
The following certs were successfully renewed:
/etc/letsencrypt/live/域名/fullchain.pem (success)
也可以更新证书