letsencrypt申请泛域名证书,二级域名续约

Let’s encrypt 提供期限为三个月的免费SSL证书,到期之后需要renew,官方还提供自动renew的工具certbot。
这里记录下使用Let’s Encrypt生成泛域名的通用证书。

一、获取certbot 客户端

2021/4/16更新,certbot-auto不再支持所有的操作系统,所以使用之前的下载方法,可能会报系统不再支持,所以提供官方最新的下载方法。

Skipping bootstrap because certbot-auto is deprecated on this system.
Your system is not supported by certbot-auto anymore.
Certbot cannot be installed.
Please visit https://certbot.eff.org/ to check for other alternatives.

之前的获取方法

# 下载 Certbot 客户端
$ wget -c https://dl.eff.org/certbot-auto -P /usr/local/bin/
# 设为可执行权限
$ chmod a+x /usr/local/bin/certbot-auto
$ certbot-auto --version
certbot 0.34.2

可以正常下载,但是在使用的过程中,会报
Skipping bootstrap because certbot-auto is deprecated on this system.
Your system is not supported by certbot-auto anymore.
所以这种方法我们暂时弃用,采用官方最新的方法。

官方最新安装方法

(1)、安装epel 和 snapd:

# 先安装epel
yum install epel-release

# 安装snapd
yum install snapd

(2)、启用snapd.socket:

systemctl enable --now snapd.socket

(3)、创建/var/lib/snapd/snap和/snap之间的链接:

ln -s /var/lib/snapd/snap /snap

(4)、重启系统:
重启之后,记得重启自己的nginx,php,mysql等服务

reboot

(5)、更新snap至最新版本:

snap install core
snap refresh core

(6)、卸载之前的certbot:

# 卸载之前的certbot
yum remove certbot

# 删除certbot相关文件:
rm /usr/local/bin/certbot-auto

# 删除certbot附加软件包:
rm -rf /opt/eff.org/certbot

(7)、通过snap安装certbot:

snap install --classic certbot

(8)、创建/snap/bin/certbot软链接:

ln -s /snap/bin/certbot /usr/bin/certbot

二、开始申请证书

假设域名为 *.example.com

certbot certonly  -d *.example.com --manual --preferred-challenges dns --server https://acme-v02.api.letsencrypt.org/directory 

certonly,表示安装模式,Certbot 有安装模式和验证模式两种类型的插件。
-d 为那些主机申请证书,如果是通配符,输入 *.example.com
–manual 表示手动安装插件,Certbot 有很多插件,不同的插件都可以申请证书,用户可以根据需要自行选择
–preferred-challenges dns,使用 DNS 方式校验域名所有权
–server,Let’s Encrypt ACME v2 版本使用的服务器不同于 v1 版本,需要显示指定。
执行完以上命令之后,就是命令行的输出,根据提示输入相应内容:

Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator manual, Installer None
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel): fate1028@163.com #用于安全以及续约通知的邮箱

- - - - - - - 
  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值