freeviruzdotorg
freeviruzdotorg
CDCloudflare Developers
Created by freeviruzdotorg on 11/7/2024 in #general-help
Custom SOA Records and permission for Cloudflare API for DDNS (ddclient or CF API prefer) with BIND9
Gotcha, much appreciated! I'll look tomorrow, I've dealt with ES, logstash and LLM databases enough today lol, I'll take a look tomorrow. Fyi - as someone who tried configuring cuckoo sandbox for 9 months and failing, it's okay lol. I'm sure I'll figure it out with /var/logs if possible or my logs in elastic search (Waiting for my domain to move from square space to CF at the moment)
14 replies
CDCloudflare Developers
Created by freeviruzdotorg on 11/7/2024 in #general-help
Custom SOA Records and permission for Cloudflare API for DDNS (ddclient or CF API prefer) with BIND9
(it's pretty damn obv I have no clue what I'm doing to be frank)
14 replies
CDCloudflare Developers
Created by freeviruzdotorg on 11/7/2024 in #general-help
Custom SOA Records and permission for Cloudflare API for DDNS (ddclient or CF API prefer) with BIND9
Got any actual useful docs by any chance?
14 replies
CDCloudflare Developers
Created by freeviruzdotorg on 11/7/2024 in #general-help
Custom SOA Records and permission for Cloudflare API for DDNS (ddclient or CF API prefer) with BIND9
Figures... This is why I don't like using AI lol
14 replies
CDCloudflare Developers
Created by freeviruzdotorg on 11/7/2024 in #general-help
Custom SOA Records and permission for Cloudflare API for DDNS (ddclient or CF API prefer) with BIND9
Sorry still new and I tried to read docs of the API prior to asking (cron will be used to schedule automation)
14 replies
CDCloudflare Developers
Created by freeviruzdotorg on 11/7/2024 in #general-help
Custom SOA Records and permission for Cloudflare API for DDNS (ddclient or CF API prefer) with BIND9
Essentially update my public IP address from my local DNS server to CF Also being able to automate and update/add records to CF from the DNS server using Ubuntu and DD client (BIND9 as DNS service)
14 replies
CDCloudflare Developers
Created by freeviruzdotorg on 11/7/2024 in #general-help
Custom SOA Records and permission for Cloudflare API for DDNS (ddclient or CF API prefer) with BIND9
Using CF Docs from custom SOA error, its from this script:
curl --request PATCH \
--url https://api.cloudflare.com/client/v4/zones/ZONE_ID_FROM_CF_DASHBOARD/dns_settings \
--header 'Content-Type: application/json' \
--header 'X-Auth-Email: [email protected]' \
--header 'X-Auth-Key: GLOBAL_API_KEY' \
--data '{
"flatten_all_cnames": false,
"foundation_dns": false,
"multi_provider": false,
"nameservers": {
"type": "cloudflare.standard",
"ns_set": 1
},
"ns_ttl": 86400,
"secondary_overrides": false,
"soa": {
"expire": 604800,
"min_ttl": 1800,
"mname": "primary.ns.cloudflare.com",
"refresh": 10000,
"retry": 2400,
"rname": "secondary.ns.cloudflare.com",
"ttl": 3600,
"serial": 2356498458
},
"zone_mode": "dns_only"
}'
curl --request PATCH \
--url https://api.cloudflare.com/client/v4/zones/ZONE_ID_FROM_CF_DASHBOARD/dns_settings \
--header 'Content-Type: application/json' \
--header 'X-Auth-Email: [email protected]' \
--header 'X-Auth-Key: GLOBAL_API_KEY' \
--data '{
"flatten_all_cnames": false,
"foundation_dns": false,
"multi_provider": false,
"nameservers": {
"type": "cloudflare.standard",
"ns_set": 1
},
"ns_ttl": 86400,
"secondary_overrides": false,
"soa": {
"expire": 604800,
"min_ttl": 1800,
"mname": "primary.ns.cloudflare.com",
"refresh": 10000,
"retry": 2400,
"rname": "secondary.ns.cloudflare.com",
"ttl": 3600,
"serial": 2356498458
},
"zone_mode": "dns_only"
}'
Error output is as stated: {"result":null,"success":false,"errors":[{"code":1003,"message":"Custom SOA records are not available to this account or zone. Contact support for more information."}],"messages":[]} (this was a copy/paste with mods ofc from the CF API docs i found)
14 replies
CDCloudflare Developers
Created by freeviruzdotorg on 11/7/2024 in #general-help
Custom SOA Records and permission for Cloudflare API for DDNS (ddclient or CF API prefer) with BIND9
The related script from the output displayed in post:
#!/bin/bash

