OPNsense Forum

English Forums => Tutorials and FAQs => Topic started by: azfirefighter on July 12, 2019, 11:36:01 pm

Title: Blocking ads using only unbound
Post by: azfirefighter on July 12, 2019, 11:36:01 pm
I managed to get ad blocking done using only Unbound.  Our command line friends, curl and awk do the heavy lifting.

This post is a little messy right now, but I'll get it cleaned up a little later.

HOUSEKEEPING INFO:
You will need to be able to log into the machine using either the console or SSH to get this accomplished.

The list I'm using is Steven Black's "Unified+Gambling+Fake News".  You can choose from any of his other lists at https://github.com/StevenBlack/hosts/blob/master/readme.md (https://github.com/StevenBlack/hosts/blob/master/readme.md).  Rather than using one of the "Raw Hosts" URLS, choose one of the "Non Github Mirror" URLS.  Curl seems to have an issue with the "Raw Hosts" URLS.

GETTING STARTED:

If you've opted to use a different filter list, you'll have to change the address that curl is using in the following script.


#!/bin/sh
#
# First, let's get the list

curl http://sbc.io/hosts/alternates/fakenews-gambling/hosts -o blockhosts.txt

# Too bad it's got a lot of stuff at the beginning we don't need.
# Time to remove the cruft

awk 'NR>=35{ print }' blockhosts.txt > hosts-fixed.txt

# Time to make it usable for the unbound service

echo -n "server:" > block.conf # MUST HAVE THIS AT THE TOP OF THE FILE

cat hosts-fixed.txt | grep '^0\.0\.0\.0' | awk '{ print "local-zone: \""$2"\" redirect\nlocal-data: \""$2" A 0.0.0.0\"" }' >> block.conf

# Present it to unbound
chown unbound:unbound block.conf
mv block.conf /var/unbound/block.conf
unbound-control -c /var/unbound/unbound.conf reload




Here's where you add the block list to Unbound.


Provided everything was entered correctly, the list should now be applied.

Since the "Cron" opnsense page doesn't allow for custom actions, you'll have to head back to the command line.
I've opted to update the list every night at 23:00 local.

If you're still logged in, keep going.  Otherwise, log back into the command line and choose option #8.

Then:

Your system should now update the list, mangle it into a format that Unbound can use and reload the list every night at 2300 (local).

I'm working on making a command line install script to make the process a little easier for inexperienced people.  Please be patient.
Title: Re: Blocking ads using only unbound
Post by: bigeazy000 on August 01, 2019, 06:57:26 pm
This is great, thanks for sharing! I was waiting for UnboundBL to materialize, but this will work nicely instead..
Title: Re: Blocking ads using only unbound
Post by: andy on August 05, 2019, 03:17:42 am
I'll be keeping an eye on this--would love to get a blacklist feature working
Title: Re: Blocking ads using only unbound
Post by: Serius on September 07, 2019, 04:35:07 pm
Thanks!
Title: Re: Blocking ads using only unbound
Post by: mimugmail on September 07, 2019, 06:34:32 pm
https://github.com/opnsense/plugins/pull/1495
Title: Re: Blocking ads using only unbound
Post by: Pranjal on October 05, 2019, 07:53:48 am
Hey buddy I saw your post of blocking ad by unbound I applied same but not working ....plzz tell me how to set up the unbound ...moreover by this I can block my own define websites or not??
Title: Re: Blocking ads using only unbound
Post by: mimugmail on October 05, 2019, 01:11:20 pm
Which post do you mean?
Title: Re: Blocking ads using only unbound
Post by: Pranjal on October 05, 2019, 02:33:35 pm
Leave that..sir....just tell me that how to block domain aur websites in opn sense....I tried your app detection method in IPS but by that I can only block limited sites...if I want to block any other perticular site like Wikipedia...Amazon so how I can do it..
Title: Re: Blocking ads using only unbound
Post by: mimugmail on October 05, 2019, 04:47:31 pm
Transparent Proxy and blacklisted sites.
Title: Re: Blocking ads using only unbound
Post by: Pranjal on October 05, 2019, 04:56:43 pm
Sir I want to know how to use black listed sites I tried my best but can't able to do show...plz can u tell me step by step
Please
Title: Re: Blocking ads using only unbound
Post by: mimugmail on October 05, 2019, 05:35:20 pm
https://docs.opnsense.org/manual/how-tos/proxytransparent.html

