mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-05-07 01:07:05 +02:00
Cloudflare DNS: allow AAAA proxying + harden addDeleteDNSRecordsCloudFlare
- dnsManager.py: include AAAA in record types that get proxied flag on update (was only A, CNAME); fix HTTP 500 by hardening loadCFKeys and addDeleteDNSRecordsCloudFlare (safe file read, always pass domainsList/cfEmail/cfToken to template). - dnsUtilities.py: A, AAAA and CNAME can be proxied in Cloudflare; set proxied only for those types; MX, TXT, etc. cannot be proxied.
This commit is contained in:
@@ -716,14 +716,14 @@ class DNS:
|
||||
value = value.replace('\n\t', '')
|
||||
value = value.replace('"', '')
|
||||
|
||||
# Only A and CNAME records can be proxied in CloudFlare
|
||||
# Determine if proxy should be enabled (default: True for A/CNAME, except for mail domains)
|
||||
if proxied is None and type in ['A', 'CNAME']:
|
||||
# A, AAAA and CNAME records can be proxied in CloudFlare.
|
||||
# Determine if proxy should be enabled (default: True, except for mail domains).
|
||||
if proxied is None and type in ['A', 'AAAA', 'CNAME']:
|
||||
# Check if this is a mail domain (starts with 'mail.' or contains 'mail.')
|
||||
is_mail_domain = name.lower().startswith('mail.') or '.mail.' in name.lower()
|
||||
proxied = not is_mail_domain
|
||||
elif type not in ['A', 'CNAME']:
|
||||
# AAAA, MX, TXT, etc. cannot be proxied
|
||||
elif type not in ['A', 'AAAA', 'CNAME']:
|
||||
# MX, TXT, etc. cannot be proxied
|
||||
proxied = False
|
||||
|
||||
if ttl > 0:
|
||||
@@ -731,8 +731,8 @@ class DNS:
|
||||
else:
|
||||
dns_record = {'name': name, 'type': type, 'content': value, 'priority': priority}
|
||||
|
||||
# Only add proxied parameter for A and CNAME records
|
||||
if type in ['A', 'CNAME']:
|
||||
# Only add proxied parameter for A, AAAA and CNAME records
|
||||
if type in ['A', 'AAAA', 'CNAME']:
|
||||
dns_record['proxied'] = proxied
|
||||
|
||||
cf.zones.dns_records.post(zone, data=dns_record)
|
||||
|
||||
Reference in New Issue
Block a user