Joined: 08 May 2018 Posts: 14221 Location: Texas, USA
Posted: Fri Nov 04, 2022 20:39 Post subject:
This should probably be rm -f, not rm -r:
Code:
rm -r /tmp/blockedhosts
The -r is recursive, the -f is ignore nonexistent files and arguments, never prompt, which is what I think was intended, not recursively removing a file. _________________ "Life is but a fleeting moment, a vapor that vanishes quickly; All is vanity"
Contribute To DD-WRT Pogo - A minimal level of ability is expected and needed... DD-WRT Releases 2023 (PolitePol)
DD-WRT Releases 2023 (RSS Everything)
----------------------
Linux User #377467 counter.li.org / linuxcounter.net
Joined: 26 Mar 2013 Posts: 1857 Location: Hung Hom, Hong Kong
Posted: Sat Nov 05, 2022 0:56 Post subject:
kernel-panic69 wrote:
This should probably be rm -f, not rm -r:
Code:
rm -r /tmp/blockedhosts
The -r is recursive, the -f is ignore nonexistent files and arguments, never prompt, which is what I think was intended, not recursively removing a file.
WARNING: DO NOT TRY IT
The horrifying consequence of "rm -r / tmp/blockedhosts"... all you need is just an extra space!
BTW, I cannot find posts written by user "tinkeruntilitworks" using Search, not even this thread's first message. Because he/she is just a Guest?
_________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
I think that was a lot of hot-headed nonsense from the looks of all the posts edited to say, "deleted"... but the person re-birthed themselves as "itwontbewe", as we all should know if we're paying that much attention. _________________ "The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep." - Robert Frost
"I am one of the noticeable ones - notice me" - Dale Frances McKenzie Bozzio
Sorry but not very good with Forums. It might be just me but I feel your post(s) are quite confusing. You are quoting Adblock with Unbound with a better method to create /tmp/blockedhosts. Then there's a reply from kernel-panic69:
kernel-panic69 wrote:
This should probably be rm -f, not rm -r:
Code:
rm -r /tmp/blockedhosts
The -r is recursive, the -f is ignore nonexistent files and arguments, never prompt, which is what I think was intended, not recursively removing a file.
Could you please explain clearly?
Maybe post the full code (correct). Also why would we use 2 different variations (static or refuse), what's the difference?
Joined: 26 Mar 2013 Posts: 1857 Location: Hung Hom, Hong Kong
Posted: Mon Apr 03, 2023 11:54 Post subject: Re: Unbound DNS over TLS Adblock up-to-date root.hints
l3g023 wrote:
Sorry but not very good with Forums. It might be just me but I feel your post(s) are quite confusing. You are quoting Adblock with Unbound with a better method to create /tmp/blockedhosts. Then there's a reply from kernel-panic69:
kernel-panic69 wrote:
This should probably be rm -f, not rm -r:
Code:
rm -r /tmp/blockedhosts
The -r is recursive, the -f is ignore nonexistent files and arguments, never prompt, which is what I think was intended, not recursively removing a file.
Could you please explain clearly?
Maybe post the full code (correct). Also why would we use 2 different variations (static or refuse), what's the difference?
Do you have a working Unbound? Post your unbound.conf.
You don't have to implement ad-blocking filters. These days, ads are better blocked by browser extensions like Ublock Origin. _________________ Router: Asus RT-N18U (rev. A1)
Drink, Blink, Stretch! Live long and prosper! May the Force and farces be with you!
Joined: 26 Mar 2013 Posts: 1857 Location: Hung Hom, Hong Kong
Posted: Mon May 22, 2023 13:48 Post subject:
This is a long script (with comments and biblography) for downloading DNS block lists from multiple sources, to create blockedhosts.conf (variable: target). Just include it in your unbound.conf.
Un-comment the list (removing "#") to enable a list (dl is the function to download it), and comment them back to disable it.
Not sure whether this should be split into a new thread.
BTW, I have 2 simple scripts that generate the SSL certificates (Ed25519) for Unbound. To be posted as new topic later....
Code:
#!/bin/sh
#
# DD-WRT :: View topic - Unbound DNS over TLS Adblock up-to-date root.hints
# https://forum.dd-wrt.com/phpBB2/viewtopic.php?t=320362&sid=8f74203692da063796392a961494cde5
#
function dl() {
echo -e "Downloading $2 to $1..."
curl -L --compressed $2 >> $1
}
function pp2() {
echo "Processing $2 into $3..."
#
# Unbound memory optimization : dns
# https://www.reddit.com/r/dns/comments/w0g83i/unbound_memory_optimization/
#
# Unbound: Memory consumption very high, gets killed | The FreeBSD Forums
# https://forums.freebsd.org/threads/unbound-memory-consumption-very-high-gets-killed.78578/
#
# unbound-checkconf memory usage is higher than naively expected · Issue #128 · NLnetLabs/unbound · GitHub
# https://github.com/NLnetLabs/unbound/issues/128
#
if [ $1 == 127 ] ; then
echo '.. Method: local-data'
cat $2 | awk '{print "local-data: \""$2".\" A 127.0.0.1"}' >> $3
else
echo '.. Method: local-zone'
cat $2 | grep 0.0.0.0 | awk '{print "local-zone: \""$2".\" refuse"}' >> $3
fi
}
function pp1() {
echo "Processing $2 into $3 ..."
if [ $1 == 127 ] ; then
echo '.. Method: local-data'
cat $2 | awk '{print "local-data: \""$1".\" A 127.0.0.1"}' >> $3
else
echo '.. Method: local-zone'
cat $2 | awk '{print "local-zone: \""$1".\" refuse"}' >> $3
fi
}
target=/jffs/etc/unbound/blockedhosts.conf
if [ -f $target ] ; then
echo -e "$0[$$]: \033[1m$target\033[0m already exists!\007"
exit 1
fi
# dl $tf 'https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts'
# dl $tf 'https://raw.githubusercontent.com/AdAway/adaway.github.io/master/hosts.txt'
# dl $tf 'https://github.com/chadmayfield/my-pihole-blocklists/raw/master/lists/pi_blocklist_porn_all.list'
dl $tf 'https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/spy.txt'
else
echo e '\033[1mPhase 1b\033[0m'
# the following list will consume all memory
dl $tf 'https://www.github.developerdan.com/hosts/lists/ads-and-tracking-extended.txt'
fi
#
# https://pgl.yoyo.org/adservers/serverlist.php?hostformat=unbound;showintro=0
#
# https://someonewhocares.org/hosts/
# https://pgl.yoyo.org/adservers/
#
# disable Window$ Update
#
# dl $tf 'https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/update.txt'
# dl $tf 'https://raw.githubusercontent.com/schrebra/Windows.10.DNS.Block.List/main/hosts.txt'
#
# following list included microsoft
#
# dl $tf 'https://raw.githubusercontent.com/crazy-max/WindowsSpyBlocker/master/data/hosts/extra.txt'
if true ; then
echo -e '\033[1mPhease 3\033[0m'
#
# GitHub - Ewpratten/youtube_ad_blocklist: This is an open project to maintain
# a list of domain names that serve YouTube ads
# https://github.com/Ewpratten/youtube_ad_blocklist
#
# following affects Scrabble Go
# dl $tf 'http://gh-pages.ewpratten.com/youtube_ad_blocklist/unbound.txt'
fi
cat $tf >> $target
echo "Sorting and removing duplicates into $tf..."
sort $target | uniq > $tf