Compare commits

...

11 commits

Author SHA1 Message Date
Tristan
d710856ce4 renewed block.list 2024-10-23 17:54:57 +02:00
Tristan
bfeadad8a7 sorts block.list by domain name 2023-09-06 13:16:28 +02:00
Tristan
54085b0dc5 builds ipv4 and ipv6 block.list into one file 2023-09-06 13:13:59 +02:00
Tristan
963ef048db adds building of blockV6.list 2023-09-06 12:56:24 +02:00
Tristan
bd349219bf adds blocklist with local ipv6 address 2023-09-06 12:19:22 +02:00
Tristan
cf5d6d846a updates block.list 2023-09-04 15:37:35 +02:00
tristan
053fdb9b3c new block.list 2022-08-03 00:28:49 +02:00
676e4b0812 Merge branch 'master' of ssh://git.fucktheforce.de/user/tristan/RetrieveAdBlocklists 2019-06-12 22:23:02 +02:00
8cf5835ff1 new block list 2019-06-12 22:22:45 +02:00
072222ba43 better whitespace handling 2019-06-12 22:21:01 +02:00
steckbrief
bc859e8f29 adds the DNS masq munin plugin 2019-04-28 16:40:08 +02:00
3 changed files with 282121 additions and 134603 deletions

416606
block.list

File diff suppressed because it is too large Load diff

View file

@ -1,13 +1,14 @@
#!/bin/bash
awk -F'[\t ]+' '{
if (!match($0, /^\s*(#|$)/)) {
if (!match($0, /^[\t ]*(#|$)/)) {
if (NF>=2 && length($2)) {
host=$2
} else {
host=$1
}
if (!match(host, /^(localhost|local|localhost.localdomain|ip6-localnet|ip6-localhost$)$/)) {
print "127.0.0.1 " host
print "127.0.0.1 " host
print "::1 " host
}
}
}' adlists/* | sort > block.list
}' adlists/* | sort -k2 > block.list

111
dnsmasq-munin-plugin Normal file
View file

@ -0,0 +1,111 @@
#!/bin/bash
# -*- sh -*-
: <<=cut
=head1 NAME
dnsmasq - Plugin to monitor dnsmasq queries
=head1 APPLICABLE SYSTEMS
All systems with "bash", "sed" and "dnsmasq"
=head1 CONFIGURATION
The following is the default configuration
[dnsmasq]
env.logfile /var/log/dnsmasq/dnsmasq.log
The user running this plugin needs read access to the
dnsmasq logfiles:
[dnsmasq]
user root
=head1 INTERPRETATION
This plugin shows a graph with the number of forwarded, cached and
blocked dns queries.
=head1 MAGIC MARKERS
#%# family=auto
#%# capabilities=autoconf
=head1 VERSION
0.0.1
=head1 BUGS
=head1 AUTHOR
Me, myself and I
Based on dnsmasq plugin by: notracking <https://github.com/notracking>
Based on fail2ban plugin by: Stig Sandbeck Mathisen <ssm@fnord.no>
=head1 LICENSE
GPLv2
=cut
##############################
# Configurable variables
logfile=${logfile:-/var/log/dnsmasq/dnsmasq.log}
# Print the munin values
values() {
echo -n "dnsmasq_forwarded.value "
cat ${logfile} | sed -n "/^$(date --date='5 minutes ago' '+%b %_d %H:%M')/,\$p" | grep ": forwarded" | wc -l
echo -n "dnsmasq_cached.value "
cat ${logfile} | sed -n "/^$(date --date='5 minutes ago' '+%b %_d %H:%M')/,\$p" | grep ": cached" | wc -l
echo -n "dnsmasq_blocked.value "
cat ${logfile} | sed -n "/^$(date --date='5 minutes ago' '+%b %_d %H:%M')/,\$p" | grep "/block.list" | wc -l
}
# Print the munin config
config() {
echo 'graph_title DNS queries'
echo 'graph_info This graph shows the number of queries resolved by dnsmasq'
echo 'graph_category network'
echo 'graph_vlabel Number of queries'
echo 'graph_args --base 1000 -l 0'
echo 'graph_total total'
echo 'dnsmasq_forwarded.label forwarded'
echo 'dnsmasq_cached.label cached'
echo 'dnsmasq_blocked.label blocked'
}
# Print autoconfiguration hint
autoconf() {
if [ -f ${logfile} ]
then
echo "yes"
else
echo "no (${logfile} not found)"
fi
exit
}
##############################
# Main
case $1 in
config)
config
;;
autoconf)
autoconf
;;
*)
values
;;
esac