Netwerk Adblocker

**Ik heb een netwerk adblocker geinstalleerd

Dit heb ik gedaan door middel van docker.
Hier kun meer lezen over pihole https://pi-hole.net/

Installeer docker en run onderstaand script en het word voor je geregeld
Pas het script wel aan naar je eigen wensen.**


#!/bin/bash
#Vul hier onder je ip-adres in en wijzig eventuele onderstaande poorten
IP="x.x.x.x"
P80="8081"
P443="4433"

# Vul hier onder de "installatie" locatie in of laat hem standaard op pwd staan.
DOCKER_CONFIGS="/opt/pihole"

echo "### Wees er zeker van dat dit: $IP je ip-adres is en dat dit een vast ip-adres is"

# standaard poorten + standaard docker container
docker run -d \
    --name pihole \
    -p 53:53/tcp -p 53:53/udp \
    -p 67:67/udp \
    -p $P80:80 \
    -p $P443:443 \
    -v "${DOCKER_CONFIGS}/pihole/:/etc/pihole/" \
    -v "${DOCKER_CONFIGS}/dnsmasq.d/:/etc/dnsmasq.d/" \
    -e ServerIP="$IP" \
    --restart=unless-stopped \
    pihole/pihole:latest

echo -n "Je wachtwoord voor http://$IP/admin/ is "
docker logs pihole 2> /dev/null | grep 'password:'


Wil je een wachtwoord hebben op je pihole?

Typ dan even dit commando : sudo docker exec pihole pihole -a -p jewachtwoordhier

**Ps Mocht exact kopiëren van het script niet werken pak hem dan hier : **http://paste.opensuse.org/60446681

En, hieronder de eerste ( engelse versie ) om op openSUSE zonder gebruik te maken van een terminal. Maak een script ‘pihole-docker-install.sh’ aan in de ~/bin van je gebruiker, met onderstaande inhoud. Maak middels Dolphin het script uitvoerbaar, en klik erop. Dolphin zal je vragen of je het wilt uitvoeren, bevestig dat. Daarna wijst het zich vanzelf. Vergeet niet de poorten in de firewall te openen, 53 tcp, 67 udp en de beide in het script gekozen poorten.


#!/bin/bash
# Name: 
# Description: Script to install and run a pihole server
# License: Creative Commons, shared copyright
# Current distros supported: openSUSE Leap, openSUSE Tumbleweed




# VARS here
VERSION=0.4
AUTHORS='Gertjan Lettink; Wesley Landaal'
COPYRIGHT='2018'
# END VARS


# FUNCTIONS
check_for_zenity()
{
	ZENITY_INSTALLED=$(which zenity)
	if  ! "$ZENITY_INSTALLED"] ; then
		xmessage "Zenity is not installed. \
			Please install before running the script." ;
		exit 4
	fi
}


# ask the user for the root password to make the 'sudo' commands work
get_sudo_password()
{
    PASSWD=$(zenity --password --title=Authentication --text="The script needs root permissions
Enter your root/sudo password" --width=600) ;


	if   ${?} != 0 || -z ${PASSWD} ]] ; then
    		exit 4
	fi
	if ! sudo -kSp ''  1 ] <<<${PASSWD} 2>/dev/null ; then
    		exit 4
	fi
}


# initial info screen
show_info()
{
    START_Y_N=$(zenity --question --text="This script will install and configure your own Pihole server
Version: $VERSION  AUTHORS: $AUTHORS  ©$COPYRIGHT" --width=600 && echo YES || echo NO) ;
if   "$START_Y_N" == "NO" ] ; then
        exit 1
        fi
}


# ask the user for the distro used
# Add your distro to DISTROS below if you want to extend the script with your own distro's commands
DISTROS="openSUSE"
get_os()
{
    OS=$(zenity --list --title="Linux Distro" --text="Pick your linux distro" --column="Distro" $DISTROS --width=600 --height=300)  ;	
}


# have the user confirm his distro to install on
confirm_os()
{
    OS_CONFIRM=$(zenity --question --text="$OS is the distro you entered

Sure this the correct one? " --width=600 && echo YES || echo NO) ;
    if   "$OS_CONFIRM" == "NO" ] ; then
            get_os
    fi
}


# announce install of dependencies and system preparation
prepare_system_msg()
{
	zenity --info --text="The script will now setup your system for the pihole server" --width=600 ;
	prepare_system 
}


# perform install of depencies and activate services
# Add your distro's routines here. 
prepare_system()
{	
    if  "$OS" == "openSUSE" ] ; then
	DOCKER_INSTALLED=$(rpm -qa | grep -i docker-[0-9]);
        if  "$DOCKER_INSTALLED" == "" ] ; then
	zenity --info --text="Docker packages will be installed now

