From 17b605be7d1cb207e49aa4c2fb4733b248fad2c7 Mon Sep 17 00:00:00 2001 From: Q-Feeds Date: Wed, 15 Oct 2025 17:39:05 +0200 Subject: [PATCH] Fix/qfeeds unbound blocklist priority conflict (#4979) * Fix Q-Feeds unbound blocklist handler priority conflict - Change priority from 100 to 50 to avoid conflicts with predefined handlers - Add conditional logic to respect enable_unbound_bl setting - Return empty blocklist when integration is disabled * Update qfeeds_bl.py --- .../scripts/unbound/blocklists/qfeeds_bl.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/security/q-feeds-connector/src/opnsense/scripts/unbound/blocklists/qfeeds_bl.py b/security/q-feeds-connector/src/opnsense/scripts/unbound/blocklists/qfeeds_bl.py index ff3413a85..555e3d7ca 100755 --- a/security/q-feeds-connector/src/opnsense/scripts/unbound/blocklists/qfeeds_bl.py +++ b/security/q-feeds-connector/src/opnsense/scripts/unbound/blocklists/qfeeds_bl.py @@ -32,7 +32,7 @@ from . import BaseBlocklistHandler class DefaultBlocklistHandler(BaseBlocklistHandler): def __init__(self): super().__init__('/usr/local/etc/unbound/qfeeds-blocklists.conf') - self.priority = 100 + self.priority = 50 def get_config(self): cfg = {'qfeeds_filenames': []} @@ -42,6 +42,10 @@ class DefaultBlocklistHandler(BaseBlocklistHandler): return cfg def get_blocklist(self): + # Only return domains if integration is enabled + if not self._is_enabled(): + return {} # Return empty blocklist when disabled + result = {} for filename in self.get_config()['qfeeds_filenames']: bl_shortcode = "qf_%s" % os.path.splitext(os.path.basename(filename).strip())[0] @@ -53,3 +57,14 @@ class DefaultBlocklistHandler(BaseBlocklistHandler): def get_passlist_patterns(self): return [] + + def _is_enabled(self): + # Check if unbound blocklist integration is enabled + try: + import subprocess + result = subprocess.run(['/usr/local/sbin/configctl', 'config', 'get', + 'OPNsense.QFeedsConnector.general.enable_unbound_bl'], + capture_output=True, text=True) + return result.stdout.strip() == '1' + except: + return False