repo 在此
https://github.com/danbao/auto-ssl
记得不要直接 fork 这个 repo , 用 clone 然后 push 到你自己的 private github repo
![]() | 1 totoro625 2024-07-12 08:27:26 +08:00 大概好几年前有类似的项目,配置好后正常跑了一两年,然后 actions 就会 Skipped 网友告诉我是我这个项目太久没有修改过代码,导致 actions Skipped |
![]() | 2 totoro625 2024-07-12 08:28:23 +08:00 目前用的方案是 GCP 免费服务器,每月 200G 流量足够拉取证书等需要可靠运行的服务了 |
![]() | 3 w292614191 2024-07-12 08:36:23 +08:00 感谢分享。 现在阿里云只有 90 天免费了,大家都怎么解决的。 |
![]() | 4 linyongxin 2024-07-12 08:40:11 +08:00 宝塔自带的经常出错,后来就直接全部接入 CloudFlare ,一劳永逸 |
5 bilulanlv 2024-07-12 09:02:26 +08:00 @linyongxin 我看介绍,他似乎只是源服务器和 Cloudflare 的认证,其他厂家认这种证书吗? 源证书生成由 Cloudflare 签名的免费 TLS 证书,以安装在源服务器上。 源证书仅对 Cloudflare 与源服务器之间的加密有效。 |
![]() | 6 danbao OP @totoro625 我这个 repo 应该会避免这个问题,因为每天都会检查 SSL,检查完后会更新时间戳并提交 commit |
![]() | 7 danbao OP @w292614191 这个 repo 就是用来解决这个问题的 |
![]() | 8 keyfunc 2024-07-12 09:23:07 +08:00 不是,私钥就这么公开了? |
![]() | 9 knva 2024-07-12 09:27:56 +08:00 私钥已撸 |
11 logictan89 2024-07-12 09:59:55 +08:00 @linyongxin 宝塔垃圾,试试 1panel 。我就是因为宝塔经常续签 ssl 证书出错才换的。 |
![]() | 12 highFreqSurfer 2024-07-12 10:15:43 +08:00 @w292614191 用 certbot, 定时任务跑 |
13 stormwindcity 2024-07-12 10:33:19 +08:00 感谢分享 |
14 Jinnrry 2024-07-12 11:15:15 +08:00 via Android 道理我都懂,可是 commit 以后私钥不就泄漏了?要是把私钥打码了,那你自己怎么用啊? 要么别用 commit ,提交到自己网盘,要么你 aes 加密一下再 commit 呀 |
![]() | 15 danbao OP @Jinnrry 注意看这句话 记得不要直接 fork 这个 repo , 用 clone 然后 push 到你自己的 private github repo |
16 br_wang 2024-07-12 12:08:38 +08:00 |
![]() | 17 wdssmq 2024-07-12 12:11:05 +08:00 wdssmq/php-nginx-dc: 用于部署多站点 PHP + Nginx 环境的 Docker Compose 配置,使用 webdevops/php-nginx ; https://github.com/wdssmq/php-nginx-dc 我现在换了 All In Docker 。。acme 也跑在容器里。。/doge |
![]() | 18 danbao OP @br_wang 我的使用场景是内网有 ssl 的需求,比如 esxi ,adguard 的 DoH,但又不想专门搞个 vps 跑 cronjob |
![]() | 19 lblblong 2024-07-12 14:44:07 +08:00 有没有腾讯云版的 |
![]() | 21 molezznet 2024-07-12 15:40:39 +08:00 via Android 看起来方便的。暂时在用免费的微林 |
23 lxqxqxq 2024-07-12 16:37:44 +08:00 @w292614191 #3 哈哈哈 定时任务 /85 天执行一次 |
![]() | 24 danbao OP @lblblong 参考 acme.sh 的文档改一下密钥就行了 ```yaml name: DnsPod SSL Certificates on: schedule: # execute every 24 hours - cron: "35 7 * * *" workflow_dispatch: env: ACME: /home/runner/.acme.sh/acme.sh DP_ID: ${{ secrets.DP_ID }} DP_KEY: ${{ secrets.DP_KEY }} EMAIL: ${{ secrets.EMAIL }} jobs: build: runs-on: ubuntu-latest if: github.event_name == 'schedule' || github.event.repository.owner.id == github.event.sender.id steps: - name: Checkout uses: actions/checkout@v4 - name: Install & Configure acme.sh run: | curl https://get.acme.sh | sh -s email=$EMAIL - name: Issue & Deploy Certificates run: | export DP_Id=$DP_ID export DP_Key=$DP_KEY git config --global user.email $EMAIL git config --global user.name acme # 如果想要其他证书发行机构,可以把 acme.sh 的 ca 目录拷贝到 repo 的 ca 目录 # mkdir -p /home/runner/.acme.sh/ca/ # cp -r ca/* /home/runner/.acme.sh/ca/ check_certificate_validity() { cert_path=$1 if [ -f "$cert_path" ]; then if openssl x509 -checkend $(( 30 * 86400 )) -noout -in "$cert_path"; then echo "Certificate at $cert_path is valid for more than 30 days, skipping..." return 0 else return 1 fi else return 1 fi } issue_and_install_certificate() { domain=$1 cert_type=$2 # "EC" or "RSA" acme_server=$3 # default choose "letsencrypt" 其他 CA 请参考 https://github.com/acmesh-official/acme.sh/wiki/CA keylength=$4 # empty for EC, "3072" for RSA cert_path="./ssl/$domain" [ "$cert_type" = "RSA" ] && cert_path="$cert_path/rsa" cert_file="$cert_path/$domain.cer" key_file="$cert_path/$domain.key" # Issue certificate issue_status=0 $ACME --issue --server $acme_server --debug --dns dns_dp -d "$domain" -d "*.$domain" ${keylength:+--keylength $keylength} || issue_status=$? if [ $issue_status -ne 0 ]; then echo "Failed to issue $cert_type certificate for $domain, skipping..." return fi # Install certificate install_status=0 $ACME --installcert -d "$domain" --key-file "$key_file" --fullchain-file "$cert_file" || install_status=$? if [ $install_status -ne 0 ]; then echo "Failed to install $cert_type certificate for $domain, skipping..." return fi TIMESTAMP=$(date +"%Y-%m-%d %H:%M:%S") git add $cert_path/ git commit -m "Update $cert_type certificate files for $domain at $TIMESTAMP" } while IFS= read -r domain || [ -n "$domain" ]; do mkdir -p "./ssl/$domain/rsa" # Check and issue/install EC certificate if ! check_certificate_validity "./ssl/$domain/$domain.cer"; then issue_and_install_certificate "$domain" "EC" "letsencrypt" "" fi # Check and issue/install RSA certificate if ! check_certificate_validity "./ssl/$domain/rsa/$domain.cer"; then issue_and_install_certificate "$domain" "RSA" "letsencrypt" "3072" fi done < dnspod_domains_list.txt - name: Push changes uses: ad-m/github-push-action@master with: github_token: ${{ secrets.GITHUB_TOKEN }} ``` |
![]() | 25 gaojiren 2024-07-12 16:51:46 +08:00 我用 AlphaSSL ,泛域名 1 年 30 块钱,花小钱办大事 |
![]() | 26 Actrace 2024-07-13 14:06:49 +08:00 vx 有免费的自动续签的 SSL 服务,只需要配置 DNS 就完成配置下证书。 应该是目前最简单的。 |
![]() | 29 jeffma 2024-07-13 17:44:29 +08:00 ![]() 自荐下自己的方案,已经稳定运行两年多了 借助腾讯云云函数实现的 ACME Let’s Encrypt SSL 证书自动更新 https://github.com/Jeff2Ma/acme-qcloud-scf |
![]() | 30 jeffma 2024-07-13 17:45:05 +08:00 @lblblong 自荐下自己的方案,已经稳定运行两年多了 借助腾讯云云函数实现的 ACME Let’s Encrypt SSL 证书自动更新 https://github.com/Jeff2Ma/acme-qcloud-scf |
31 ilylx2008 2024-07-13 21:30:01 +08:00 有自动更新阿里云腾讯云 cdn 的证书么 |