mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user