# Cloudflare API Token and Zone Information
API_TOKEN="API_Token_for_zone_config"
ZONE_ID="ZONE_ID_FROM_CF_DASHBOARD_OVERVIEW"
RECORD_NAME="example.com"
EMAIL="[email protected]" # Optional if you're using global API key
DOMAIN="example.com"

# Get the current external IP address
CURRENT_IP=$(curl -s https://api.ipify.org)

# Get the Cloudflare DNS record ID for the subdomain
DNS_RECORD_ID=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records?name=$RECORD_NAME" \
-H "Authorization: Bearer $API_TOKEN" | jq -r '.result[0].id')

# Check if IP has changed
if [[ $(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$DNS_RECORD_ID" \
-H "Authorization: Bearer $API_TOKEN" | jq -r '.result.content') != "$CURRENT_IP" ]]; then
# Update the DNS record with the new IP address
# curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$DNS_RECORD_ID" \
# -H "Authorization: Bearer $API_TOKEN" \
# -H "Content-Type: application/json" \
# --data '{"type":"A","name":"'"$RECORD_NAME"'","content":"'"$CURRENT_IP"'","ttl":120,"proxied":false}'

curl -X PUT "https://api.cloudflare.com/client/v4/user/tokens/verify" \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type:application/json" \
--data '{
"type":"A",
"name":"'"$RECORD_NAME"'",
"content":"'"$CURRENT_IP"'",
"ttl":120,
"proxied":false}'

fi
#!/bin/bash

# Cloudflare API Token and Zone Information
API_TOKEN="API_Token_for_zone_config"
ZONE_ID="ZONE_ID_FROM_CF_DASHBOARD_OVERVIEW"
RECORD_NAME="example.com"
EMAIL="[email protected]" # Optional if you're using global API key
DOMAIN="example.com"

# Get the current external IP address
CURRENT_IP=$(curl -s https://api.ipify.org)

# Get the Cloudflare DNS record ID for the subdomain
DNS_RECORD_ID=$(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records?name=$RECORD_NAME" \
-H "Authorization: Bearer $API_TOKEN" | jq -r '.result[0].id')

# Check if IP has changed
if [[ $(curl -s -X GET "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$DNS_RECORD_ID" \
-H "Authorization: Bearer $API_TOKEN" | jq -r '.result.content') != "$CURRENT_IP" ]]; then
# Update the DNS record with the new IP address
# curl -s -X PUT "https://api.cloudflare.com/client/v4/zones/$ZONE_ID/dns_records/$DNS_RECORD_ID" \
# -H "Authorization: Bearer $API_TOKEN" \
# -H "Content-Type: application/json" \
# --data '{"type":"A","name":"'"$RECORD_NAME"'","content":"'"$CURRENT_IP"'","ttl":120,"proxied":false}'

curl -X PUT "https://api.cloudflare.com/client/v4/user/tokens/verify" \
-H "Authorization: Bearer $API_TOKEN" \
-H "Content-Type:application/json" \
--data '{
"type":"A",
"name":"'"$RECORD_NAME"'",
"content":"'"$CURRENT_IP"'",
"ttl":120,
"proxied":false}'

fi
Related error output from above script: {"success":false,"errors":[{"code":7001,"message":"Method PUT not available for that URI."}],"messages":[],"result":null} also received prior to modifications from OG post: {"success":false,"errors":[{"code":10000,"message":"PUT method not allowed for the api_token authentication scheme"}]} (commented out section was the portion of where the permission error code 10000 was presented in the script. wanted to keep in the event i missed something)
14 replies