Compare commits

..

10 Commits

Author SHA1 Message Date
32747144b7 Update README.md 2024-12-23 14:00:22 +01:00
9c3d08e8ee Update README.md 2024-12-23 13:59:07 +01:00
8405aa6edc Update README.md 2024-12-23 13:57:51 +01:00
61568c57ec Update README.md 2024-12-13 10:53:32 +01:00
e32584b978 Update README.md 2024-11-28 11:29:10 +01:00
b2a4d7217b Update index 2024-11-13 09:18:58 +01:00
3bbb0fe23a Add test 2024-11-13 09:18:18 +01:00
ac9fe2a3df Update 2024-10-27 21:37:52 +01:00
19ede6d147 Add docker 2024-10-27 16:29:07 +01:00
a592716528 Fix: https://github.com/tanrax/maza-ad-blocking/issues/27 2024-08-19 20:54:48 +02:00
5 changed files with 107 additions and 13 deletions

View File

@ -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
@ -349,12 +372,16 @@ ssh customer@andros.dev -p 5555
## 💬 Get Help or talk with the community
[Jabber/XMPP](xmpp:maza-ad-blocking@groups.im.andros.dev/?join)
- [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
View 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
View 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
View 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
View File

@ -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}"
}