===== ACME.SH 证书工具 =====
ACME 是一个使用纯 BASH SHELL 写的用于 Let's encrypt 等免费SSL证书的签发、续签工具
项目地址:[[https://github.com/acmesh-official/acme.sh|ACME.SH]]
==== ACME 安装 ====
curl -k https://get.acme.sh | sh -s email=f.hsiaotien@gmail.com
==== 安装 socat ====
当作为独立服务器申请证书时,需要使用 socat 运行一个简易Web服务器
yum install socat
==== 重载 .bashrc ====
. /root/.bashrc
===== 签发证书 =====
使用 CloudFlare APIKEY
==== 找到 Cloudflare 密钥 ====
#CF_Token=""
export CF_Zone_ID="xxxxxxxxx"
#CF_Account_ID="xxxxxx"
Multi-Domain
export CF_Key="xxxxxxxx"
export CF_Email="xxxxx@gmail.com"
当为主域名或者泛域名申请证书时,需要使用 ''CF_KEY'' 和 ''CF_EMAIL''
该数据非常重要,不能外泄,这两个数据可以在 Cloudflare 的 DNS 的控制台那里找到
==== 签发证书 ====
acme.sh --issue --dns dns_cf -d ovwx.org -d '*.ovwx.org'
==== 刷新证书 ====
$acmedir/acme.sh --cron --home $acmedir
"/opt/.acme.sh"/acme.sh --cron --home "/opt/.acme.sh"
在多台服务器上使用证书:需在一台服务器上签发了证书之后,将整个 ".acme.sh" 目录复制到新的服务器上,然后只需要也进行刷新就行了。
证书位置
# Your cert is in: /root/.acme.sh/your_domain_ecc/subdomain.cer
# Your cert key is in: /root/.acme.sh/your_domain_ecc/subdomain.key
# The intermediate CA cert is in: ~/.acme.sh/your_domain_ecc/ca.cer
# And the full chain certs is there: ~/.acme.sh/your_domain_ecc/fullchain.cer
==== 移除证书 ====
acme.sh --remove -d abc.ovwx.org --ecc
==== 安装证书到特定目录 ====
acme.sh --issue --dns dns_cf -d domain.com -d *.domain.com \
--installcert \
--key-file /etc/nginx/cert.d/domain.key \
--fullchain-file /etc/nginx/cert.d/domain.pem \
--reloadcmd "nginx -s reload"
===== 查看证书信息 =====
查看证书信息
openssl x509 -noout -text -in server.crt
查看Key信息
openssl rsa -noout -text -in server.key
openssl ec -noout -text -in server.key #针对EC密钥
查看证书请求信息
openssl req -noout -text -in server.csr