With option to only log SNI, then you can use the blacklist feature in access control
Title: Re: Blocking ads using only unbound
Post by: Pranjal on October 05, 2019, 05:40:45 pm
Ok thanku sir I will try this....by the way how enable this SNI option
Title: Re: Blocking ads using only unbound
Post by: mimugmail on October 05, 2019, 07:57:33 pm
Just follow the guide, you will see it :)
Title: Re: Blocking ads using only unbound
Post by: Pranjal on October 05, 2019, 07:59:04 pm
Thanku so much...I will try it ...but I want your support also...I want to learn this firewall ...kepp supporting sir
Title: Re: Blocking ads using only unbound
Post by: Pranjal on October 11, 2019, 04:11:46 pm
Hello again...I tried this method and I was successful ...but still I need one help ...first of all tell me why we are using transperant proxy in this web filtering what is the role of that...means I am able to block the domain by web filter without use of transparent proxy...so what is the use of transparent proxy please tell me
Title: Re: Blocking ads using only unbound
Post by: Itow on January 16, 2020, 12:59:21 pm
Hello there  :)

first i'm sorry for my poor english it is not my native language and i'm better in reading it then writing  ::)

I'm using a similar solution and i'm writing here to show you the problems you can have with your script.
And i don't want create another DNS-Block thread.

Quote
unbound-control -c /var/unbound/unbound.conf reload
Is a very bad Solution ... it will fail if the list is to big

Quote
Then:

    Type crontab -e, press Enter and go to the end of the file (you may have to hit the "End" key on the last line)
    Press a
    Press ENTER
    Type: 0     23     *     *     *     (/usr/share/blocklist/getlist.sh) > /dev/null
    Press ESC, then : and finally wq!
It is maybe better to create a action-file in /usr/local/opnsense/service/conf/actions.d to configure cron via web-interface

I will now show the script iam currently using you have to install wget and bash via pkg to use it.
Feel free to edit it to your needs any hints to make the script better is very much appreciated.

Code: [Select]
ee /root/adblockscriptand insert
Code: [Select]
#!/usr/local/bin/bash

#Erstelle Temp Datein

tmp1="$(mktemp)"
tmp2="$(mktemp)"
tmp3="$(mktemp)"
tmp4="$(mktemp)"
tmp5="$(mktemp)"
tmp6="$(mktemp)"
tmp7="$(mktemp)"
file="/var/unbound/adblocklist.conf"

# Download Blocklist
{ \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/block/master/ultimate/formats/domains.txt; \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/block/master/extensions/xtreme/formats/domains.txt; \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/block/master/extensions/regional/formats/domains.txt; \
} > $tmp1
# Download Whitelist
{ \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/unblock/master/basic/formats/domains.txt; \
        cat /root/whitelist; \
} > $tmp4

# Saeubere die Blocklisten

sed -i '' -e '/\//d;/:/d;/(/d;/|/d;/\[/d;/\]/d;/#/d;/^$/d;/[\]/d' $tmp1
cat $tmp1 | tr -d '\r' >> $tmp2
sed -i '' -e 's/ *$//' $tmp2 && sort -uf $tmp2 |tee |uniq -i > $tmp3
sed -i '' -e '/^$/d' $tmp3
rm $tmp1 $tmp2

# Saeubere die Whitelist

sed -i '' -e '/\//d;/:/d;/(/d;/|/d;/\[/d;/\]/d;/#/d;/^$/d;/[\]/d' $tmp4
cat $tmp4 | tr -d '\r' >> $tmp5
sed -i '' -e 's/ *$//' $tmp5 && sort -uf $tmp5 |tee |uniq -i > $tmp6
sed -i '' -e '/^$/d' $tmp6
rm $tmp4 $tmp5

# Fuege Blocklist und Whitelist zusammen

comm -23 $tmp3 $tmp6 > $tmp7
rm $tmp3 $tmp6
sed -i '' -e '/^$/d' $tmp7
awk '$0="local-zone: \""$0"\" static"' $tmp7 > $file
rm $tmp7
if [ "$1" == info ]; then
        domains=$(awk '!/^#/ && !/^$/{c++}END{print c}' $file | awk '{ len=length($0); res=""; for (i=0;i<=len;i++) { res=substr($0,len-i+1,1) res; if (i > 0 && i < len && i % 3 == 0) { res = "," res } }; print res }')
        echo "Anzahl zu Blockender Domains = $domains"
