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.
This commit is contained in:
Bernard Spil 2019-05-19 20:30:51 +02:00 committed by GitHub
parent 5f9378569b
commit d72fc21e72
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -3604,7 +3604,11 @@ _ns_lookup() {
_ns_lookup_cf() { _ns_lookup_cf() {
_cf_ld="$1" _cf_ld="$1"
_cf_ld_type="$2" _cf_ld_type="$2"
if [ "$CLOUDFLARE_DNSQUERY_URL" != "" ]; then
_cf_ep="$CLOUDFLARE_DNS_URL"
else
_cf_ep="https://cloudflare-dns.com/dns-query" _cf_ep="https://cloudflare-dns.com/dns-query"
fi
_ns_lookup "$_cf_ep" "$_cf_ld" "$_cf_ld_type" _ns_lookup "$_cf_ep" "$_cf_ld" "$_cf_ld_type"
} }
@ -3613,7 +3617,11 @@ _ns_purge_cf() {
_cf_d="$1" _cf_d="$1"
_cf_d_type="$2" _cf_d_type="$2"
_debug "Cloudflare purge $_cf_d_type record for domain $_cf_d" _debug "Cloudflare purge $_cf_d_type record for domain $_cf_d"
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" _cf_purl="https://1.1.1.1/api/v1/purge?domain=$_cf_d&type=$_cf_d_type"
fi
response="$(_post "" "$_cf_purl")" response="$(_post "" "$_cf_purl")"
_debug2 response "$response" _debug2 response "$response"
} }