更新 letsencrypt
Some checks failed
CodeQL / Analyze (go) (push) Has been cancelled

This commit is contained in:
apple
2026-04-25 14:14:39 +08:00
parent 96812e7ed4
commit 89e359ae7d
6 changed files with 24 additions and 19 deletions

View File

@@ -25,7 +25,7 @@ jobs:
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4.2.2 uses: actions/checkout@v6.0.2
with: with:
fetch-depth: 0 fetch-depth: 0
token: ${{ env.GITHUB_ACCESS_TOKEN }} token: ${{ env.GITHUB_ACCESS_TOKEN }}

View File

@@ -14,7 +14,7 @@ jobs:
steps: steps:
- name: Release - name: Release
uses: softprops/action-gh-release@v2.2.1 uses: softprops/action-gh-release@v2.6.1
with: with:
generate_release_notes: true generate_release_notes: true
make_latest: "true" make_latest: "true"

View File

@@ -1 +1 @@
FROM ccr.ccs.tencentyun.com/miaogai/goacme:v4.22.2 FROM goacme/lego:v4.33.0

View File

@@ -9,7 +9,7 @@ dokku-letsencrypt is the official plugin for [dokku][dokku] that gives the abili
## Installation ## Installation
```shell ```shell
sudo dokku plugin:install http://47.94.22.80:3000/gitea/dokku-letsencrypt.git sudo dokku plugin:install https://github.com/dokku/dokku-letsencrypt.git
sudo dokku letsencrypt:cron-job --add # <- To enable auto-renew sudo dokku letsencrypt:cron-job --add # <- To enable auto-renew
``` ```

View File

@@ -38,19 +38,23 @@ cmd-letsencrypt-auto-renew() {
# For all apps, sorted by ascending time left until renewal. # For all apps, sorted by ascending time left until renewal.
# This way, we'll prioritize apps that need to be renewed soon # This way, we'll prioritize apps that need to be renewed soon
# if we should hit a rate limit along the way. # if we should hit a rate limit along the way.
fn-letsencrypt-list-apps-with-expiry \ # Store the list in a temporary file to avoid subshell issues with pipelines
| sort -nk5 \ local temp_file=$(mktemp)
| while IFS=$'\t' read -r -a appExpiry; do fn-letsencrypt-list-apps-with-expiry | sort -nk5 > "$temp_file"
if [[ ${appExpiry[4]} -lt 0 ]]; then while IFS=$'\t' read -r -a appExpiry; do
dokku_log_info1 "${appExpiry[0]} needs renewal" if [[ ${appExpiry[4]} -lt 0 ]]; then
dokku letsencrypt:enable "${appExpiry[0]}" || EXIT_CODE=$? dokku_log_info1 "${appExpiry[0]} needs renewal"
else if ! dokku letsencrypt:enable "${appExpiry[0]}"; then
days_left=$(fn-letsencrypt-format-timediff "${appExpiry[4]}") EXIT_CODE=1
dokku_log_verbose "${appExpiry[0]} still has $days_left days left before renewal"
fi fi
else
done days_left=$(fn-letsencrypt-format-timediff "${appExpiry[4]}")
dokku_log_verbose "${appExpiry[0]} still has $days_left days left before renewal"
fi
done < "$temp_file"
rm -f "$temp_file"
dokku_log_info2 "Finished auto-renewal" dokku_log_info2 "Finished auto-renewal"
if [[ "$EXIT_CODE" != 0 ]]; then if [[ "$EXIT_CODE" != 0 ]]; then

View File

@@ -231,7 +231,7 @@ fn-letsencrypt-check-email() {
fn-letsencrypt-configure-and-get-dir() { fn-letsencrypt-configure-and-get-dir() {
declare desc="assemble lego command line arguments and create a config hash directory for them" declare desc="assemble lego command line arguments and create a config hash directory for them"
declare APP="$1" declare APP="$1"
local config config_dir config_hash dns_provider domain_args domains email extra_args graceperiod key server value local config config_dir config_hash dns_provider domain_args domains email extra_args cert_timeout key server value
local app_root="$DOKKU_ROOT/$APP" local app_root="$DOKKU_ROOT/$APP"
local le_root="$app_root/letsencrypt" local le_root="$app_root/letsencrypt"
@@ -251,10 +251,11 @@ fn-letsencrypt-configure-and-get-dir() {
domain_args="$domain_args --domains $domain" domain_args="$domain_args --domains $domain"
done done
graceperiod="$(fn-letsencrypt-computed-graceperiod "$APP")" # lego --cert.timeout is in seconds and defaults to 30
cert_timeout=30
email="$(fn-letsencrypt-computed-email "$APP")" email="$(fn-letsencrypt-computed-email "$APP")"
extra_args="$(fn-letsencrypt-computed-lego-docker-args "$APP")" extra_args="$(fn-letsencrypt-computed-lego-docker-args "$APP")"
config="--pem --accept-tos --cert.timeout $graceperiod --path /certs --server $server --email $email $extra_args $domain_args" config="--pem --accept-tos --cert.timeout $cert_timeout --path /certs --server $server --email $email $extra_args $domain_args"
dns_provider="$(fn-letsencrypt-computed-dns-provider "$APP")" dns_provider="$(fn-letsencrypt-computed-dns-provider "$APP")"
if [[ -n "$dns_provider" ]]; then if [[ -n "$dns_provider" ]]; then