fi
# Aendere Benutzer und Gruppe

chown unbound:unbound $file

# Starte Unbound neu
pluginctl dns
exit 0

To create the Whitelist-file:
Code: [Select]
echo '# Domains nach dieser Zeile einfuegen. Diese Zeile nichr loeschen!' > /root/whitelistIn the Whitelist-File you can add domains after the first line that shouldn't be blocked.

Create the action-File for cron in "/usr/local/opnsense/service/conf/actions.d"
Code: [Select]
ee /usr/local/opnsense/service/conf/actions.d/actions_AdBlock.confand insert
Code: [Select]
[reload]
command:/root/adblockscript
parameter:
type:script
message:Update AdBlocklist and load them
description:Update AdBlocklist and load them
then
Code: [Select]
configctl configd restartnow you can configure the Cron Job via Web Interface

to install bash and wget
Code: [Select]
pkg lock -y pkg
pkg install bash wget
pkg unlock -y pkg

make the script executable:
Code: [Select]
chmod +x /root/adblockscript
run the script via
Code: [Select]
./adblockscript infoit shows how many domains are blocked and create the blockfile for unbound

I'm using the root folder as working environment i know it is kind of laziness  ::)
For the blacklist i am using: https://github.com/EnergizedProtection/block (https://github.com/EnergizedProtection/block)
Output-File is: /var/unbound/adblocklist.conf <= insert this path in your Unbound config

Thanks for your patience and maybe this help someone  ;D
Title: Re: Blocking ads using only unbound
Post by: mihak on January 18, 2020, 09:15:04 pm
Sinnce https://energized.pro started to publish Unbound-readable blocklists, we should simplify our tutorial to something like this:

1. add include: /var/unbound/ad-blacklist.conf into Custom options of Unbound
2. Create Ad-blacklist-refresh.sh in /var/unbound with:
curl https://raw.githubusercontent.com/EnergizedProtection/block/master/blu/formats/unbound.conf -o /var/unbound/ad-blacklist.conf

3. insert a regular execution of this script into crontab

There are multiple levels of compiled lists by energized.pro team - just pick the right strength, let Unbound use it and enjoy ad-free browsing.
Title: Re: Blocking ads using only unbound
Post by: Itow on January 20, 2020, 02:20:41 pm
Sinnce https://energized.pro started to publish Unbound-readable blocklists, we should simplify our tutorial to something like this:

1. add include: /var/unbound/ad-blacklist.conf into Custom options of Unbound
2. Create Ad-blacklist-refresh.sh in /var/unbound with:
curl https://raw.githubusercontent.com/EnergizedProtection/block/master/blu/formats/unbound.conf -o /var/unbound/ad-blacklist.conf

3. insert a regular execution of this script into crontab

There are multiple levels of compiled lists by energized.pro team - just pick the right strength, let Unbound use it and enjoy ad-free browsing.

Hello there  ;D

yes your are right you can do that but using a script has also his benefits.

and two personal reason

If you like it realy easy and wont do anything it is better use a addon for Opnsense like: https://forum.opnsense.org/index.php?topic=14116.0 (https://forum.opnsense.org/index.php?topic=14116.0)

Thanks Itow

-edit

I have add a function to check the config file of unbound to be more fail safe

Code: [Select]
#!/usr/local/bin/bash

#Erstelle Temp Datein

tmp1="$(mktemp)"
tmp2="$(mktemp)"
tmp3="$(mktemp)"
tmp4="$(mktemp)"
tmp5="$(mktemp)"
tmp6="$(mktemp)"
tmp7="$(mktemp)"
file="/var/unbound/adblocklist.conf"
filebackup="/var/unbound/adblocklist.bck"

# Download Blocklist
{ \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/block/master/ultimate/formats/domains.txt; \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/block/master/extensions/xtreme/formats/domains.txt; \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/block/master/extensions/regional/formats/domains.txt; \
} > $tmp1
# Download Whitelist
{ \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/unblock/master/basic/formats/domains.txt; \
        cat /root/whitelist; \
} > $tmp4

# Saeubere die Blocklisten

sed -i '' -e '/\//d;/:/d;/(/d;/|/d;/\[/d;/\]/d;/#/d;/^$/d;/[\]/d' $tmp1
cat $tmp1 | tr -d '\r' >> $tmp2
sed -i '' -e 's/ *$//' $tmp2 && sort -uf $tmp2 |tee |uniq -i > $tmp3
sed -i '' -e '/^$/d' $tmp3
rm $tmp1 $tmp2

