{"id":18466238,"url":"https://github.com/0xjacky/cdn_cert","last_synced_at":"2025-04-08T08:32:10.005Z","repository":{"id":103326090,"uuid":"111270084","full_name":"0xJacky/cdn_cert","owner":"0xJacky","description":"Automatically push the new certificates to Aliyun CDN","archived":false,"fork":false,"pushed_at":"2024-09-11T10:55:10.000Z","size":173,"stargazers_count":39,"open_issues_count":1,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-23T09:48:36.378Z","etag":null,"topics":["aliyun","cdn","letsencrypt","letsencrypt-utils"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0xJacky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-19T06:21:49.000Z","updated_at":"2025-02-08T04:36:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"383f05a2-2f8a-4bb1-aa90-a68786b5dca7","html_url":"https://github.com/0xJacky/cdn_cert","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xJacky%2Fcdn_cert","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xJacky%2Fcdn_cert/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xJacky%2Fcdn_cert/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0xJacky%2Fcdn_cert/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0xJacky","download_url":"https://codeload.github.com/0xJacky/cdn_cert/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247804668,"owners_count":20999024,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aliyun","cdn","letsencrypt","letsencrypt-utils"],"created_at":"2024-11-06T09:15:48.751Z","updated_at":"2025-04-08T08:32:09.590Z","avatar_url":"https://github.com/0xJacky.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# CDN Cert\n自动将 Let's encrypt，或其他网站证书推送到阿里云 CDN\n\n## v2.1 更新日志\n更新于 2021 年 8 月 28 日\n1. 修复 Python3.9 下邮件发送问题\n2. 新增自定义证书路径配置，从上个版本更新的用户请在 `cert.db` 中，\n为 `domain` 表添加 `cert_path(VARCHAR(255),is_nullable:YES)` \n和 `private_key_path(VARCHAR(255),is_nullable:YES)`\n3. 使用 configparse 管理配置文件，更新时请将 `config-template.ini` 复制一份改名为 `config.ini` 并重新配置\n4. 可修改域名证书配置和用户信息\n5. 支持 Docker 部署\n6. Docker 容器自动配置定时任务，每天 01:00 执行更新，日志自动记录在 cdncert.log\n\n## v2 更新日志\n更新于 2019 年 7 月 8 日\n\n1. 支持多 RAM 账号。\n\n    即当您有多个网站存在于同一个服务器上，且多个网站部署CDN时使用的不是同一阿里云账号时，\n    CDN Cert 可以向多个阿里云账号推送续签后的证书。\n\n2. **完全迁移至 Python 3.7**\n\n### 工作原理\n定期[1]对比存储在本机的证书与上一次推送成功的证书的 MD5\n\n如有差异则将新证书推送到 CDN\n\n使用 SQLite3 做为数据库，并支持阿里云邮件推送服务，如有更新可以将推送结果发送到您的邮箱。\n\n## Docker 部署\n\n1. 准备\n\n   ```\n   git clone https://github.com/0xJacky/cdn_cert.git\n   ```\n\n2. 配置将 `config-template.ini` 复制一份并命名为 `config.ini`\n\n3. 运行 Docker\n\n   ```\n   docker run -dit -v ${配置和数据库文件目录}:/app/data \\\n                   -v ${证书文件夹的绝对路径}:/cert \\\n                   --name=cdn_cert -e \"TZ=Asia/Shanghai\" \\\n                   uozi/cdn_cert /bin/bash\n   ```\n\n4. 修改配置后使用 `docker restart cdn_cert` 重启容器。\n\n5. 进入容器配置域名及用户信息\n\n   ```\n   docker exec -it \u003cimage_id\u003e /bin/bash\n   ```\n\n6. 注意映射目录后进入 docker 内配置自定义证书的路径，此路径是容器内的绝对路径。\n\n## 手动配置环境\n\n1. 准备\n   ```\n   git clone https://github.com/0xJacky/cdn_cert.git\n   pip3 install -r requirements.txt\n   ```\n2. 将 `config-template.ini` 复制一份并命名为 `config.ini`\n\n## config.ini 配置说明\n\n| 配置项                           | 默认值                | 说明                                                         |\n| -------------------------------- | --------------------- | ------------------------------------------------------------ |\n| database.Path                    | cert.db               | 指定数据库存储的地址，相对路径                               |\n| letencrypt.Path                  | /cert                 | Let's encrypt 证书目录，使用 Docker 模式时将证书文件夹的绝对路径映射到 /cert 即可，可以不修改此项 |\n| letencrypt.ServerCertificateName | fullchain.cer         | 如果您使用的是 Let's encrypt 官方的 certbot 则无需修改此项   |\n| letencrypt.PrivateKeyName        | {{ domain_name }}.key | PrivkeyName 提供变量 {{ domain_name }}\u003cbr /\u003e例如，使用 acme.sh 管理证书的用户，生成的私钥名称与域名相同，则应该设置为 PrivkeyName = {{ domain_name }}.key |\n| mail.Host                        | smtpdm.aliyun.com     | 邮件反馈设置 - 阿里云邮件推送服务                            |\n| mail.Port                        | 465                   | 发信端口，除 80 端口外默认使用 SSL                           |\n| mail.UserName                    | -                     | 发件人地址，通过控制台创建的发件人地址                       |\n| mail.PassWord                    | -                     | 发件人密码，通过控制台创建的发件人密码                       |\n| mail.From                        | -                     | 发件人昵称                                                   |\n| mail.To                          | -                     | 收件人地址，支持多个收件人，最多30个，以 `,` 分割            |\n\n\n\n## 使用方法\n\n1. 用法 `-h/ --help`\n    ```\n   usage: cdncert.py [-h] [-f] [-o ONLY] [-a {domain,user}] [-e {domain,user}] [-d {domain,user}] [-ls {domains,users}] [-v]\n   \n   CDN Cert - Automatically push the new certificates to CDN\n   \n   optional arguments:\n     -h, --help            show this help message and exit\n     -f, --force           force update\n     -o ONLY, --only ONLY  update only, use it after -f/--force\n     -a {domain,user}, --add {domain,user}\n                           add [domain/user] to database\n     -e {domain,user}, --edit {domain,user}\n                           edit [domain/user] in database\n     -d {domain,user}, --delete {domain,user}\n                           delete [domain/user] from database\n     -ls {domains,users}, --list {domains,users}\n                           print all [domains/users] from database\n     -v, --verbosity       increase output verbosity\n   \n   ```\n   \n2. 添加用户信息 `-a user`\n\n    ![image][image-1]\n\n    ![image][image-2]\n\n3. 添加域名信息 `-a domain`\n\n    ![image][image-3]\n\n4. 编辑用户 `-e user`\n\n5. 编辑域名 `-e domain`\n\n6. 删除用户 `-d user`\n\n    ![image][image-4]\n\n    ![image][image-5]\n\n7. 删除域名 `-d domain`\n\n    ![image][image-6]\n\n8. 列出所有域名/用户 `-ls users/domains`\n\n    ![image][image-7]\n\n    ![image][image-8]\n\n    \n\n9. 开发模式 `-v`\n\n10. 强制更新 `-f`\n\n11. 仅更新单个域名 `-f -o {doamain}`\n\n12. 推送成功的邮件模板\n\n     ![image][image-9]\n\n13. 定时配置（Docker 无需配置）\n```\ncrontab -e\n# 每天 3:30 执行\n30 3 * * * python3 /path/to/cdncert.py\n```\n\n### LICENSE 版权声明\nCopyright © 2017 - 2024 0xJacky\n\nThe program is distributed under the terms of the GNU Affero General Public License.\n\nThis program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.\n\nThis program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.\n\nYou should have received a copy of the GNU Affero General Public License along with this program. If not, see http://www.gnu.org/licenses/.\n\n\n[image-1]:\tscreenshots/1.png\n[image-2]:\tscreenshots/2.png\n[image-3]:\tscreenshots/3.png\n[image-4]:\tscreenshots/4.png\n[image-5]:\tscreenshots/5.png\n[image-6]:\tscreenshots/6.png\n[image-7]:\tscreenshots/7.png\n[image-8]:\tscreenshots/8.png\n[image-9]:\tscreenshots/9.png\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xjacky%2Fcdn_cert","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0xjacky%2Fcdn_cert","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0xjacky%2Fcdn_cert/lists"}