dns/unbound-plus: post-merge cleanups, review notes

This commit is contained in:
Franco Fichtner
2020-02-10 17:19:34 +01:00
parent 8633f8ef71
commit 90a6ed9cbd
6 changed files with 15 additions and 21 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
PLUGIN_NAME= unbound-plus
PLUGIN_VERSION= 0.3
PLUGIN_VERSION= 0.4
PLUGIN_COMMENT= Unbound additions
PLUGIN_MAINTAINER= m.muenz@gmail.com
PLUGIN_DEVEL= yes
@@ -25,6 +25,6 @@
<type>select_multiple</type>
<style>tokenize</style>
<allownew>true</allownew>
<help>List of domains to whitelist. You can use regex expressions.</help>
<help>List of domains to whitelist. You can use regular expressions.</help>
</field>
</form>
@@ -81,8 +81,8 @@ def parse_line(line):
def process_url(url):
""" Reads and parses blacklisted domains from URL into BL set. """
print(f"Processing BL items from: {url}")
print(f"Processing BL items from: {url}")
try:
http = urllib3.PoolManager()
r = http.request('GET', url)
@@ -111,10 +111,10 @@ def save_config_file():
exit(1)
def load_list(path, separator=None):
""" Reads file with specified path into set to ensure unique values.
""" Reads file with specified path into set to ensure unique values.
Splits lines with defined separator. If sperator==None no split is performed. """
result = set()
try:
with open(path, 'r') as file:
for line in file.readlines():
@@ -162,7 +162,7 @@ def load_predefined_lists():
for type in first:
types.add(type)
break
print(f"Loaded {len(types)} predefined blacklists URLs")
for type in types:
@@ -185,9 +185,9 @@ if __name__ == "__main__":
t.start()
for t in threads:
t.join()
save_config_file()
print("Restarting unbound service")
subprocess.Popen(["pluginctl", "-s", "unbound", "restart"])
exit(0)
exit(0)
@@ -2,11 +2,5 @@
command:/usr/local/opnsense/scripts/OPNsense/Unboundplus/dnsbl.py
parameters:
type:script
message:fetching DNSBLs
[dnsblcron]
command:/usr/local/opnsense/scripts/OPNsense/Unboundplus/dnsbl.py
parameters:
type:script
message:fetching DNSBLs and restart Unbound
message:fetching and applying DNSBLs
description: Download Unbound DNSBLs and restart
@@ -1,4 +1,4 @@
dnsbl.inc:/var/unbound/etc/dnsbl.inc
whitelist.inc:/var/unbound/etc/whitelist.inc
miscellaneous.conf:/var/unbound/etc/miscellaneous.conf
lists.inc:/var/unbound/etc/lists.inc
lists.inc:/var/unbound/etc/lists.inc
@@ -1,5 +1,5 @@
{% if helpers.exists('OPNsense.unboundplus.dnsbl.enabled') and OPNsense.unboundplus.dnsbl.enabled == '1' %}
{% if helpers.exists('OPNsense.unboundplus.dnsbl.whitelists') and OPNsense.unboundplus.dnsbl.whitelists != '' %}
{% if helpers.exists('OPNsense.unboundplus.dnsbl.enabled') and OPNsense.unboundplus.dnsbl.enabled == '1' %}
{% if helpers.exists('OPNsense.unboundplus.dnsbl.whitelists') and OPNsense.unboundplus.dnsbl.whitelists != '' %}
{{ OPNsense.unboundplus.dnsbl.whitelists|default("") }}
{% endif %}
{% endif %}
{% endif %}
{% endif %}