BIND 9 mining DNS block CentOS
Zablokovanie mining cez DNS
yum install perl-Text-Diff
Script:
nano start.sh
#!/bin/bash
#webova adresa na stazeni host tabulky
web_host_table="https://raw.githubusercontent.com/hoshsadiq/adblock-nocoin-list/master/hosts.txt"
#soubor s novymi daty
new_file="/var/named/nocoin_new.txt"
#soubor se starymi daty
old_file="/var/named/nocoin_old.txt"
##########################################################
wget -q -O $new_file $web_host_table
diff -q $new_file $old_file > /dev/null 2>&1
if [[ $? == 0 ]]
then echo "no new data"; exit 0
else echo "new data available"; perl nocoin-bind-pl-1.pl; exit 1
fi
Tento script porovna ci su zmeny a ak su zmeny tak ich implementuje do zonoveho suboru
Pre spravnu funcknost je potrebne v DNS nastavit:
nano /etc/named.conf
v sekcii OPTIONS
response-policy {
zone "nocoin.mhasin.eu";
};
nano /etc/named.rfc1912.zones
zone "nocoin.mhasin.eu" {
file "/POLE/data/server/dns-anti-mining/nocoin.conf";
type master;
};
Stiahnutie celeho projektu:
Pridanie do CRON
crontab -e
0 0 * * * /POLE/data/server/dns-anti-mining/start.sh
Zdroj:
https://www.root.cz/clanky/ochrana-proti-tezbe-kryptomen-pomoci-v-dns-vlastni-rpz-filtr/