import os import ssl # --- PATHS --- BIND_PATH = "/etc/bind/" CACHE_PATH = "/var/cache/bind/" LOCAL_CONF = os.path.join(BIND_PATH, "named.conf.local") OPTIONS_FILE = os.path.join(BIND_PATH, "named.conf.options") PANEL_SETTINGS = os.path.join(BIND_PATH, "panel_settings.json") USERS_FILE = os.path.join(BIND_PATH, "users.json") STATS_FILE = os.path.join(BIND_PATH, "panel_stats.json") AUDIT_FILE = os.path.join(BIND_PATH, "audit_log.json") BACKUP_DIR = os.path.join(BIND_PATH, "zone_backups") BIND_SERVICE = "bind9" QUERY_LOG_PATH = "/var/log/named/queries.log" ADBLOCK_DB_PATH = os.path.join(BIND_PATH, "db.rpz.blacklist") ADBLOCK_LISTS_FILE = os.path.join(BIND_PATH, "adblock_lists.json") ADBLOCK_CUSTOM_RULES_FILE = os.path.join(BIND_PATH, "adblock_custom_rules.json") # Create Backup Directory if it doesn't exist os.makedirs(BACKUP_DIR, exist_ok=True) # --- SSL CONTEXT (For internal Cluster API calls) --- ssl_ctx = ssl.create_default_context() ssl_ctx.check_hostname = False ssl_ctx.verify_mode = ssl.CERT_NONE # --- DEFAULT ADBLOCK LISTS --- DEFAULT_ADBLOCK_LISTS = [ {"id": "1hosts_lite", "name": "1Hosts (Lite)", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_24.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://badmojr.github.io/1Hosts/"}, {"id": "1hosts_xtra", "name": "1Hosts (Xtra)", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_70.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://badmojr.github.io/1Hosts/"}, {"id": "adguard_dns_filter", "name": "AdGuard DNS filter", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_1.txt", "enabled": True, "category": "General", "is_custom": False, "info": "https://github.com/AdguardTeam/AdGuardSDNSFilter"}, {"id": "adguard_popup_filter", "name": "AdGuard DNS Popup Hosts filter", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_59.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://github.com/AdguardTeam/AdGuardSDNSFilter"}, {"id": "awavenue_ads_rule", "name": "AWAvenue Ads Rule", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_53.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://awavenue.top/"}, {"id": "dan_pollocks_list", "name": "Dan Pollock's List", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_4.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://someonewhocares.org/"}, {"id": "hagezi_multinormal", "name": "HaGeZi's Normal Blocklist", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_34.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_pro", "name": "HaGeZi's Pro Blocklist", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_48.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_pro_plus", "name": "HaGeZi's Pro++ Blocklist", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_51.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_ultimate", "name": "HaGeZi's Ultimate Blocklist", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_49.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "oisd_basic", "name": "OISD Blocklist Small", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_5.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://oisd.nl/"}, {"id": "oisd_full", "name": "OISD Blocklist Big", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_27.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://oisd.nl/"}, {"id": "peter_lowe_list", "name": "Peter Lowe's Blocklist", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_3.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://pgl.yoyo.org/adservers/"}, {"id": "shadowwhisperer_tracking_list", "name": "ShadowWhisperer Tracking List", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_69.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://github.com/ShadowWhisperer/BlockLists"}, {"id": "steven_blacks_list", "name": "Steven Black's List", "desc": "Lists that block tracking and advertising on most of the devices", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_33.txt", "enabled": False, "category": "General", "is_custom": False, "info": "https://github.com/StevenBlack/hosts"}, {"id": "dandelion_sprouts_anti_push", "name": "Dandelion Sprout's Anti Push Notifications", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_39.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/DandelionSprout/adfilt"}, {"id": "dandelion_sprouts_game_console", "name": "Dandelion Sprout's Game Console Adblock List", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_6.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/DandelionSprout/adfilt"}, {"id": "hagezi_allowlist_referral", "name": "HaGeZi's Allowlist Referral", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_45.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists#referral"}, {"id": "hagezi_antipiracy", "name": "HaGeZi's Anti-Piracy Blocklist", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_46.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists#piracy"}, {"id": "hagezi_apple_tracker", "name": "HaGeZi's Apple Tracker Blocklist", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_67.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_gambling", "name": "HaGeZi's Gambling Blocklist", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_47.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists#gambling"}, {"id": "hagezi_oppo_realme", "name": "HaGeZi's OPPO & Realme Tracker Blocklist", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_66.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_samsung_tracker", "name": "HaGeZi's Samsung Tracker Blocklist", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_61.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_vivo_tracker", "name": "HaGeZi's Vivo Tracker Blocklist", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_65.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_windows_office", "name": "HaGeZi's Windows/Office Tracker Blocklist", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_63.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_xiaomi_tracking", "name": "HaGeZi's Xiaomi Tracker Blocklist", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_60.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "no_google", "name": "No Google", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_37.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/nickspaargaren/no-google"}, {"id": "perflyst_smart_tv", "name": "Perflyst and Dandelion Sprout's Smart-TV Blocklist", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_7.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/Perflyst/PiHoleBlocklist"}, {"id": "shadowwhisperers_dating", "name": "ShadowWhisperer's Dating List", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_57.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/ShadowWhisperer/BlockLists"}, {"id": "ukrainian_security", "name": "Ukrainian Security Filter", "desc": "Other blocklists", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_62.txt", "enabled": False, "category": "Other", "is_custom": False, "info": "https://github.com/braveinnovators/ukrainian-security-filter"}, {"id": "chn_adrules", "name": "CHN: AdRules DNS List", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_29.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/Cats-Team/AdRules"}, {"id": "chn_anti_ad", "name": "CHN: anti-AD", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_21.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://anti-ad.net/"}, {"id": "hun_hufilter", "name": "HUN: Hufilter", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_35.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/hufilter/hufilter"}, {"id": "idn_abpindo", "name": "IDN: ABPindo", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_22.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/ABPindo/indonesianadblockrules"}, {"id": "irn_persianblocker", "name": "IRN: PersianBlocker list", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_19.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/MasterKia/PersianBlocker"}, {"id": "isr_easylist_hebrew", "name": "ISR: EasyList Hebrew", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_43.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/easylist/EasyListHebrew"}, {"id": "kor_list_kr", "name": "KOR: List-KR DNS", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_25.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/List-KR/List-KR"}, {"id": "kor_youslist", "name": "KOR: YousList", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_15.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/yous/YousList"}, {"id": "lit_easylist_lithuania", "name": "LIT: EasyList Lithuania", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_36.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/EasyList-Lithuania/easylist_lithuania"}, {"id": "mkd_macedonian_pi_hole", "name": "MKD: Macedonian Pi-hole Blocklist", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_20.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/cchevy/macedonian-pi-hole-blocklist"}, {"id": "nor_dandelion_sprouts", "name": "NOR: Dandelion Sprouts nordiske filtre", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_13.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/DandelionSprout/adfilt"}, {"id": "pol_cert_polska", "name": "POL: CERT Polska List of malicious domains", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_41.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://cert.pl/posts/2020/03/ostrzezenia_phishing/"}, {"id": "pol_polish_filters", "name": "POL: Polish filters for Pi-hole", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_14.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://www.certyficate.it/"}, {"id": "swe_frellwit_swedish", "name": "SWE: Frellwit's Swedish Hosts File", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_17.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/lassekongo83/Frellwits-filter-lists/"}, {"id": "tur_turk_adlist", "name": "TUR: turk-adlist", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_26.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/bkrucarci/turk-adlist"}, {"id": "tur_turkish_ad_hosts", "name": "TUR: Turkish Ad Hosts", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_40.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "https://github.com/symbuzzer/Turkish-Ad-Hosts"}, {"id": "vnm_abpvn", "name": "VNM: ABPVN List", "desc": "Lists that focus on regional ads and tracking servers", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_16.txt", "enabled": False, "category": "Regional", "is_custom": False, "info": "http://abpvn.com/"}, {"id": "curben_phishing_filter", "name": "Phishing URL Blocklist", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_30.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://gitlab.com/malware-filter/phishing-filter"}, {"id": "dandelion_sprouts_anti_malware_list", "name": "Dandelion Sprout's Anti-Malware List", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_12.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/DandelionSprout/adfilt"}, {"id": "hagezi_badware_hoster_blocklist", "name": "HaGeZi's Badware Hoster Blocklist", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_55.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_dns_rebind_protection", "name": "HaGeZi's DNS Rebind Protection", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_71.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_dyndns_blocklist", "name": "HaGeZi's DynDNS Blocklist", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_54.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_encrypted_dns_vpn_tor_proxy_bypass", "name": "HaGeZi's Encrypted DNS/VPN/TOR Bypass", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_52.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists#bypass"}, {"id": "hagezi_the_worlds_most_abused_tlds", "name": "HaGeZi's The World's Most Abused TLDs", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_56.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_threat_intelligence_feeds", "name": "HaGeZi's Threat Intelligence Feeds", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_44.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "hagezi_url_shortener_blocklist", "name": "HaGeZi's URL Shortener Blocklist", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_68.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/hagezi/dns-blocklists"}, {"id": "nocoin_filter_list", "name": "NoCoin Filter List", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_8.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/hoshsadiq/adblock-nocoin-list/"}, {"id": "phishing_army", "name": "Phishing Army", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_18.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://phishing.army/"}, {"id": "scam_blocklist_by_durablenapkin", "name": "Scam Blocklist by DurableNapkin", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_10.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/durablenapkin/scamblocklist"}, {"id": "shadowwhisperers_malware_list", "name": "ShadowWhisperer's Malware List", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_42.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/ShadowWhisperer/BlockLists"}, {"id": "staklerware_indicators_list", "name": "Stalkerware Indicators List", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_31.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/AssoEchap/stalkerware-indicators"}, {"id": "the_big_list_of_hacked_malware_web_sites", "name": "The Big List of Hacked Malware Web Sites", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_9.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/mitchellkrogza/The-Big-List-of-Hacked-Malware-Web-Sites"}, {"id": "ublock_badware_risks", "name": "uBlock₀ filters – Badware risks", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_50.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://github.com/uBlockOrigin/uAssets"}, {"id": "urlhaus_filter_online", "name": "Malicious URL Blocklist (URLHaus)", "desc": "Lists designed specifically to block malicious, phishing, and scam domains", "url": "https://adguardteam.github.io/HostlistsRegistry/assets/filter_11.txt", "enabled": False, "category": "Security", "is_custom": False, "info": "https://urlhaus.abuse.ch/"} ]