mirror of
https://github.com/tanrax/maza-ad-blocking.git
synced 2025-07-05 03:45:42 +02:00
Compare commits
12 Commits
f3cc35bccf
...
master
Author | SHA1 | Date | |
---|---|---|---|
32747144b7 | |||
9c3d08e8ee | |||
8405aa6edc | |||
61568c57ec | |||
e32584b978 | |||
b2a4d7217b | |||
3bbb0fe23a | |||
ac9fe2a3df | |||
19ede6d147 | |||
a592716528 | |||
4e1aad2739 | |||
8fd8d50e27 |
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@ -1 +0,0 @@
|
||||
liberapay: androsfenollosa
|
61
README.md
61
README.md
@ -28,6 +28,7 @@ Simple, native and efficient **local ad blocker**. Bash script compatible with *
|
||||
|
||||
- [Commands](#-commands)
|
||||
- [Install or update](#%EF%B8%8F-install-or-update)
|
||||
- [Check if you block ads](#-check-if-you-block-ads)
|
||||
- [Auto update of domains to be blocked](#-auto-update-of-domains-to-be-blocked)
|
||||
- [Uninstall](#-uninstall)
|
||||
- [Not blocking certain domains](#-not-blocking-certain-domains)
|
||||
@ -35,13 +36,16 @@ Simple, native and efficient **local ad blocker**. Bash script compatible with *
|
||||
- [Alternative DNS list](#-alternative-dns-list)
|
||||
- [DNSMASQ (or support sub-domains: wildcards)](#dnsmasq)
|
||||
- [Create your own Pi-Hole](#-create-your-own-pi-hole-server-with-maza)
|
||||
- [Projects inspired by Maza](#user-content-️-projects-inspired-by-maza)
|
||||
- [Donations](#-buy-me-a-coffee)
|
||||
- [Community or questions](#-get-help-or-talk-with-the-community)
|
||||
|
||||
## 📟 Commands
|
||||
|
||||
### 📡 Update database
|
||||
|
||||
``` bash
|
||||
maza update
|
||||
sudo maza update
|
||||
```
|
||||
|
||||
### 🔨 Start
|
||||
@ -59,7 +63,7 @@ sudo maza stop
|
||||
### ⚖️ Status
|
||||
|
||||
``` bash
|
||||
maza status
|
||||
sudo maza status
|
||||
```
|
||||
|
||||
## ⚙️ Install or Update
|
||||
@ -82,6 +86,25 @@ Optional but recommended, make a backup of your hosts file.
|
||||
sudo cp /etc/hosts /etc/hosts.backup
|
||||
```
|
||||
|
||||
## 🧪 Check if you block ads
|
||||
|
||||
You can run a test to see if the domains are blocked.
|
||||
|
||||
For example, you can run the following command.
|
||||
|
||||
``` bash
|
||||
curl googleadservices.com
|
||||
```
|
||||
|
||||
If you get an error like this, it means that the domain is blocked.
|
||||
|
||||
``` shell
|
||||
curl: (7) Failed to connect to googleadservices.com port 80 after 2 ms: Could not connect to server
|
||||
```
|
||||
|
||||
But if you get a response with HTML, it means that the domain is not blocked (maybe a 404 error).
|
||||
|
||||
|
||||
## 🤖 Auto update of domains to be blocked
|
||||
|
||||
Open your `cron`.
|
||||
@ -106,12 +129,12 @@ TERM=dumb
|
||||
## 🔪 Uninstall
|
||||
|
||||
``` bash
|
||||
sudo rm /usr/local/bin/maza && sudo rm -r ~/.config/maza
|
||||
sudo rm /usr/local/bin/maza && sudo rm -r /root/.config/maza
|
||||
```
|
||||
|
||||
## 🚫 Not blocking certain domains
|
||||
|
||||
Edit `~/.config/maza/ignore` and add the domains you want to ignore.
|
||||
Edit `/root/.config/maza/ignore` and add the domains you want to ignore.
|
||||
|
||||
Example:
|
||||
|
||||
@ -140,12 +163,12 @@ ip6-allhosts
|
||||
Finally update Maza to apply the changes.
|
||||
|
||||
``` bash
|
||||
maza update
|
||||
sudo maza update
|
||||
```
|
||||
|
||||
## 🎯 Add custom domains to block
|
||||
|
||||
If you want to include your own domains to be blocked, you can add them to `~/.config/maza/custom-domains`. They must each be on one line, ignoring end slash or protocol (`http` or `https`).
|
||||
If you want to include your own domains to be blocked, you can add them to `/root/.config/maza/custom-domains`. They must each be on one line, ignoring end slash or protocol (`http` or `https`).
|
||||
|
||||
For example:
|
||||
|
||||
@ -158,7 +181,7 @@ ad.about.com
|
||||
Then update the database to regenerate the list to include your domains.
|
||||
|
||||
```
|
||||
maza update
|
||||
sudo maza update
|
||||
```
|
||||
|
||||
## 🔒 Alternative DNS list
|
||||
@ -182,7 +205,7 @@ Unfortunately the hosts file does **not support sub-domains (wildcards)**, which
|
||||
#### 0 Update Maza
|
||||
|
||||
```bash
|
||||
maza update
|
||||
sudo maza update
|
||||
```
|
||||
|
||||
#### 1 Install
|
||||
@ -248,7 +271,7 @@ sudo maza start
|
||||
#### 0 Update Maza
|
||||
|
||||
```bash
|
||||
maza update
|
||||
sudo maza update
|
||||
```
|
||||
|
||||
#### 1 Install
|
||||
@ -339,20 +362,26 @@ If you want all your `.localhost` domains, for example, point to localhost add i
|
||||
address=/.localhost/127.0.0.1
|
||||
```
|
||||
|
||||
## ☕ Buy me a coffee
|
||||
|
||||
Help me continue to improve.
|
||||
|
||||
```shell
|
||||
ssh customer@andros.dev -p 5555
|
||||
```
|
||||
|
||||
## 💬 Get Help or talk with the community
|
||||
|
||||
[Jabber/XMPP](xmpp:maza-ad-blocking@groups.im.andros.dev/?join)
|
||||
|
||||
## Help me continue to improve
|
||||
|
||||
<p align="center">
|
||||
<a href="https://liberapay.com/androsfenollosa/donate"><img alt="Donate using Liberapay" src="https://liberapay.com/assets/widgets/donate.svg"></a>
|
||||
</p>
|
||||
- [IRC: #maza-ad-blocking on irc.libera.chat](ircs://irc.libera.chat:6697/maza-ad-blocking)
|
||||
- [Fediverse/Mastodon](https://activity.andros.dev/@andros)
|
||||
|
||||
## 🍓 CREATE YOUR OWN PI-HOLE SERVER WITH MAZA
|
||||
|
||||
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](https://programadorwebvalencia.com/create-your-own-pi-hole-with-10-commands/).
|
||||
|
||||
## 🎖️ Projects inspired by Maza
|
||||
|
||||
- [adless](https://github.com/WIttyJudge/adless)
|
||||
|
||||
## ⚠️ CAUTION
|
||||
|
||||
|
35
docker/Dockerfile
Normal file
35
docker/Dockerfile
Normal file
@ -0,0 +1,35 @@
|
||||
# Dockerfile
|
||||
FROM debian:slim
|
||||
|
||||
# Set environment variables
|
||||
ENV URL_DNS_LIST_CUSTOM=""
|
||||
ENV MAZA_DIR="/etc/maza"
|
||||
ENV MAZA_SCRIPT="/usr/local/bin/maza"
|
||||
|
||||
# Install dependencies
|
||||
RUN apt-get update && apt-get install -y \
|
||||
dnsmasq \
|
||||
curl \
|
||||
bash \
|
||||
cron \
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Add the maza script
|
||||
COPY maza $MAZA_SCRIPT
|
||||
RUN chmod +x $MAZA_SCRIPT
|
||||
|
||||
# Configure dnsmasq
|
||||
RUN mkdir -p "$MAZA_DIR" \
|
||||
&& echo "conf-file=$MAZA_DIR/dnsmasq.conf" >> /etc/dnsmasq.conf
|
||||
|
||||
# Configure cron to update the maza list daily
|
||||
RUN echo "@daily $MAZA_SCRIPT update" >> /etc/cron.d/maza-cron \
|
||||
&& chmod 0644 /etc/cron.d/maza-cron \
|
||||
&& crontab /etc/cron.d/maza-cron
|
||||
|
||||
# Expose necessary ports
|
||||
EXPOSE 53/udp 53/tcp 67/udp
|
||||
|
||||
# Start dnsmasq and cron
|
||||
CMD service cron start && dnsmasq -k
|
9
docker/README.md
Normal file
9
docker/README.md
Normal file
@ -0,0 +1,9 @@
|
||||
# EXPERIMENTAL!
|
||||
|
||||
## This is a new feature and still under development. Use at your own risk.
|
||||
|
||||
Download `compose.yaml` and `Dockerfile` to your project directory.
|
||||
|
||||
```sh
|
||||
docker compose up -d --build
|
||||
```
|
13
docker/compose.yaml
Normal file
13
docker/compose.yaml
Normal file
@ -0,0 +1,13 @@
|
||||
services:
|
||||
maza_dns:
|
||||
build: .
|
||||
container_name: maza_dns
|
||||
environment:
|
||||
#- URL_DNS_LIST_CUSTOM="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
|
||||
ports:
|
||||
- "53:53/udp"
|
||||
- "53:53/tcp"
|
||||
- "67:67/udp"
|
||||
volumes:
|
||||
- maza_data:/etc/maza
|
||||
restart: unless-stopped
|
16
maza
16
maza
@ -134,6 +134,19 @@ update() {
|
||||
# Remove empty lines
|
||||
custom-sed -i.bak '/^$/d' "$CONFIG$LIST"
|
||||
|
||||
# Update HOST_FILE
|
||||
## Remove old list
|
||||
custom-sed -i "/$START_TAG/,/$END_TAG/d" "$HOST_FILE"
|
||||
## Add List to host file.
|
||||
# Add start tag DNS list in first line
|
||||
echo "$START_TAG" >> "$HOST_FILE"
|
||||
echo "$PROJECT" >> "$HOST_FILE"
|
||||
echo "$AUTHOR" >> "$HOST_FILE"
|
||||
# Transform "mydomain.com" to "127.0.0.1 mydomain.com" except comments
|
||||
custom-sed "/^#/!s/^/127.0.0.1 /g" "$CONFIG$LIST" >> "$HOST_FILE"
|
||||
# Add end tag DNS list in first line
|
||||
echo "$END_TAG" >> "$HOST_FILE"
|
||||
|
||||
# Make dnsmasq format
|
||||
cp "$CONFIG$LIST" "$CONFIG$LIST_DNSMASQ"
|
||||
## Remove triple "-". Example: "my---domain.com" to "my-domain.com". Only in dnsmasq.
|
||||
@ -165,9 +178,6 @@ update() {
|
||||
|
||||
start() {
|
||||
update
|
||||
# Add List to host file.
|
||||
# Transform "mydomain.com" to "127.0.0.1 mydomain.com" except comments
|
||||
custom-sed "/^#/!s/^/127.0.0.1 /g" "$CONFIG$LIST" >> "$HOST_FILE"
|
||||
# Notify user
|
||||
echo "${COLOR_GREEN}ENABLED!${COLOR_RESET}"
|
||||
}
|
||||
|
Reference in New Issue
Block a user