Removed no longer needed local pivpn_install script since they fixed the infinite looping issue

This commit is contained in:
hamilcarBarca17
2023-02-17 13:19:32 -07:00
parent c7b188526c
commit bdf1c71913
4 changed files with 12 additions and 3712 deletions
+8 -3
View File
@@ -4,6 +4,8 @@ In order to have both VPNs running at once without them interfering with one ano
* PIA runs with OpenVPN
* PiVPN runs with WireGuard (default for PiVPN)
This repo uses modified version of the PIA VPN scripts found in the [pia-foss/manual-connections repo](https://github.com/pia-foss/manual-connections).
# Setup
## Prerequisites
@@ -19,13 +21,16 @@ password123!
```
## First Time Setup
1. Install PiVPN
1. Clone the repo into `/home/pi/pia-pivpn`
2. Install PiVPN
```shell
curl -L https://install.pivpn.io | bash
```
2. Copy `/etc/pivpn/wireguard/setupVars.conf` to your installation directory (`/home/pi/pia-pivpn/` by default)
3. Start PIA, port forwarding, and the PiVPN by running `./startup_vpn.sh`
2. Copy `/etc/pivpn/wireguard/setupVars.conf` to your installation directory
## Start the VPNs
Start PIA, port forwarding, and the PiVPN by running `./startup_vpn.sh`
4. Add the following lines to the `[Interface] section of the SERVER `/etc/wireguard/wg0.conf`:
```shell
PostUp = iptables -A FORWARD -i wg0 -j ACCEPT; iptables -A FORWARD -o wg0 -j ACCEPT; iptables -t nat -A POSTROUTING -o enp3s0 -j MASQUERADE;
-3700
View File
File diff suppressed because it is too large Load Diff
+2
View File
@@ -53,6 +53,7 @@ while :; do
if [[ -z $PIA_USER ]]; then
# echo
# read -r -p "PIA username (p#######): " PIA_USER
# TODO: Extract creds from lastpass
PIA_USER=$(cat /etc/openvpn/auth.txt | head -1)
fi
@@ -82,6 +83,7 @@ while :; do
# echo -n "PIA password: "
# read -r -s PIA_PASS
# echo
# TODO: Extract creds from lastpass
PIA_PASS=$(cat /etc/openvpn/auth.txt | tail -1)
fi
+2 -9
View File
@@ -1,11 +1,8 @@
#!/bin/bash
declare ntfyTopic=atusa_061796_pihole
curl -H "t: Resetting VPN" -H "p:5" -H "ta:warning" -d "PiHole VPN connection expired. Resetting both VPNs. PiVPN reconfigure is required." ntfy.sh/$ntfyTopic
pkill -f openvpn > /dev/null 2>&1
pkill -f port_forwarding > /dev/null 2>&1
declare portFile=/home/pi/pf_port
declare portFile=/home/pi/pia-pivpn/pf_port
[[ -f $portFile ]] && rm $portFile
./run_setup.sh
@@ -18,19 +15,15 @@ done
declare port=$(cat $portFile | head -1)
declare gateway=$(ip route | grep tun | awk '/^0.0.0.0*/ { print $3;}')
declare host=$(curl -s api.ipify.org)
declare expiration=$(cat $portFile | tail -1)
declare expirationDayEpoch=$(echo $expiration | xargs -i date -d {} +%m/%d/%Y | xargs -i date -d {} +%s)
declare setupVarsFile=/home/pi/pia-pivpn/setupVars.conf
curl -H "t: Port Forwarding Expires Today" -H "p:5" -H "ta:warning" -H "Delay: $expirationDayEpoch" -d "PiHole port forwarding expires at $expiration. The connection will be reset at this time and you'll need to ssh into your pihole to connect devices to PiVPN again." ntfy.sh/$ntfyTopic
sed -i "/pivpnPORT=/c\pivpnPORT=$port" $setupVarsFile
sed -i "/IPv4gw=/c\IPv4gw=$gateway" $setupVarsFile
sed -i "/pivpnHOST=/c\pivpnHOST=$host" $setupVarsFile
declare -a users=( $(pivpn -l | grep -v ':::\|Client' | awk '{print $1;}') )
/home/pi/pivpn/pivpn_install.sh --reconfigure --unattended /home/pi/pia-pivpn/setupVars.conf
curl -L https://install.pivpn.io | bash -s -- --reconfigure --unattended /home/pi/pia-pivpn/setupVars.conf
for user in ${users[@]}; do
pivpn -a -n $user