This may take a minute" --width=600 ;
		sudo -Sp '' zypper install --no-confirm docker <<<${PASSWD} 
        fi
    fi
# Enter package install for other distros here


# See openSUSE example
	zenity --info --text="Docker packages installed" --width=600 ;
	start_docker
}


# start the docker service
start_docker()
{
	DOCKER_RUNNING=$(systemctl show -p SubState --value docker)
	DOCKER_ENABLED=$(systemctl is-enabled docker.service)
	if  ! "$DOCKER_ENABLED" == "enabled" ] ; then
		zenity --info --text="Enabling docker service" --width=600 ;
		sudo -Sp '' systemctl enable docker <<<${PASSWD}
		zenity --info --text="Starting docker service" --width=600 ;
		sudo -Sp '' systemctl start docker <<<${PASSWD}
	else
		if  "$DOCKER_RUNNING" == "running" ] ; then
			zenity --info --text="Docker service already enabled and running" --width=600;
		else
			zenity --info --text="Starting docker service" --width=600 ;
			sudo -Sp '' systemctl start docker <<<${PASSWD}
		fi
	fi
	zenity --info --text="Docker service now started

Starting configuration of your pihole server" --width=600 ;
}
# ask for the Pihole server IP address | could be picked from ip addr or something like that
get_ipaddress()
{
    GET_IP=$(hostname -I | cut -d' ' -f1)
    IP=$(zenity --entry --text="Enter the pihole IP Address" --entry-text=$GET_IP --width=600) ;
}


# have the user confirm the entered IP address
confirm_ipaddress()
{
    IP_CONFIRM=$(zenity --question --text="$IP is the IP you entered

Sure this the correct IP address? " --width=600 && echo YES || echo NO) ;
    if   "$IP_CONFIRM" == "NO" ] ; then
        get_ipaddress
	fi
}


