Git Product home page Git Product logo

piadvanced's Introduction

piadvanced

NOTICE

This script needs more of my attention, as some packages are broken.

Using this script may break things.

I am doing a complete rewrite

Thanks to the people of pihole-discourse and reddit. This is just a collection of other people's work in a nice package. I do not claim credit for anything other than creating this series of scripts.

  • This is a custom install for my pi! I am a tinkerer, and when I tinker, I tend to break things!!!
  • I started this as a much simpler script to help assist me in getting things back up and running as fast as possible.
  • A few of these things are easily done with raspi-config,, but this streamlines the process.
  • I am not a programmer, but I know enough to get into trouble.
With some tweaking could work on debian devices that aren't raspberry pi's

I will be updating this with new stuff all the time. you can always run git pull the /etc/piadvanced to download any changes.

If you are concerned about renaming the pi user for security reasons,

https://github.com/deathbybandaid/replace-default-pi-user

Instructions

sudo git clone https://github.com/deathbybandaid/piadvanced.git /etc/piadvanced/

The main script

sudo bash /etc/piadvanced/extendedinstall.sh

Enjoy

Here is what this half MB bad boy does:

This install:

  • Will ask you many yes/no questions. If you don't want to install something, simply say NO!
  • Is set up like "modules" I plan on adding more pi projects to it later. If it can be automated, it should go here. Message me if you have any reccomendations to add.

I suggest that you use the removedefaultpiuser script below. This will bolster your pi's security by not using the default username.

Makes backups of many of the default configuration files.

  • You can find the backups in /etc/piadvanced/backups

Configures a strong firewall using iptables.

  • This is based on what you choose to install.
  • All traffic to the pi is blocked unless there is a rule that allows the traffic.
    • Rules can be added/removed with sudo /etc/iptables.firewall.rules

Some basic settings:

Set the time

  • Set the timezone
  • Change your NTP servers
  • Add a script to update the time every half hour.

SSH

  • on/off
  • fail2ban
    • Helps protect against brute-force attempts.
    • Configure for other services by sudo nano /etc/fail2ban/jail.conf
  • psad

Random Number Fix with rng-tools

  • Greatly helps when the system needs to randomize something.

Memory

  • Set the memory split.
  • Use an experimental tweak to unlock 16MB of ram on the pi2 or pi3.

Network interfaces

  • Set the hostname
  • Set a static ip for eth0
  • Connect to wifi easily
  • Set a static ip for wlan0

MOTD tweak

Get's your system up to date

Adds sources for debian stretch

Updates and Upgrades

Installs some basic programs and dependencies.

(if curious what it installs, look at the script files)

Admin Mail

Handy if you want to get email from your device when things happen, or you need updates.

  • Apticron
  • Mailutils
  • Exim4

Dynamic Domain Name Services

  • No-IP DUC (Dynamic Update Client)
  • DDClient, which I believe works with dyndns

VPN

  • Port 1194 defualt
  • OpenVPN
  • piVPN

Administration Web UI's

  • Webmin
    • Port 10000
  • Usermin
    • Port 20000
  • Rpi Monitor
    • Port 8889

xRDP

  • This let's you remote-in to your pi, using the Windows native Remote Desktop program.
    • I have found this handy when fail2ban locks me out due to invalid password attempts.

DNSMasq

  • Gives the option to use the version 2.77test4.

DNSCrypt

This is fully functional, and works!

