30 lines
1.2 KiB
Markdown
30 lines
1.2 KiB
Markdown
# 更新或安装证书
|
||
## 安装acme.sh,并使用dns方式生成证书
|
||
```shell
|
||
# 安装acme.sh
|
||
curl https://get.acme.sh | sh -s email="xxx@xxx.com"
|
||
|
||
# 使用dns方式生成证书
|
||
cat >> ~/.bashrc << EOF
|
||
# Username与DomainName在相应iam账号的我的凭证中获取
|
||
export HUAWEICLOUD_Username="dns" # 华为云iam账号
|
||
export HUAWEICLOUD_Password="xxxx" # 华为云iam密码
|
||
export HUAWEICLOUD_DomainName="turingsynergy" # 华为云账号
|
||
EOF
|
||
|
||
source ~/.bashrc
|
||
## 生成证书
|
||
acme.sh --issue -d turingsynergy.com -d *.turingsynergy.com --dns dns_huaweicloud
|
||
## 安装证书
|
||
## 替换[]为证书id
|
||
acme.sh --install-cert -d turingsynergy.com \
|
||
--key-file /opt/webhook/scripts/tlsupdatev1/ssl//turingsynergy.com.key \
|
||
--fullchain-file /opt/webhook/scripts/tlsupdatev1/ssl//turingsynergy.com.pem \
|
||
--reloadcmd "curl 'https//webhook-ops.shasoapp.com/hooks/tlsupdate?action=upadte&&id=[华为云中配置的证书id]'"
|
||
```
|
||
|
||
# 查看证书状态
|
||
```shell
|
||
# 如果证书有效期小于一周,推送通知到飞书,点击链接即可更新证书(前提是本地证书已更新)
|
||
curl 'https//webhook-ops.shasoapp.com/hooks/tlsupdate?action=status&&id=[华为云中配置的证书id]'
|
||
```
|