# Saeubere die Whitelist

sed -i '' -e '/\//d;/:/d;/(/d;/|/d;/\[/d;/\]/d;/#/d;/^$/d;/[\]/d' $tmp4
cat $tmp4 | tr -d '\r' >> $tmp5
sed -i '' -e 's/ *$//' $tmp5 && sort -uf $tmp5 |tee |uniq -i > $tmp6
sed -i '' -e '/^$/d' $tmp6
rm $tmp4 $tmp5

# Backup der alten Blocklist
if [ -f $file ]; then
        mv $file $filebackup
fi

# Fuege Blocklist und Whitelist zusammen

comm -23 $tmp3 $tmp6 > $tmp7
rm $tmp3 $tmp6
sed -i '' -e '/^$/d' $tmp7
awk '$0="local-zone: \""$0"\" static"' $tmp7 > $file

# Check Unbound Config

if ! unbound-checkconf /var/unbound/unbound.conf; then
        rm $file
        echo Nutze alte Blockliste
        mv $filebackup $file
else
#       echo Config ist Okey
        rm $filebackup
fi
if [ "$1" == info ]; then
        domains=$(awk '!/^#/ && !/^$/{c++}END{print c}' $file | awk '{ len=length($0); res=""; for (i=0;i<=len;i++) { res=substr($0,len-i+1,1) res; if (i > 0 && i < len && i % 3 == 0) { res = "," res } }; print res }')
        echo "Anzahl zu Blockender Domains = $domains"
fi
# Aendere Benutzer und Gruppe

chown unbound:unbound $file

# Starte Unbound neu
pluginctl dns
exit 0
Title: Re: Blocking ads using only unbound
Post by: eprom on January 23, 2020, 04:51:41 pm
if you do not add server: to the start of the first line of .conf file unbound will not start.

I only could start Unbound with that:
example:
Code: [Select]
server:local-zone: "0--ass-cinema-newsp.da.ru" static
local-zone: "0--bondage.dk" static
local-zone: "0--fightingshaving.da.ru" static
local-zone: "0--foodwarez.da.ru" static

Cheers and thanks for your work and scripts, Working like a charm.
Title: Re: Blocking ads using only unbound
Post by: Itow on January 24, 2020, 02:16:53 am
if you do not add server: to the start of the first line of .conf file unbound will not start.

I only could start Unbound with that:
example:
Code: [Select]
server:local-zone: "0--ass-cinema-newsp.da.ru" static
local-zone: "0--bondage.dk" static
local-zone: "0--fightingshaving.da.ru" static
local-zone: "0--foodwarez.da.ru" static

Cheers and thanks for your work and scripts, Working like a charm.

Hi,

usually it is not nethethery to add anything to the created Blocklist.

Please check if you have add include: /var/unbound/adblocklist.conf in your Unbound configuration under Custom options in the Web interface. And try remove any addition to the custom options to check if Unbound will function normally without it.

-
I have added a check if the crucial line exist in the unbound config.
Also added checks if Custom Whitelist and Blacklist exist.

Code: [Select]
#!/usr/local/bin/bash

#Erstelle Temp Datein

tmp1="$(mktemp)"
tmp2="$(mktemp)"
tmp3="$(mktemp)"
tmp4="$(mktemp)"
tmp5="$(mktemp)"
tmp6="$(mktemp)"
tmp7="$(mktemp)"
file="/var/unbound/adblocklist.conf"
filebackup="/var/unbound/adblocklist.bck"
whitelist="/root/whitelist"
blacklist="/root/blacklist"

# Backup der alten Blocklist
if [ -f $file ]; then
        mv $file $filebackup
fi

if ! [ -f $whitelist ]; then
        touch $whitelist
        echo '# Domains nach dieser Zeile einfuegen. Diese Zeile nichr loeschen!' > $whitelist
fi

if ! [ -f $blacklist ]; then
        touch $blacklist
        echo '# Domains nach dieser Zeile einfuegen. Diese Zeile nichr loeschen!' > $blacklist
fi

# Pruefe Custom White and Blacklist

# Download Blocklist
{ \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/block/master/ultimate/formats/domains.txt; \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/block/master/extensions/xtreme/formats/domains.txt; \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/block/master/extensions/regional/formats/domains.txt; \
        cat $blacklist; \
} > $tmp1

