文章目录
  1. 1. 引言
  2. 2. ACME Client
    1. 2.1. Certbot
      1. 2.1.1. 下载
      2. 2.1.2. 安装
      3. 2.1.3. 输入信息
      4. 2.1.4. 重新续签
    2. 2.2. acme.sh
      1. 2.2.1. 安装
      2. 2.2.2. 生成证书
  3. 3. FAQ
  4. 4. 文档信息

引言


Let’s Encrypt is a free, automated, and open certificate authority brought to you by the non-profit Internet Security Research Group (ISRG).

Let’s Encrypt 是由非盈性利互联网安全研究小组(ISRG)向您提供的一个免费,自动化和开放的证书认证机构。可概括为:Let’s Encrypt is a Certificate Authority (CA).

ACME Client


自动管理工具很多,只要遵循 ACME 协议即可。比如官方推荐的 Certbot,同时也列出来其他管理工具,应用在不同的平台和环境中。官方提供的可选的适用于不同平台或语言的ACME Client Implementations

Certbot


Certbot is an easy-to-use automatic client that fetches and deploys SSL/TLS certificates for your webserver. Certbot was developed by EFF and others as a client for Let’s Encrypt and was previously known as “the official Let’s Encrypt client” or “the Let’s Encrypt Python client.” Certbot will also work with any other CAs that support the ACME protocol.

Automatically enable HTTPS on your website with EFF’s Certbot, deploying Let’s Encrypt certificates.

Certbot 是一个容易使用的自动客户端,在你的服务器上它能够抓取和发布 SSL/TLS 证书。

下面基于 Centos 6,Apache 环境进行安装,如使用其他系统和服务软件,请点击这里选择。

下载

通过 wget 命令进行下载,并赋予其执行权限。

1
2
$ wget https://dl.eff.org/certbot-auto
$ chmod a+x certbot-auto

注:certbot-auto 是一个文件,不是文件夹,以后所有操作都基于 certbot-auto 同级目录。

安装

1
2
3
$ ./certbot-auto --apache //自动配置,推荐此方式
or
$ ./certbot-auto --apache certonly //需要手动配置
输入信息

在安装过程中,系统会提示我们输入一下信息或者取消操作

  • 提示输入邮箱:Enter email address (used for urgent renewal and security notices) (Enter ‘c’ to cancel):[email protected]
  • 阅读服务条款,是否同意注册:…register with the ACME server … (A)gree/(C)ancel: A
  • 是否同意分享邮箱地址:…share your email address… (Y)es/(N)o: N
  • 输入域名,多个用空格隔开:…Please enter in your domain
    name(s) (comma and/or space separated)… :imsoeasy.com
  • 选择是否必须 https 访问,还是可选
重新续签

续签测试

1
$ ./certbot-auto renew --dry-run  //续签测试,证明可以续签

由于 let’s Encrypt 证书 90 天后会过期,因此我们要在 90 天之前进行重签。系统的 cron 和 systemed 可以自动完成此续签工作。将其 ./certbot-auto renew 定时执行即可。用户手册Certbot User Guide

定时续签
Unix/Linux 系统包含各种用于任务调度的工具,例如:cron 和 systemctl;这里使用 cron 工具进行任务调度,对证书进行定时续签,以防止过期。

1
00 */12 * * * yourpath/certbot-auto renew //每过 12 小时检测一次,yourpath 为安装目录(绝对路径)

执行命令行:

1
2
3
$ crontab<<EOF
> 00 */12 * * * yourpath/certbot-auto renew
> EOF

acme.sh


由于我在主机上没有 root 和安装软件的权限,所以我就选择开源的 An ACME Shell script: acme.sh 进行管理证书, 该项目的作者将此自动管理的工具集成在项目中,包括自动更新时间等。同时也讲解了多种安装方法,详细信息请阅读作者写的安装指南。

安装

1
2
3
$ git clone https://github.com/Neilpang/acme.sh.git //下载项目文件
$ cd ./acme.sh //切换到项目目录
$ ./acme.sh --install //执行此命令进行安装

在安装中,详细安装执行过程

1、Create and copy acme.sh to your home dir ($HOME): ~/.acme.sh/. All certs will be placed in this folder too.
2、Create alias for: acme.sh=~/.acme.sh/acme.sh.
3、Create daily cron job to check and renew the certs if needed.

生成证书

单域名单证书

1
acme.sh --issue -d imsoeasy.com -w ~/public_html  // ~/public_html 是webRoot的路径,也是网站主路径

多域名单证书

1
$ acme.sh --issue -d imsoeasy.com -d www.imsoeasy.com -d blog.imsoeasy.com -w ~/public_html

上面命令会生成类似的 imsoeasy.com.cer、imsoeasy.com.key、ca.cer 文件,当然还有 fullchain.cer 文件;fullchain.cer 文件中包括 ca.cer 和 imsoeasy.com.cer 中的内容。

FAQ


1、证书重置请求超过次数,一般 3 次,子域名除外。就会出现 Sign failed: “detail”:”Error creating new cert :: Too many certificates already issued for exact set of domains: imsoeasy.com, 5 天以后才可以再次重置。Rate Limits

文档信息


  • 版权声明:自由转载-保持署名-非商用-非衍生 ( CC BY-NC-ND 4.0 )
文章目录
  1. 1. 引言
  2. 2. ACME Client
    1. 2.1. Certbot
      1. 2.1.1. 下载
      2. 2.1.2. 安装
      3. 2.1.3. 输入信息
      4. 2.1.4. 重新续签
    2. 2.2. acme.sh
      1. 2.2.1. 安装
      2. 2.2.2. 生成证书
  3. 3. FAQ
  4. 4. 文档信息