letsencrypt 工具改名 certbot

今天落格博客的证书到期了,之前我有写过如何用 letsencrypt 来给博客加 https 支持,并且在文章的末尾教大家写了一个定时更新服务,这样你就不用每三个月自己手动去更新了。

不过,如果你的证书要过期了,那么其实 letsencrypt 会有机器人给你发提醒邮件的,内容大致是这样:

Hello,

Your certificate (or certificates) for the names listed below will expire in
0 days (on 28 Oct 17 17:30 +0000). Please make sure to renew
your certificate before then, or visitors to your website will encounter errors.

cnswift.org
logcg.com
www.cnswift.org
www.logcg.com

For any questions or support, please visit https://community.letsencrypt.org/.
Unfortunately, we can’t provide support by email.

For details about when we send these emails, please visit
https://letsencrypt.org/docs/expiration-emails/. In particular, note
that this reminder email is still sent if you’ve obtained a slightly
different certificate by adding or removing names. If you’ve replaced
this certificate with a newer one that covers more or fewer names than
the list above, you may be able to ignore this message.

由于我自己做了定时,我就以为是之前测试的时候签的证书就没理会,果然,今天就有朋友跟我说——你博客证书到期了。

没办法,先手动续期,结果无论如何都是错误。这时候才发现,原来letsencrypt这个工具已经改名了,新的名字叫 certbot。(/certbot

这个工具配置更简单,更人性化,直接有各种服务器的插件,可以全自动完成。

我是 ubuntu,这里介绍ubuntu 16.04 的操作步骤,其他版本和系统的用户你可以到这里来看详细的对应教程:https://certbot.eff.org

首先是安装工具:

安装好后就可以使用命令启动了:

不需要额外的参数了,启动后它会自动获取你nginx里的配置文件并得到所有可以签发证书的域名,你只需要根据列表序号写入即可,序号用空格分割。

然后一切就自动完成了……最后会问你是否要配置 http 跳转 https,一般就选择自动跳转,它也会帮你配置完成。

这时候证书就已经生效了………………

就是这么简单。

同样的,在 crontab 里把之前的更新命令改一下,改成 certbot renew 即可。

新的设置自动更新的方法,certbot 官方给出了脚本,复制粘贴执行即可:

 

参考文献

本文由 落格博客 原创撰写:落格博客 » letsencrypt 工具改名 certbot

转载请保留出处和原文链接:https://www.logcg.com/archives/2921.html

About the Author

R0uter

如非声明,本人所著文章均为原创手打,转载请注明本页面链接和我的名字。

Comments

  1. 咱以前也用 –nginx

    单色,certbot 后来废弃 –nginx 了,

    所以咱改用

    certbot --webroot --installer nginx --redirect --keep -d 域名

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注