No project description provided
Project description
功能
通过本脚本可以为阿里云的 CDN
以及 直播服务
域名申请配置以及自动续期免费的 let's encrypt 证书。 DOC EN
安装和配置
本脚本仅支持 Python 3
pip install aliyun-cert
需要配置阿里云 ram 账号的 access key,并至少赋予用户如下权限:
- AliyunDNSFullAccess
- AliyunCDNFullAccess
- AliyunYundunCertFullAccess
如需同时配置直播 CDN 的证书,还需赋予如下权限:
- AliyunLiveFullAccess
access key 记录在一个文件中,比如 ~/.serects/aliyun.ini
,格式如下
dns_aliyun_key_id = xxx
dns_aliyun_key_secret = yyy
申请并配置证书
证书支持多域名,以及通配符域名,根据自己情况替换下面的 example.com
以及 *.example.com
certbot certonly \
--authenticator dns-aliyun \
--dns-aliyun-propagation-seconds 30 \
--dns-aliyun-credentials ~/.secrets/aliyun.ini \
-d example.com -d *.example.com
为阿里云配置证书
# 上传证书到阿里云 cas 服务
aliyun-cert upload-cert --domain example.com /etc/letsencrypt/live/example.com/fullchain.pem /etc/letsencrypt/live/example.com/privkey.pem
# 为 CDN 域名配置证书,cert-id 为上一步返回的 id
aliyun-cert set-cert --cert-id 123456 --domain cdn.example.com --service cdn
查看证书情况
# 显示阿里云证书服务上所有上传上去的证书
aliyun-cert list-certs
# 显示所有开通了 HTTPS 的 CDN 域名及其证书情况
aliyun-cert lish-domains --cdn
证书续期
创建 crontab 文件 /etc/cron.d/certbot
0 0,12 * * * root sleep 1471 && certbot renew -q
创建 certbot 的 deploy hook 脚本,每次 certbot 成功续期续期证书后都会自动调用改脚本上传证书并配置阿里云的服务 /etc/letsencrypt/renewal-hooks/deploy/09-deploy-aliyun.sh
#!/bin/bash
aliyun-cert certbot-deploy-hook --cdn --delete-old-cert
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aliyun-cert-0.1.0.tar.gz
(22.6 kB
view details)
Built Distribution
File details
Details for the file aliyun-cert-0.1.0.tar.gz
.
File metadata
- Download URL: aliyun-cert-0.1.0.tar.gz
- Upload date:
- Size: 22.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8af0d8b370ec48c67cd323da5b11b091711d507b57286b971c84781127683570 |
|
MD5 | e78d0e2668a6f57616ba1dd337640fcb |
|
BLAKE2b-256 | fcf7cd0b0cdbcd97967e2221e3c2745a1be2b7a48e0d8bff18dc8f00be20362e |
File details
Details for the file aliyun_cert-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: aliyun_cert-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/4.0.2 CPython/3.11.8
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3ec82b8a95b1c379d691e6b275440ce976da2b6a97ec26c886d309e15b853b21 |
|
MD5 | 65ae48407cb2a1b25494031f2cdcf03d |
|
BLAKE2b-256 | 14a7c53817ae7c1f14a81b7639d765bfe797e04bd6ed59f6bf97227a6d637a8d |