From d72fc21e72d24ecea223f1b66fc1a6830f5207d5 Mon Sep 17 00:00:00 2001 From: Bernard Spil Date: Sun, 19 May 2019 20:30:51 +0200 Subject: [PATCH] Make Cloudflare URLs configurable Use-case is being able to proxy these requests over an internal host. Allowing access to 1.1.1.1 from the DC-LAN wouldn't work for us. Example config for Apache ``` ProxyPass /dns-query https://cloudflare-dns.com/dns-query ProxyPass /api/v1/purge https://one.one.one.one/api/v1/purge ``` Building a service that sits in our DMZ where internal hosts request creation/deletion of _acme-challenge TXT RRs using an API. This same host can be used to proxy the Cloudflare purge and query requests. --- acme.sh | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/acme.sh b/acme.sh index 60580f83..cc19f2d4 100755 --- a/acme.sh +++ b/acme.sh @@ -3604,7 +3604,11 @@ _ns_lookup() { _ns_lookup_cf() { _cf_ld="$1" _cf_ld_type="$2" - _cf_ep="https://cloudflare-dns.com/dns-query" + if [ "$CLOUDFLARE_DNSQUERY_URL" != "" ]; then + _cf_ep="$CLOUDFLARE_DNS_URL" + else + _cf_ep="https://cloudflare-dns.com/dns-query" + fi _ns_lookup "$_cf_ep" "$_cf_ld" "$_cf_ld_type" } @@ -3613,7 +3617,11 @@ _ns_purge_cf() { _cf_d="$1" _cf_d_type="$2" _debug "Cloudflare purge $_cf_d_type record for domain $_cf_d" - _cf_purl="https://1.1.1.1/api/v1/purge?domain=$_cf_d&type=$_cf_d_type" + if [ "$CLOUDFLARE_DOHJSON_URL" != "" ]; then + _cf_purl="$ONE_ONE_ONE_ONE_URL?domain=$_cf_d&type=$_cf_d_type" + else + _cf_purl="https://1.1.1.1/api/v1/purge?domain=$_cf_d&type=$_cf_d_type" + fi response="$(_post "" "$_cf_purl")" _debug2 response "$response" }