CARVIEW |
Select Language
HTTP/2 200
date: Sat, 11 Oct 2025 11:28:49 GMT
content-type: text/html; charset=utf-8
vary: X-PJAX, X-PJAX-Container, Turbo-Visit, Turbo-Frame, X-Requested-With,Accept-Encoding, Accept, X-Requested-With
etag: W/"32418b23e9096a06c094d9bccb4c7ed0"
cache-control: max-age=0, private, must-revalidate
strict-transport-security: max-age=31536000; includeSubdomains; preload
x-frame-options: deny
x-content-type-options: nosniff
x-xss-protection: 0
referrer-policy: origin-when-cross-origin, strict-origin-when-cross-origin
content-security-policy: default-src 'none'; base-uri 'self'; child-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/; connect-src 'self' uploads.github.com www.githubstatus.com collector.github.com raw.githubusercontent.com api.github.com github-cloud.s3.amazonaws.com github-production-repository-file-5c1aeb.s3.amazonaws.com github-production-upload-manifest-file-7fdce7.s3.amazonaws.com github-production-user-asset-6210df.s3.amazonaws.com *.rel.tunnels.api.visualstudio.com wss://*.rel.tunnels.api.visualstudio.com github.githubassets.com objects-origin.githubusercontent.com copilot-proxy.githubusercontent.com proxy.individual.githubcopilot.com proxy.business.githubcopilot.com proxy.enterprise.githubcopilot.com *.actions.githubusercontent.com wss://*.actions.githubusercontent.com productionresultssa0.blob.core.windows.net/ productionresultssa1.blob.core.windows.net/ productionresultssa2.blob.core.windows.net/ productionresultssa3.blob.core.windows.net/ productionresultssa4.blob.core.windows.net/ productionresultssa5.blob.core.windows.net/ productionresultssa6.blob.core.windows.net/ productionresultssa7.blob.core.windows.net/ productionresultssa8.blob.core.windows.net/ productionresultssa9.blob.core.windows.net/ productionresultssa10.blob.core.windows.net/ productionresultssa11.blob.core.windows.net/ productionresultssa12.blob.core.windows.net/ productionresultssa13.blob.core.windows.net/ productionresultssa14.blob.core.windows.net/ productionresultssa15.blob.core.windows.net/ productionresultssa16.blob.core.windows.net/ productionresultssa17.blob.core.windows.net/ productionresultssa18.blob.core.windows.net/ productionresultssa19.blob.core.windows.net/ github-production-repository-image-32fea6.s3.amazonaws.com github-production-release-asset-2e65be.s3.amazonaws.com insights.github.com wss://alive.github.com wss://alive-staging.github.com api.githubcopilot.com api.individual.githubcopilot.com api.business.githubcopilot.com api.enterprise.githubcopilot.com; font-src github.githubassets.com; form-action 'self' github.com gist.github.com copilot-workspace.githubnext.com objects-origin.githubusercontent.com; frame-ancestors 'none'; frame-src viewscreen.githubusercontent.com notebooks.githubusercontent.com; img-src 'self' data: blob: github.githubassets.com media.githubusercontent.com camo.githubusercontent.com identicons.github.com avatars.githubusercontent.com private-avatars.githubusercontent.com github-cloud.s3.amazonaws.com objects.githubusercontent.com release-assets.githubusercontent.com secured-user-images.githubusercontent.com/ user-images.githubusercontent.com/ private-user-images.githubusercontent.com opengraph.githubassets.com marketplace-screenshots.githubusercontent.com/ copilotprodattachments.blob.core.windows.net/github-production-copilot-attachments/ github-production-user-asset-6210df.s3.amazonaws.com customer-stories-feed.github.com spotlights-feed.github.com objects-origin.githubusercontent.com *.githubusercontent.com; manifest-src 'self'; media-src github.com user-images.githubusercontent.com/ secured-user-images.githubusercontent.com/ private-user-images.githubusercontent.com github-production-user-asset-6210df.s3.amazonaws.com gist.github.com; script-src github.githubassets.com; style-src 'unsafe-inline' github.githubassets.com; upgrade-insecure-requests; worker-src github.githubassets.com github.com/assets-cdn/worker/ github.com/assets/ gist.github.com/assets-cdn/worker/
server: github.com
content-encoding: gzip
accept-ranges: bytes
set-cookie: _gh_sess=P4nvCMUeg37PmEqpnVajZqW8cVrXDnikShp4T33vOYVD0xfr8RmH4TlqSK2kj211FpBw8aFEbAH%2FeGKAhFg64F9iE%2BGKO1LEb9Pc7aC2T0zB8BDaqbjzrOZ9unZx4xtnKRqCjDJfeusme8MCJ%2FatMa5YCvePLs0mKWmD7Q5XnYUmWv%2Bw4cGvz%2BEXir%2FuejJvF09rBv7isbazYes2jN7zqoLamnkKCuZ0tuUCUZaFv48BZ9zh1hEaREjS5vCFLJcW3Q%2F5Se3KkOnX1Z%2BjYenVLA%3D%3D--CCV23xlWgHILJ2GK--t%2BFpVX7ymaVYxRtBMFd0oA%3D%3D; Path=/; HttpOnly; Secure; SameSite=Lax
set-cookie: _octo=GH1.1.722512091.1760182129; Path=/; Domain=github.com; Expires=Sun, 11 Oct 2026 11:28:49 GMT; Secure; SameSite=Lax
set-cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sun, 11 Oct 2026 11:28:49 GMT; HttpOnly; Secure; SameSite=Lax
x-github-request-id: B992:8729A:4189B6:53523C:68EA3F71
DNS-01 challenge hook script of uacme for Cloudflare · GitHub
Show Gist options
Save Gowee/e756f925cfcbd5ab32d564ee3c795786 to your computer and use it in GitHub Desktop.
{{ message }}
Instantly share code, notes, and snippets.
Last active
April 23, 2025 11:21
-
Star
7
(7)
You must be signed in to star a gist -
Fork
3
(3)
You must be signed in to fork a gist
-
Save Gowee/e756f925cfcbd5ab32d564ee3c795786 to your computer and use it in GitHub Desktop.
DNS-01 challenge hook script of uacme for Cloudflare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Copyright (C) 2020 Michel Stam <michel@reverze.net> | |
# Copyright (C) 2021 Hung-I Wang <whygowe@gmail.com> | |
# | |
# The script is adatped from: | |
# https://github.com/ndilieto/uacme/blob/5edec0eea1bcf6f454ec1787297c2408c2f2e97a/nsupdate.sh | |
# | |
# Licensed under the the GNU General Public License <https://www.gnu.org/licenses/>. | |
# The script is meant to be used as a hook script of uacme to update TXT records for acme challenges. | |
# Instead of relying on IETF RFC2136, it talks to cfapi-ddns-worker.js which is a wrapper around Cloudflare API: | |
# https://gist.github.com/Gowee/8c3e65b80767b915e0199908e5d7a916 | |
# API Config | |
API_ENDPOINT="https://foo.bar.workers.dev/" | |
API_TOKEN="TOKEN_FOR_THE_DOMAIN_SPECIFIED_IN_THE_WORKER_SCRIPT" | |
# Arguments | |
METHOD=$1 | |
TYPE=$2 | |
IDENT=$3 | |
TOKEN=$4 | |
AUTH=$5 | |
ns_ispresent() | |
{ | |
local fqhn="$1" | |
local expect="$2" | |
local resp | |
resp=$(curl -fsSH "accept: application/dns-json" "https://cloudflare-dns.com/dns-query?name=${fqhn}&type=TXT") | |
if echo "$resp" | grep -q "$expect"; then | |
return 0 | |
else | |
return 1 | |
fi | |
} | |
ns_doupdate() | |
{ | |
local fqhn="$1" | |
local challenge="$2" | |
if [ -n "${challenge}" ]; then | |
curl -fsS "${API_ENDPOINT}upsert/${API_TOKEN}/${fqhn}/TXT/${challenge}" | |
# TODO: --fail-with-body | |
else | |
curl -fsS "${API_ENDPOINT}delete/${API_TOKEN}/${fqhn}/TXT/${challenge}" | |
# TODO: --fail-with-body | |
fi | |
return $? | |
} | |
ns_update() | |
{ | |
local fqhn="$1" | |
local challenge="$2" | |
local count=0 | |
local res | |
res=1 | |
while [ $res -ne 0 ]; do | |
if [ $count -eq 0 ]; then | |
ns_doupdate "$fqhn" "$challenge" | |
res=$? | |
[ $res -eq 0 ] || break | |
else | |
sleep 1 | |
fi | |
count=$(((count + 1) % 5)) | |
ns_ispresent "$fqhn" "$challenge" | |
res=$? | |
done | |
return $res | |
} | |
ARGS=5 | |
E_BADARGS=85 | |
if [ $# -ne "$ARGS" ]; then | |
echo "Usage: $(basename "$0") method type ident token auth" 1>&2 | |
exit $E_BADARGS | |
fi | |
case "$METHOD" in | |
"begin") | |
case "$TYPE" in | |
dns-01) | |
ns_update "_acme-challenge.$IDENT" "$AUTH" | |
exit $? | |
;; | |
*) | |
exit 1 | |
;; | |
esac | |
;; | |
"done"|"failed") | |
case "$TYPE" in | |
dns-01) | |
ns_update "_acme-challenge.$IDENT" | |
exit $? | |
;; | |
*) | |
exit 1 | |
;; | |
esac | |
;; | |
*) | |
echo "$0: invalid method" 1>&2 | |
exit 1 | |
esac |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You can’t perform that action at this time.