This project aims to provide a basic set of networking tools. Docker is used as much as possible. It's intended as a "set and forget" - a pihole which can be left at a non-technical friend or family member network.
- Stability
- Remote management
- Run on minimal hardware, such as a RaspberryPi Zero
- set up timezone, wifi
- Set up the Hostname:
sudo raspi-config
> System Options > Hostname sudo apt update && sudo apt upgrade
- Install dig for troubleshooting:
sudo apt-get install dnsutils
- Move to a download folder:
cd ~/Downloads
- Copy Docker's installation script to this directory:
curl -fsSL https://get.docker.com -o get-docker.sh
- Run the installation script:
sudo sh get-docker.sh
- Copy Docker's installation script to this directory:
- Add your Users to the docker group:
sudo usermod -aG docker pi
- Restart the sytem
- Validate:
docker version
- Test:
docker run hello-world
sudo apt install git
git config --global user.name "your name"
git config --global user.email "[email protected]"
cd ~
git clone https://github.com/jgwehr/network-docker.git network-docker
Stores the local contents in a directory namedDocker
mkdir -p /srv/config/{unbound,fail2ban,pihole/{dnsmasq.d,pihole}}
sudo chown -R $USER:$USER /srv
- Copy Unbound Files:
cp staticconfig/unbound/a-records.conf /srv/config/unbound/
- Copy Unbound Files:
cp staticconfig/unbound/unbound.conf /srv/config/unbound/
- Copy Fail2Ban Files:
cp staticconfig/fail2ban/jail.local /srv/config/fail2ban/fail2ban/
- You can safely leave all PORT variables as they are. But it's suggested you change
PORT_VPN
- Provide
DUCKDNS_SUBDOMAINLIST
andDUCKDNS_TOKEN
via duckdns.org. This is a free DDNS. - While your at it, the subdomain you provided for
DUCKDNS_SUBDOMAINLIST
is also used forWG_SERVERURL
. If you're SUBDOMAINTLIST is "foo" thenWG_SERVERURL
should be "foo.duckdns.org" - Give a secure password for
PIHOLE_PASSWORD
- The rest of the pihole variables are unncessary unless you're using DHCP
- Wireguard:
WG_PEERS
Provision the number of clients (eg.3
) or specific named clients (eg.myPC,myPhone,myTablet
) - Local network accessed via VPN:
WG_ALLOWED_IPS
Wireguard allow split tunnelling. Default is to send all traffic through this connection. I recommend changing this to your local network (eg. 192.168.0.0/24) so that only "local" traffic is sent to the vpn.
docker network create -d bridge --subnet 172.20.0.0/16 dns-net
Done through Wireguard
- Wireguard will automatically create configurations when the container starts.
- You can get the QR codes using
docker logs --follow wireguard
. Alternatively, these files are located at/srv/config/wireguard/<peer>
when using the default .env - Get the necessary Wireguard client https://www.wireguard.com/install/
- Follow Wireguard's instructions. Generally speaking, you'll need a peer/client configuration from this server. Easily done on your phone via QR code. Or, on a computer, by copying a
*.conf
file from the server to the client.
via https://linuxhandbook.com/ssh-hardening-tips/
- Create a new SSH Group for approved users:
sudo groupadd -g 1022 ssh_allowed
- Add your primary SSH User to this group:
sudo usermod -a -G ssh_allowed pi
- Open SSHD Config:
sudo nano /etc/ssh/sshd_config
- Disable empty passwords:
PermitEmptyPasswords no
- Change default SSH ports:
Port 2345
- Prevent root login:
PermitRootLogin no
- Limit active sessions:
MaxSessions 4
- Configure idle timeout interval:
ClientAliveInterval 300
- Configure how many times it sends the alive message before disconnecting:
ClientAliveCountMax 2
- Configure Allowed Groups:
AllowGroups ssh_allowed
- Disable X11 Forwarding:
X11Forwarding no
- Disable empty passwords:
- After the change, you will need to restart the sshd service using
sudo systemctl restart ssh
or rebooting.
credit to https://github.com/willy-wagtail/raspberrypi
To properly shutdown, run sudo shutdown -h now
.
Run the command /usr/bin/tvservice -o
to disable HDMI. Also run sudo nano /etc/rc.local
and add the command there too in order to disable HDMI on boot.
(To enable again, run /usr/bin/tvservice -p
, and remove from /etc/rc.local).
Run sudo apt update
, then sudo apt full-upgrade -y
, and finally sudo apt clean
to clean up the downloaded package files.