# ask the user for the path to the pihole docker configs
get_docker_configs()
{
	DOCKER_CONFIGS=$(zenity --entry --text="Enter the path for you Pihole docker configs

Leave default if you don't know what you're changing" --entry-text="/opt/pihole" --width=600) ;
}


# have the user confirm the entered path for docker configs
confirm_docker_configs()
{
    DOCKER_CONFIGS_CONFIRM=$(zenity --question --text="$DOCKER_CONFIGS is the docker config path you entered

Sure this the docker config path you want to use? " --width=600 && echo YES || echo NO) ;
    if   "$DOCKER_CONFIGS_CONFIRM" == "NO" ] ; then
        get_docker_configs
	fi
}


# ask the user which port to access the pihole server for port 80
get_port_80()
{
    PORT_80=$(zenity --entry --text="Enter the port to access the pihole server through http

Leave default if you don't know what you're changing" --entry-text="8081" --width=600) ;
}


# have the user confirm the port to access the pihole server for port 80
confirm_port_80()
{
	PORT_80_CONFIRM=$(zenity --question --text="$PORT_80 is the port serving port 80 you entered

Sure this is the port you want to use? " --width=600 && echo YES || echo NO) ;
    if   "$PORT_80_CONFIRM" == "NO" ] ; then
        get_port_80
	fi
}


# ask the user which port to access the pihole server for port 443 
get_port_443()
{
    PORT_443=$(zenity --entry --text="Enter the port to access the pihole server through https

Leave default if you don't know what you're changing" --entry-text="4443" --width=600) ;
}


# have the user confirm the port to access the pihole server for port 443
confirm_port_443()
{
	PORT_443_CONFIRM=$(zenity --question --text="$PORT_443 is the port serving port 443 you entered

Sure this is the port you want to use? " --width=600 && echo YES || echo NO) ;
    if   "$PORT_443_CONFIRM" == "NO" ] ; then
        get_port_443
	fi
}


# have the user confirm all entered data
confirm_all()
{
    ALL_CONFIRM=$(zenity --question --text="Are you sure the following entries are correct?

IP Address: $IP
Docker configs: $DOCKER_CONFIGS
Port 80: served on $PORT_80
Port 443: served on $PORT_443

Click No if you're in doubt." --width=600 --width=600 && echo YES || echo NO)
    if   "$ALL_CONFIRM" == "NO" ] ; then
        show_info
    else
        start_docker_pihole
    fi
}


# start the docker container with provided data
start_docker_pihole()
{
    sudo -Sp '' docker run -d \
    --name pihole \
    -p 53:53/tcp -p 53:53/udp \
    -p 67:67/udp \
    -p $PORT_80:80 \
    -p $PORT_443:443 \
    -v "${DOCKER_CONFIGS}/pihole/:/etc/pihole/" \
    -v "${DOCKER_CONFIGS}/dnsmasq.d/:/etc/dnsmasq.d/" \
    -e ServerIP="$IP" \
    --restart=unless-stopped \
    pihole/pihole:latest <<<${PASSWD}; 
}


# show DONE and provide URL and password for admin access
show_done()
{
    DOCKER_PW=docker logs pihole 2> /dev/null | grep 'password:' ;
    zenity --info --text="Your password for http://$IP:$PORT_80/admin/ is $DOCKER_PW
Your password for https://$IP:$PORT_443/admin/ is $DOCKER_PW

Make sure you open ports 53, 67 udp, $PORT_80 and $PORT_443 in the firewall

To start using Pihole:
Change DNS 1 of your router or computer to $IPi
and reconnect your devices with the network" --width=600;
}
#END FUNCTIONS


#INSTALLER
check_for_zenity
show_info
get_os
confirm_os
get_sudo_password
prepare_system_msg
get_ipaddress
confirm_ipaddress
get_docker_configs
confirm_docker_configs
get_port_80
confirm_port_80
get_port_443
confirm_port_443
confirm_all
show_done
#END INSTALLER



En voor de liefhebbers:


git clone https://gitlab.com/knurpht/pihole-installer
cd pihole-installer
sh pihole-docker-install.sh

De rest wordt voor je gedaan. Binnenkort ook geschikt voor Debian ( en afgeleiden )

[QUOTE=ComputerSmurf;2879345]
#Vul hier onder je ip-adres in en wijzig eventuele onderstaande poorten
IP=“x.x.x.x”

Wat doe je wanneer je een VPN gebruikt en regelmatig een ander IP-adres krijgt? I.p.v. je adres in te typen in het script is het toch ook mogelijk om dit op te vragen wanneer je online bent. Ik gebruik zoiets in Conky en laat mijn extern IP-adres in verschillende kleuren zien zodat ik weet of de VPN actief is of niet.
De code in mijn Conky is:
{execi 5 curl -s www.icanhazip.com}

[quote="“De_Mus,post:4,topic:133394”]

Dit kun je niet doen als je VPN gebruikt en steeds een wisselend IP adres krijgt. Tenzij je bijv. een Raspberry Pi hebt die met je router verbonden is zonder VPN, met een vast IP adres. Dan kun je de poorten in je router firewall redirecten naar het IP van de Pi en daarop een pihole server draaien. Op de Pi zelf moet je dan 127.0.0.1 als eerste DNS gebruiken, voor het overige je externe IP ( dat je van je provider krijgt ). Hetzelfde probleem heb je overigens met een webserver achter VPN.

[quote="“De_Mus,post:4,topic:133394”]

Precies net wat Knurpht zegt,
In dit geval gaat het om een Pihole netwerk adbloker maar alles wat een server is zou in je netwerk toch echt een vast ip moeten hebben.

Maar dan nog een vraag die vpn verbinding is voor buitenaf neem ik aan?
Alleen je externe ip veranderd toch?
Dan moe je Pihole prima kunnen draaien op je netwerk.
Overigens het ipadres wat het pihole script aan je vraagt is je interne ip niet je externe ip

mvg
wesley

Laatste versie van het script, ondersteunt nu:

“openSUSE”
“Fedora”
“Red_Hat”
“CentOS”
“Debian”
“*buntu”
“Linux_Mint”
“PopOS”
“Raspbian”

Op
x86_64 ( desktops / laptops )
aarch64 ( o.a. Raspberry Pi3 )

Maakt
iptables rules aan om firewall poorten open te zetten
een volledige pihole configuratie

Directe download http://paste.opensuse.org/55166138
Maar beter:


git clone https://gitlab.com/knurpht/pihole-installer
cd pihole-installer

en daarna, om de laatste versie op te halen, naar de pihole-installer map gaan en


git pull

Veel plezier

but i am not sure because when i want use adblocker for whatstatus.co website. It didn’t working thoroughly. When i open my site the adblocker is not working and showing some error.

What the hell is this.

How can i fix this error? Any Help Plz…

Erg interesant !
Maar ik heb een paar vragen omdat deze topic nogal oud is…

  1. Werkt het nog steeds op een verse (huidige) Leap/TW?
  2. Maakt het gebruik van de laatste Pi-Hole versie?
  3. Is Tor ondersteuning ingebouwd?

Ik maakte zelf destijds gebruik van me localhost BIND server in combinatie met FoxyProxy op me oude OS, maar dit ziet erg beloved uit…