Pi-Hole

  • https://pi-hole.net/
  • Asks you to change the password for the webui immediately.
  • A dark theme, thanks to LKD70
  • The Wally3k adlists.
    • Configure this with sudo nano /etc/pihole/adlists.list
  • The Wally3k Block Page
  • The ability to bypass by mac address.
    • Configure with sudo nano /etc/dnsmasq.d/04-bypass.conf
  • The ability to add additional interfaces to allow dnsmasq to listen on.
    • Configure with sudo nano /etc/dnsmasq.d/05-addint.conf
  • The ability to add your Windows Active-Directory DNS.
    • Configure with sudo nano /etc/dnsmasq.d/06-activedirectory.conf
  • The ability to add custom redirects.
    • Configure with sudo nano /etc/dnsmasq.d/07-customredirect.conf
    • and /etc/piadvanced/installscripts/customRedirect.list
  • The ability to set permanent static ip's. Helpful if your re-install often
    • Configure with sudo nano /etc/dnsmasq.d/08-staticip.conf
  • The ability to block a mac address from recieving an IP address.
    • Configure with sudo nano /etc/dnsmasq.d/09-noip4you.conf
  • The ability to make pihole -up run every half-hour.
  • The ability to make pihole -g run every 6 hours.
  • The ability to remove stale lists once weekly.
  • A way to Parse lists not compatible with Pihole.
    • Configure this with sudo nano /etc/piadvanced/piholetweaks/ublockpihole/lists.lst
  • A Second way to parse lists.
    • Configure with sudo nano /var/www/html/admin/parser.php
  • A way to tweet daily blockings.  * Configure this with sudo nano /etc/piadvanced/piholetweaks/piholetweeter.py
  • Recieve a daily email with your stats.
  • HenningVanRaumle's Youtube Adblock List

Webservers

With the webservers, you can set the ip address and ports to listen on. This helps with port conflict issues.

  • Lightttpd
  • Apache
  • Nginx
    • I have stuff in the works for nginx, stay tuned.

Guacamole

Proxy programs

  • These have the potential of being setup to function transparently alongside pihole.
  • Privoxy
  • Squid/Squidguard

CUPS

Grafana

  • Untested Install, should be sweet for data monitoring and stuff.

phpmyadmin

Nagios

AtoMiC-ToolKit

Dplatform

HASS

  • See https://github.com/home-assistant/fabric-home-assistant for details.
  • I had to cobble the installation a bit to make sure dependencies worked.
  • I also have it set to remove the reboot instruction from their install script.
  • I can't guarantee success on this one, my success has been hit or miss.

Things in the works:

  • Steam Cache
  • PXE Server
  • Nagios
  • OpenVAS
  • ShellinaBox
  • Plexboard
  • A wake-on-lan solution
  • Samba share
  • A script that makes regular backups to a directory with date/time stamps. maybe weekly.
  • Cerbot Let's Encrypt
  • Setting up / mounting a usb device for permanent storage.
  • Email server
  • A way to load in a pihole teleport.

piadvanced's People

Contributors

deathbybandaid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

piadvanced's Issues

ublock.sh and youtube-ads.sh script error

ublock.sh

Just simple adding cd path/to/folder fixed the problem.
In the bash code I added the following lines:

#!/bin/bash
cd ..
cd /etc/piadvanced/piholetweaks/ublockpihole
sudo rm /var/www/html/admin/ublock.txt
for source in `cat lists.lst`; do
    echo $source;
    sudo curl --silent $source >> ads.txt
    echo -e "\t`wc -l ads.txt | cut -d " " -f 1` lines downloaded"
done

echo -e "\nFiltering non-url content..."
sudo perl easylist.pl ads.txt > ads_parsed.txt
sudo rm ads.txt
echo -e "\t`wc -l ads_parsed.txt | cut -d " " -f 1` lines after parsing"

echo -e "\nRemoving duplicates..."
sort -u ads_parsed.txt > ads_unique.txt
sudo rm ads_parsed.txt
echo -e "\t`wc -l ads_unique.txt | cut -d " " -f 1` lines after deduping"

sudo cat ads_unique.txt >> /var/www/html/admin/ublock.txt
sudo rm ads_unique.txt

See below for the full error message!

sudo bash /etc/piadvanced/piholetweaks/ublockpihole/ublockpihole.sh
rm: cannot remove ‘/var/www/html/admin/ublock.txt’: No such file or directory
cat: lists.lst: No such file or directory

Filtering non-url content...
Can't open perl script "easylist.pl": No such file or directory
rm: cannot remove ‘ads.txt’: No such file or directory
	0 lines after parsing

Removing duplicates...
	0 lines after dedupin

youtube-ads.sh

In the script you referred a folder within youtubeadblock. I fixed it the lazy way by making a new folder and copy/paste the content. After that I adjusted 2 lines in your code.
/etc/piadvanced/piholetweaks/youtubeadblock/youtubeadblock

adjusted script

