Comments: https://news.ycombinator.com/item?id=22717650
sudo maza startLike Pi-hole but local and using your operating system.
Simple, native and efficient local ad blocker. Bash script compatible with MacOS, Linux, BSD and Windows Subsystem for Linux (WSL).
- Just bash π€.
- It affects any browser or software installed π±.
- You don't have to install any browser extensions or applications π«, you just use the tools of your operating system.
- You update the list of DNS to be blocked with a single command π.
- Pure Opensource β€οΈ.
maza updatesudo maza startsudo maza stopmaza status- bash 4.0 or higher
- curl
- Only macOS users, gsed:
brew install gnu-sed
Then 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.backupOpen your cron.
crontab -eAdd the following line at the end.
@daily maza update
sudo rm /usr/local/bin/maza && sudo rm -r ~/.mazaCreate a file named ignore inside the Maza configuration folder.
touch ~/.maza/ignoreEdit the file for all domains that you do not want to ignore with a line break.
Example:
ads-twitter.com
ads.twitter.comFinally update Maza to apply the changes.
maza updateBy default the Yoyo DNS list (Peter Lowe) is used. If you want to use another list, like Steven Black's for example, you must modify the variable in line 7.
It would go from:
URL_DNS_LIST="https://pgl.yoyo.org/adservers/serverlist.php?showintro=0&mimetype=plaintext"
To the following:
URL_DNS_LIST="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
Unfortunately 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.
maza updatebrew install dnsmasqEdit the file.
/usr/local/etc/dnsmasq.conf
Add the following line at the end.
conf-file=(your user path)/.maza/dnsmasq.conf
Example
conf-file=/Users/myuser/.maza/dnsmasq.conf
Start DNSMASQ.
sudo brew services stop dnsmasq
sudo brew services start dnsmasqDelete the list of macOS 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 mDNSRespondersudo maza stop
sudo maza startmaza updatesudo apt update
sudo apt install dnsmasqEdit file in path.
/etc/dnsmasq.conf
Add the following line at the end.
conf-file=(your user path)/.maza/dnsmasq.conf
Example
conf-file=/home/myuser/.maza/dnsmasq.conf
Start DNSMASQ.
sudo systemctl stop dnsmasq
sudo systemctl start dnsmasq
sudo systemctl enable dnsmasqIn Gnome Shell, open Settings->Nework. Click in your connection.
Add your local server (dnsmasq), and the other 2 belong to OpenDNS, which you can use any other.
127.0.0.1,208.67.222.222,208.67.220.220In KDE Plasma, open Settings->Nework->Connectios. Click in your connection and tab ip4.
Method: Automatic (Only addresses).
Add your local server (dnsmasq), and the other 2 belong to OpenDNS, which you can use any other.
DNS Servers:127.0.0.1,208.67.222.222,208.67.220.220.
sudo maza stop
sudo maza startAdd in configure 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 configure file: /usr/local/etc/dnsmasq.conf or /etc/dnsmasq.conf.
address=/.localhost/127.0.0.1
You can easily create your own DNS server on a Raspberry Pi, VPS or wherever you want, to connect your devices in just 10 commands thanks to Maza. Follow the tutorial.
Remember to make a backup copy of /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.





