From b792a3cb7bf7456219b1da4b0855d6a3fc9a25af Mon Sep 17 00:00:00 2001 From: Viktor Barzin Date: Sat, 15 Feb 2025 15:47:14 +0000 Subject: [PATCH] try again fixing renewal script via cf [ci skip] --- modules/kubernetes/setup_tls_secret/renew2.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/modules/kubernetes/setup_tls_secret/renew2.sh b/modules/kubernetes/setup_tls_secret/renew2.sh index 1c6b37b1..ba35dbe6 100755 --- a/modules/kubernetes/setup_tls_secret/renew2.sh +++ b/modules/kubernetes/setup_tls_secret/renew2.sh @@ -27,8 +27,8 @@ curl https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/dns_records -H "Authorization: Bearer $CLOUDFLARE_TOKEN" \ -d "{ \"comment\": \"certbot temporary challenge\", - \"content\": \"$CERTBOT_VALIDATION\", - \"name\": \"_acme-challenge.viktorbarzin.me\", + \"content\": \"\$CERTBOT_VALIDATION\", + \"name\": \"_acme-challenge.\$CERTBOT_DOMAIN\", \"proxied\": false, \"ttl\": 60, \"type\": \"TXT\" @@ -55,10 +55,11 @@ cat << EOF > $certbot_cleanup #curl "http://technitium-web.technitium.svc.cluster.local:5380/api/zones/records/delete?token=\$API_TOKEN&domain=_acme-challenge.\$CERTBOT_DOMAIN&type=TXT&text=\$CERTBOT_VALIDATION" # CLOUDFLARE -record_id=$(curl https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/dns_records -H "Authorization: Bearer $CLOUDFLARE_TOKEN" | jq -r '.result[] | select(.name | contains("acme")) | .id') -curl https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/dns_records/$record_id \ - -X DELETE \ - -H "Authorization: Bearer $CLOUDFLARE_TOKEN" +curl https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/dns_records -H "Authorization: Bearer $CLOUDFLARE_TOKEN" | jq -r '.result[] | select(.name | contains("acme")) | .id' | while read -r record_id; do + curl https://api.cloudflare.com/client/v4/zones/$CLOUDFLARE_ZONE_ID/dns_records/\$record_id \ + -X DELETE \ + -H "Authorization: Bearer $CLOUDFLARE_TOKEN" +done EOF