tanrax / maza-ad-blocking
- среда, 1 апреля 2020 г. в 00:20:33
Shell
Local ad blocker. Like Pi-hole but local and using your operating system.
Comments: https://news.ycombinator.com/item?id=22717650
Simple, native and efficient local advertising blocker. Compatible with OSX and Linux.
maza update sudo maza start sudo maza stop maza status brew install gnu-sedThen you do this.
curl -o maza https://raw.githubusercontent.com/tanrax/maza-ad-blocking/master/maza && chmod +x maza && sudo mv maza /usr/local/binOptional but recommended, make a backup of your hosts file.
sudo cp /etc/hosts /etc/hosts.backupsudo rm /usr/local/bin/maza && sudo rm -r ~/.mazaUnfortunately the hosts file does not support sub-domains (wildcards), which is necessary to correctly filter all DNS. You will need to install locally a server for that purpose, Maza supports the Dnsmasq format. Here's an example for OSX.
brew install dnsmasqEdit the file.
/usr/local/etc/dnsmasq.conf
Add the following lines.
conf-file=(your user path)/.maza/dnsmasq.conf
Start DNSMASQ.
sudo brew services stop dnsmasq
sudo brew services start dnsmasqDelete the list of OSX DNS servers and add the 3 addresses. The first one will be your local server, and the other 2 belong to OpenDNS, which you can use any other.
127.0.0.1
208.67.222.222
208.67.220.220Refresh your DNS cache
sudo dscacheutil -flushcache; sudo killall -HUP mDNSResponderAdd in confiigure file: /usr/local/etc/dnsmasq.conf
no-resolv
server=208.67.222.222
server=208.67.220.220
If you want all your .localhost domains, for example, point to localhost add in confiigure file: /usr/local/etc/dnsmasq.conf
address=/.localhost/127.0.0.1
/etc/hosts in case of unforeseen circumstances, neither the project nor its author will be responsible for any possible repercussions derived from not carrying out this action.