# Download Whitelist
{ \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/unblock/master/basic/formats/domains.txt; \
        cat $whitelist; \
} > $tmp4

# Saeubere die Blocklisten

sed -i '' -e '/\//d;/:/d;/(/d;/|/d;/\[/d;/\]/d;/#/d;/^$/d;/[\]/d' $tmp1
cat $tmp1 | tr -d '\r' >> $tmp2
sed -i '' -e 's/ *$//' $tmp2 && sort -uf $tmp2 |tee |uniq -i > $tmp3
sed -i '' -e '/^$/d' $tmp3
rm $tmp1 $tmp2

# Saeubere die Whitelist

sed -i '' -e '/\//d;/:/d;/(/d;/|/d;/\[/d;/\]/d;/#/d;/^$/d;/[\]/d' $tmp4
cat $tmp4 | tr -d '\r' >> $tmp5
sed -i '' -e 's/ *$//' $tmp5 && sort -uf $tmp5 |tee |uniq -i > $tmp6
sed -i '' -e '/^$/d' $tmp6
rm $tmp4 $tmp5

# Fuege Blocklist und Whitelist zusammen

comm -23 $tmp3 $tmp6 > $tmp7
rm $tmp3 $tmp6
sed -i '' -e '/^$/d' $tmp7
awk '$0="local-zone: \""$0"\" static"' $tmp7 > $file

# Check Unbound Config

if ! unbound-checkconf /var/unbound/unbound.conf; then
        rm $file
        echo Nutze alte Blockliste
        mv $filebackup $file
        exit 1
else
#       echo Config ist Okey
        if ! grep -cq "include: $file" /var/unbound/unbound.conf; then
        echo Please add "include: $file" to your custom Unbound settings.
        rm $filebackup
        fi
fi
if [ "$1" == info ]; then
        domains=$(awk '!/^#/ && !/^$/{c++}END{print c}' $file | awk '{ len=length($0); res=""; for (i=0;i<=len;i++) { res=substr($0,len-i+1,1) res; if (i > 0 && i < len && i % 3 == 0) { res = "," res } }; print res }')
        echo "Anzahl zu Blockender Domains = $domains"
fi
# Aendere Benutzer und Gruppe

chown unbound:unbound $file


# Starte Unbound neu
pluginctl dns

Thanks Itow
Title: Re: Blocking ads using only unbound
Post by: Itow on January 29, 2020, 06:31:46 am
Hello there  :)

yesterday i got following error:

Code: [Select]
[1580222648] unbound-checkconf[27733:0] error: cannot parse name queda212..duckdns.org
[1580222648] unbound-checkconf[27733:0] error: bad zone name queda212..duckdns.org static
[1580222648] unbound-checkconf[27733:0] fatal error: failed local-zone, local-data configuration

So i update the script to replace more then one dot with a single dot.

Code: [Select]
#!/usr/local/bin/bash

oldtmp="$(find /tmp -type f -name 'tmp.*' | wc -l)"
        if [ $oldtmp -gt 0 ]; then
        echo Found $oldtmp old tmp-files.
        echo Delete the old Files
        find /tmp -type f -name 'tmp.*' -exec rm -f {} \;
        fi

#Erstelle Temp Datein
tmp1="$(mktemp)"
tmp2="$(mktemp)"
tmp3="$(mktemp)"
tmp4="$(mktemp)"
tmp5="$(mktemp)"
tmp6="$(mktemp)"
tmp7="$(mktemp)"
file="/var/unbound/adblocklist.conf"
filebackup="/var/unbound/adblocklist.bck"
whitelist="/root/whitelist"
blacklist="/root/blacklist"
actionfile="/usr/local/opnsense/service/conf/actions.d/actions_AdBlock.conf"

# Backup der alten Blocklist
if [ -f $file ]; then
        mv $file $filebackup
else
        touch $filebackup
        echo '# Empty File' > $filebackup
fi

# Pruefe Custom White and Blacklist
if ! [ -f $whitelist ]; then
        touch $whitelist
        echo '# Domains nach dieser Zeile einfuegen. Diese Zeile nicht loeschen!' > $whitelist
fi

if ! [ -f $blacklist ]; then
        touch $blacklist
        echo '# Domains nach dieser Zeile einfuegen. Diese Zeile nicht loeschen!' > $blacklist
fi

