mirror of
https://github.com/netbirdio/plugins.git
synced 2026-05-22 18:44:07 -07:00
dns/unbound-plus: add whitelisting (#1506)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
PLUGIN_NAME= unbound-plus
|
||||
PLUGIN_VERSION= 0.1
|
||||
PLUGIN_VERSION= 0.2
|
||||
PLUGIN_COMMENT= Unbound additions
|
||||
PLUGIN_MAINTAINER= m.muenz@gmail.com
|
||||
PLUGIN_DEVEL= yes
|
||||
|
||||
+1
@@ -44,6 +44,7 @@ class ServiceController extends ApiMutableServiceControllerBase
|
||||
$this->sessionClose();
|
||||
$mdl = new Dnsbl();
|
||||
$backend = new Backend();
|
||||
$backend->configdRun('template reload OPNsense/Unboundplus');
|
||||
$response = $backend->configdpRun('unboundplus dnsbl', array((string)$mdl->type));
|
||||
return array("response" => $response);
|
||||
}
|
||||
|
||||
@@ -11,4 +11,12 @@
|
||||
<type>select_multiple</type>
|
||||
<help>Select which kind of DNSBL you want to use.</help>
|
||||
</field>
|
||||
<field>
|
||||
<id>dnsbl.whitelists</id>
|
||||
<label>Whitelist Domains</label>
|
||||
<type>select_multiple</type>
|
||||
<style>tokenize</style>
|
||||
<allownew>true</allownew>
|
||||
<help>List of domains to whitelist.</help>
|
||||
</field>
|
||||
</form>
|
||||
|
||||
@@ -37,5 +37,8 @@
|
||||
<yy>YoYo List</yy>
|
||||
</OptionValues>
|
||||
</type>
|
||||
<whitelists type="CSVListField">
|
||||
<Required>N</Required>
|
||||
</whitelists>
|
||||
</items>
|
||||
</model>
|
||||
|
||||
@@ -213,7 +213,12 @@ simpletrack() {
|
||||
install() {
|
||||
# Put all files in correct format
|
||||
for FILE in $(find ${WORKDIR} -type f); do
|
||||
cat ${FILE} | sort -u | awk '{printf "server:\n", $1; printf "local-data: \"%s A 0.0.0.0\"\n", $1}' > ${FILE}.inc
|
||||
WHITE=$(cat ${DESTDIR}/whitelist.inc | tr ',' '|')
|
||||
if [ -z "${WHITE}" ]; then
|
||||
cat ${FILE} | sort -u | awk '{printf "server:\n", $1; printf "local-data: \"%s A 0.0.0.0\"\n", $1}' > ${FILE}.inc
|
||||
else
|
||||
cat ${FILE} | sort -u | egrep -v "$WHITE" | awk '{printf "server:\n", $1; printf "local-data: \"%s A 0.0.0.0\"\n", $1}' > ${FILE}.inc
|
||||
fi
|
||||
done
|
||||
# Merge resulting files (/dev/null in case there are none)
|
||||
cat $(find ${WORKDIR} -type f -name "*.inc") /dev/null > ${DESTDIR}/dnsbl.conf
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
dnsbl.inc:/var/unbound/etc/dnsbl.inc
|
||||
whitelist.inc:/var/unbound/etc/whitelist.inc
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{% if helpers.exists('OPNsense.unbound.dnsbl.enabled') and OPNsense.unbound.dnsbl.enabled == '1' %}
|
||||
{% if helpers.exists('OPNsense.unbound.dnsbl.type') and OPNsense.unbound.dnsbl.type != '' %}
|
||||
unbound_dnsbl="{{ OPNsense.unbound.dnsbl.type }}"
|
||||
{% if helpers.exists('OPNsense.unboundplus.dnsbl.enabled') and OPNsense.unboundplus.dnsbl.enabled == '1' %}
|
||||
{% if helpers.exists('OPNsense.unboundplus.dnsbl.type') and OPNsense.unboundplus.dnsbl.type != '' %}
|
||||
unbound_dnsbl="{{ OPNsense.unboundplus.dnsbl.type }}"
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{% if helpers.exists('OPNsense.unboundplus.dnsbl.enabled') and OPNsense.unboundplus.dnsbl.enabled == '1' %}
|
||||
{% if helpers.exists('OPNsense.unboundplus.dnsbl.type') and OPNsense.unboundplus.dnsbl.type != '' %}
|
||||
{% if helpers.exists('OPNsense.unboundplus.dnsbl.whitelists') and OPNsense.unboundplus.dnsbl.whitelists != '' %}
|
||||
{{ OPNsense.unboundplus.dnsbl.whitelists|default("") }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
Reference in New Issue
Block a user