#!/bin/bash
cd ..
cd /etc/piadvanced/piholetweaks/youtubeadblock
## Youtube adblocking
sudo rm /var/www/html/admin/youtube.txt
sudo rm /etc/piadvanced/piholetweaks/youtubeadblock/youtubeadblock/youtube-domains.txt
sudo rm /etc/piadvanced/piholetweaks/youtubeadblock/youtubeadblock/youtube-filtered.txt
sudo rm /etc/piadvanced/piholetweaks/youtubeadblock/youtubeadblock/youtube-ads.txt
sudo python /etc/piadvanced/piholetweaks/youtubeadblock/youtubeadblock/API_example.py > /etc/piadvanced/piholetweaks/youtubeadblock/youtubeadblock/youtube-domains.txt
sudo grep "^r" /etc/piadvanced/piholetweaks/youtubeadblock/youtubeadblock/youtube-domains.txt > /etc/piadvanced/piholetweaks/youtubeadblock/youtubeadblock/youtube-filtered.txt
sudo sed 's/\s.*$//' /etc/piadvanced/piholetweaks/youtubeadblock/youtubeadblock/youtube-filtered.txt > /etc/piadvanced/piholetweaks/youtubeadblock/youtubeadblock/youtube-ads.txt
sudo cp /etc/piadvanced/piholetweaks/youtubeadblock/youtubeadblock/youtube-ads.txt /var/www/html/admin/youtube.txt
#greps the log for youtube ads and appends to /var/www/html/admin/youtube.txt
sudo grep r*.googlevideo.com /var/log/pihole.log | awk '{print $6}'| grep -v '^googlevideo.com\|redirector' | sort -nr | uniq >> /var/www/html/admin/youtube.txt
#removes duplicate lines from /var/www/html/youtube.txt
sudo perl -i -ne 'print if ! $x{$_}++' /var/www/html/admin/youtube.txt
#updates pihole blacklist/whitelist
#pihole -g

pihole-bypass causing dnsmasq/pihole not to run

On line 55 of pihole.sh, 04-bypass.conf is wget'd. On line 22 of that conf,
dhcp-host=MA:CA:DD:R:ES:SS,set:YOURTAGHERE is uncommented and none of the scripts try to setup it up.

When dnsmasq (and by extension pihole) attempts to run, it errors out due to the bad hex value.

I think the easiest fix would be to comment out line 22 of 04-bypass.conf

Pihole '04-bypass.conf' backup DNS

Hey,
I'm successfully using https://github.com/deathbybandaid/piadvanced/blob/master/piholetweaks/dnsmasqtweaks/04-bypass.conf with my Pihole, however, I am unable to add a secondary DNS (This, of course, may just be my lack of knowledge).
With the DNS, in this case, I am using google's one, you should add both '8.8.8.8' and '8.8.4.4' to a device but dhcp-option=tag:googledns1,6,8.8.8.8 only adds '8.8.8.8' to the device.
Is there any way I can add the '8.8.4.4' to it as well?

I've tried things such as dhcp-option=tag:googledns1,6,8.8.8.8,8.8.4.4 and
dhcp-host=MACADDRESSHERE,set:googledns1,googledns2 where 'googledns2' would have '8.8.4.4', but I've had no success.

Is there any way I can achieve this?

Hopefully this all made sense,
Thanks.

Recommendation/Request

You should check out algo as it's not so different from what you're trying to accomplish (although smaller in scope). It would be cool if your script had the option to install wireguard and unbound so that people could do a wireguard + Pihole + unbound combo and host their own VPN with an adblocking recursive DNS.

Per device DNS settings

https://github.com/deathbybandaid/piadvanced/blob/master/piholetweaks/dnsmasqtweaks/04-bypass.conf

I tried using this but I am finding that the target device is still using pi-hole as the DNS rather than google. I do not have pi-hole configured to assign devices IP addresses (router does that). Is that the reason why it fails? My goal is to allow certain devices to be unprotected by pihole.

Thank you.

dhcp-option=tag:googlesdns1,6,8.8.8.8
dhcp-option=tag:googlesdns2,6,8.8.4.4
dhcp-host=c2:15:ef:16:a5:ba,set:googlesdns1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.