# Pruefe und Erstelle Actionfile fuer Cron
if ! [ -f $actionfile ]; then
        touch $actionfile
        printf "[reload]\ncommand:/root/adblockscript\nparameter:\ntype:script\nmessage:Update AdBlocklist and load them\ndescription:Update AdBlocklist and load them" >> $actionfile
        service configd restart
        echo 'Now you can configure the Cron Job via Web Interface'
fi
# Download Blocklist
{ \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/block/master/ultimate/formats/domains.txt; \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/block/master/extensions/xtreme/formats/domains.txt; \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/block/master/extensions/regional/formats/domains.txt; \
        cat $blacklist; \
} > $tmp1

# Download Whitelist
{ \
        wget -qO- https://raw.githubusercontent.com/EnergizedProtection/unblock/master/basic/formats/domains.txt; \
        cat $whitelist; \
} > $tmp4

# Saeubere die Blocklisten

sed -i '' -e '/\//d;/:/d;/(/d;/|/d;/\[/d;/\]/d;/#/d;/^$/d;/[\]/d' $tmp1
cat $tmp1 | sed -r 's/\.+/\./' | tr -d '\r' >> $tmp2
sed -i '' -e 's/ *$//' $tmp2 && sort -uf $tmp2 |tee |uniq -i > $tmp3
sed -i '' -e '/^$/d' $tmp3
rm $tmp1 $tmp2

# Saeubere die Whitelist

sed -i '' -e '/\//d;/:/d;/(/d;/|/d;/\[/d;/\]/d;/#/d;/^$/d;/[\]/d' $tmp4
cat $tmp4 | sed -r 's/\.+/\./' | tr -d '\r' >> $tmp5
sed -i '' -e 's/ *$//' $tmp5 && sort -uf $tmp5 |tee |uniq -i > $tmp6
sed -i '' -e '/^$/d' $tmp6
rm $tmp4 $tmp5

# Fuege Blocklist und Whitelist zusammen

comm -23 $tmp3 $tmp6 > $tmp7
rm $tmp3 $tmp6
sed -i '' -e '/^$/d' $tmp7
awk '$0="local-zone: \""$0"\" static"' $tmp7 > $file
rm $tmp7

# Check Unbound Config

if ! unbound-checkconf /var/unbound/unbound.conf; then
        rm $file
        echo Nutze alte Blockliste
        mv $filebackup $file
        exit 1
else
#       echo Config ist Okey
        if ! grep -cq "include: $file" /var/unbound/unbound.conf; then
        echo Please add "include: $file" to your custom Unbound settings.
        fi
        rm $filebackup
fi
if [ "$1" == info ]; then
        domains=$(awk '!/^#/ && !/^$/{c++}END{print c}' $file | awk '{ len=length($0); res=""; for (i=0;i<=len;i++) { res=substr($0,len-i+1,1) res; if (i > 0 && i < len && i % 3 == 0) { res = "," res } }; print res }')
        echo "Anzahl zu Blockender Domains = $domains"
fi
# Aendere Benutzer und Gruppe

chown unbound:unbound $file

# Starte Unbound neu
pluginctl dns
exit 0

Thanks Itow

--Edit 30.01.20 
fix Typos and few Issues add new checks
Title: Re: Blocking ads using only unbound
Post by: mullasci on April 11, 2020, 03:45:47 am
Thanks for the tutorial.

BTW as of today the github link to the host list works fine for me while the non-github link is timing out.
Title: Re: Blocking ads using only unbound
Post by: Jul1991 on July 11, 2020, 09:52:53 am
Is this tutorial sill valid?
I've just installed the unbound-plus plugin and selected which block list use. Did I go wrong?
Title: Re: Blocking ads using only unbound
Post by: mimugmail on July 11, 2020, 09:54:41 am
Is this tutorial sill valid?
I've just installed the unbound-plus plugin and selected which block list use. Did I go wrong?

No, unbound-plus is enough
Title: Re: Blocking ads using only unbound
Post by: Jul1991 on July 11, 2020, 09:59:49 am
Is there a way to have a dashboard and a detailed log to have an idea on what's been blocked?
Title: Re: Blocking ads using only unbound
Post by: ProServ on September 15, 2020, 01:14:29 pm
Is there a way to have a dashboard and a detailed log to have an idea on what's been blocked?

+1000 to this request
We have web security when blocking URLs  8) but we don't have the possibility to check who is blocking them  :-[.