acme自动证书申请

安装acme.sh

curl  https://get.acme.sh | sh
  • acme.sh默认安装到了当前家目录。
[root@iZbp17hycbhnayg00ohec9Z ~]# ~/.acme.sh/
[root@iZbp17hycbhnayg00ohec9Z ~]# ll .acme.sh/
total 492
-rw-r--r-- 1 root root    296 Aug 15 14:28 account.conf
-rwxr-xr-x 1 root root 190583 Aug 15 14:28 acme.sh
-rw-r--r-- 1 root root     78 Aug 15 14:10 acme.sh.csh
-rw-r--r-- 1 root root     78 Aug 15 14:10 acme.sh.env
-rw-r--r-- 1 root root 269335 Aug 15 14:28 acme.sh.log
drwxr-xr-x 4 root root   4096 Aug 15 14:12 ca
drwxr-xr-x 2 root root   4096 Aug 15 14:28 deploy
drwxr-xr-x 2 root root   4096 Aug 15 14:28 dnsapi
-rw-r--r-- 1 root root   2777 Aug 15 14:28 http.header
drwxr-xr-x 2 root root   4096 Aug 15 14:28 notify
  • 此次安装,会在crontab创建定时任务。
[root@iZbp17hycbhnayg00ohec9Z ~]# crontab -l
5 0 * * * "/root/.acme.sh"/acme.sh --cron --home "/root/.acme.sh" > /dev/null

添加自动DNS验证

  • 需要阿里云添加子账号,并授权“管理云解析权限”,添加API,阿里云 AK 是使用阿里云子账户来添加的。
  • 其它自动DNS API验证方法参考:https://github.com/Neilpang/acme.sh/wiki/dnsapi

  • 设置阿里云子账号环境变量。

[root@iZbp17hycbhnayg00ohec9Z ~]# cat .bashrc 
export Ali_Key="xxxx"
export Ali_Secret="xxx"
[root@iZbp17hycbhnayg00ohec9Z ~]# source .bashrc

申请证书

  • 申请证书
[root@iZbp17hycbhnayg00ohec9Z ~]# acme.sh --issue --dns dns_ali -d domain.com -d *.domain.com
  • 安装证书
acme.sh --install-cert -d domain.com -d *.domain.com\
  --key-file       /etc/nginx/sslkey/domain.com.key  \
  --fullchain-file /etc/nginx/sslkey/domain.com.pem \
  --reloadcmd     "/etc/init.d/nginx force-reload"
  • acme.sh自动更新
[root@iZbp17hycbhnayg00ohec9Z ~]# acme.sh  --upgrade  --auto-upgrade
[root@iZbp17hycbhnayg00ohec9Z ~]# cat .bashrc 
. "/root/.acme.sh/acme.sh.env"
#证书列表
[root@iZbp17hycbhnayg00ohec9Z ~]# acme.sh list
Main_Domain  KeyLength  SAN_Domains   Created                       Renew
eoecfd.com   ""         *.domain.com  Thu Aug 15 06:13:10 UTC 2019  Mon Oct 14 06:13:10 UTC 2019

转载于:https://www.cnblogs.com/ligao/p/11598392.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值