Разное по противодействию ботам в ActivityPub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

46 lines
1.6 KiB

#!/bin/bash
function backup-and-flush {
cp /etc/dnscrypt-proxy/blacklist.txt /etc/dnscrypt-proxy/blacklist.$(date +"%Y-%m-%d_%T").bak.txt
echo "" > /etc/dnscrypt-proxy/blacklist.txt
}
function add-git-stevenblack-hosts {
# Download fresh blacklist
wget https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts -O /etc/dnscrypt-proxy/blacklist_StevenBlack_hosts.txt
# Format
sed -i '1, 39d' /etc/dnscrypt-proxy/blacklist_StevenBlack_hosts.txt
sed -i 's/0\.0\.0\.0 //g' /etc/dnscrypt-proxy/blacklist_StevenBlack_hosts.txt
sed -i 's/# .*$//g' /etc/dnscrypt-proxy/blacklist_StevenBlack_hosts.txt
sed -i 's/#\*\./\*\./g' /etc/dnscrypt-proxy/blacklist_StevenBlack_hosts.txt
sed -i '/^\s*$/d' /etc/dnscrypt-proxy/blacklist_StevenBlack_hosts.txt
# Add to blacklist
echo "# BLACKLIST from https://github.com/StevenBlack/hosts" >> /etc/dnscrypt-proxy/blacklist.txt
cat /etc/dnscrypt-proxy/blacklist_StevenBlack_hosts.txt >> /etc/dnscrypt-proxy/blacklist.txt
}
function add-bot-domains {
echo "# BLACKLIST bots attack to Mastodon" >> /etc/dnscrypt-proxy/blacklist.txt
cat /etc/dnscrypt-proxy/blacklist_bot-attack.txt >> /etc/dnscrypt-proxy/blacklist.txt
}
function add-custom-domains {
echo "# BLACKLIST static custom records" >> /etc/dnscrypt-proxy/blacklist.txt
cat /etc/dnscrypt-proxy/static-blacklist.txt >> /etc/dnscrypt-proxy/blacklist.txt
}
function delete-exceptions {
echo "Deleting exceptions"
# sed -i '/^.*something.*$/d' /etc/dnscrypt-proxy/blacklist.txt
}
backup-and-flush
add-git-stevenblack-hosts
add-bot-domains
add-custom-domains
delete-exceptions
# Restart dnscrypt
systemctl restart dnscrypt-proxy
exit 0