Let's Encrypt 通配符证书免费申请自动续期

Published on 03 August 2020 By. ghost

什么是 Let’s Encrypt?

file

Let’s Encrypt是一个由非营利性组织互联网安全研究小组(ISRG)提供的免费、自动化和开放的证书颁发机构(CA)。

简单的说,借助Let’s Encrypt颁发的证书可以为我们的网站免费启用HTTPS(SSL/TLS) 。

Let’s Encrypt免费证书的签发/续签都是脚本自动化的,官方提供了几种证书的申请方式方法,点击此处快速浏览。

官方推荐使用Certbot客户端来签发证书。

如何申请 Let’s Encrypt 通配符证书

为了实现通配符证书,Let’s Encrypt 对 ACME 协议的实现进行了升级,只有 v2 协议才能支持通配符证书。

也就是说任何客户端只要支持 ACME v2 版本,就可以申请通配符证书了。

下载certbot-auto

$ wget https://dl.eff.org/certbot-auto  
$ chmod a+x  certbot-auto 
$ ./certbot-auto --version
Requesting to rerun ./certbot-auto with root privileges...
./certbot-auto has insecure permissions!
To learn how to fix them, visit https://community.letsencrypt.org/t/certbot-auto-deployment-best-practices/91979/
certbot 1.6.0

申请通配符证书脚本

https://github.com/ywdblog/certbot-letencrypt-wildcardcertificates-alydns-au

$ git clone https://github.com/ywdblog/certbot-letencrypt-wildcardcertificates-alydns-au

$ cd certbot-letencrypt-wildcardcertificates-alydns-au

$ chmod 0777 au.sh

到期定时续费脚本

这里的脚本是nginx 编译安装或者通过docker 安装的服务器 通过宿主机代理 或者负载均衡主机代理https

自动备份ssl证书 重启nginx代理服务器

注:脚本实际使用的依然是 ./certbot-auto renew

#!/usr/bin/env bash

cmd="$HOME/certbot-auto" 
restartNginxCmd="docker restart ghost_nginx_1"
action="renew"
auth="$HOME/certbot/au.sh php aly add"
cleanup="$HOME/certbot/au.sh php aly clean"
deploy="cp -r /etc/letsencrypt/ /home/pi/dnmp/services/nginx/ssl/ &&  $restartNginxCmd"

$cmd $action \
     --manual \
     --preferred-challenges dns \
     --deploy-hook  \
     "$deploy"\
     --manual-auth-hook \
     "$auth" \
     --manual-cleanup-hook \
     "$cleanup"

加入 crontab

编辑文件 /etc/crontab :

#证书有效期<30天才会renew,所以crontab可以配置为1天或1周
#   0 0 * * * root python -c 'import random; import time; time.sleep(random.random() * 3600)' && /home/pi/crontab.sh
20条评论
BobbieSnpl
Thu, Aug 4, 2022 4:14 AM
biggest online casino bonuses [url="https://firstonlinecasino.org"]free online casino no deposit[/url] best online casinos for us players
LeslieSnpl
Fri, Aug 5, 2022 2:16 AM
online mobile casino [url="https://free-online-casinos.net"]free no deposit bonus casino[/url] top mobile casino
HonorSnpl
Sun, Aug 7, 2022 12:13 PM
top rated vpn service [url="https://freehostingvpn.com"]best vpn for computer[/url] firefox vpn
TrudieSnpl
Mon, Aug 8, 2022 2:48 AM
win real money online casino for free [url="https://internet-casinos-online.net"]free no deposit bonus casino[/url] sign up casino bonus
TeddieSnpl
Mon, Aug 8, 2022 8:15 AM
free avast vpn license key [url="https://freevpnconnection.com"]buy vpn service[/url] buy a vpn server
JaynellSnpl
Tue, Aug 9, 2022 3:00 AM
casino bonuser [url="https://newlasvegascasinos.com"]best casino deposit bonus[/url] best deposit bonus casino
MarrileeSnpl
Tue, Aug 9, 2022 4:56 AM
which vpn to buy [url="https://free-vpn-proxy.com"]best vpn service providers[/url] best vpn router
JenneeSnpl
Tue, Aug 9, 2022 4:06 PM
vpn best buy [url="https://imfreevpn.net"]buy 911 vpn[/url] vpn to buy crypto
DulceaSnpl
Wed, Aug 10, 2022 10:40 AM
online casino deposit bonus [url="https://onlinecasinofortunes.com"]bovada online casino[/url] online casino bonuses
JenneeSnpl
Wed, Aug 10, 2022 1:25 PM
best free vpn for chromebook [url="https://imfreevpn.net"]open vpn[/url] best vpn services 2022
AshleighSnpl
Thu, Aug 11, 2022 9:17 AM
ivacy vpn [url="https://ippowervpn.net"]best free vpn for kodi[/url] best vpn 2017
CarolanSnpl
Thu, Aug 11, 2022 9:54 AM
best casinos online [url="https://onlinecasinosdirectory.org"]mobile casino sites[/url] free welcome bonus no deposit
KelseySnpl
Fri, Aug 12, 2022 6:05 AM
super vpn free download [url="https://rsvpnorthvalley.com"]free vpn server[/url] free vpn firefox
FanyaSnpl
Fri, Aug 12, 2022 9:48 AM
best online casino [url="https://onlineplayerscasino.com"]online casino games that pay[/url] best online casinos for usa players
LaurellaSnpl
Sat, Aug 13, 2022 4:30 AM
best free vpn for torrenting [url="https://shiva-vpn.com"]vpn stocks to buy[/url] vpn best value
CarolinSnpl
Sat, Aug 13, 2022 10:53 AM
real money casino online [url="https://ownonlinecasino.com"]bingo online for money[/url] free slots for mac
SheelaghSnpl
Sat, Aug 13, 2022 10:14 PM
best vpn 2022 reddit [url="https://superfreevpn.net"]best vpn proxy betternet[/url] free vpn website
SheelaghSnpl
Sun, Aug 14, 2022 10:39 AM
p2p vpn free [url="https://superfreevpn.net"]vypr vpn[/url] vpn for firefox
SheelaghSnpl
Mon, Aug 15, 2022 6:46 AM
best free vpn for ios [url="https://superfreevpn.net"]vpn avast[/url] cyberghost vpn free trial
FifineSnpl
Tue, Aug 16, 2022 12:41 AM
free online games to win real money no deposit [url="https://trust-online-casino.com"]best online casino deposit bonuses[/url] no deposit bonus

发表评论

您的电子邮件地址不会被公布。必填字段被标记为*