Removed no longer needed local pivpn_install script since they fixed the infinite looping issue
This commit is contained in:
@@ -4,6 +4,8 @@ In order to have both VPNs running at once without them interfering with one ano
|
|||||||
* PIA runs with OpenVPN
|
* PIA runs with OpenVPN
|
||||||
* PiVPN runs with WireGuard (default for PiVPN)
|
* 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
|
# Setup
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
@@ -19,13 +21,16 @@ password123!
|
|||||||
```
|
```
|
||||||
|
|
||||||
## First Time Setup
|
## First Time Setup
|
||||||
1. Install PiVPN
|
1. Clone the repo into `/home/pi/pia-pivpn`
|
||||||
|
2. Install PiVPN
|
||||||
```shell
|
```shell
|
||||||
curl -L https://install.pivpn.io | bash
|
curl -L https://install.pivpn.io | bash
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Copy `/etc/pivpn/wireguard/setupVars.conf` to your installation directory (`/home/pi/pia-pivpn/` by default)
|
2. Copy `/etc/pivpn/wireguard/setupVars.conf` to your installation directory
|
||||||
3. Start PIA, port forwarding, and the PiVPN by running `./startup_vpn.sh`
|
|
||||||
|
## 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`:
|
4. Add the following lines to the `[Interface] section of the SERVER `/etc/wireguard/wg0.conf`:
|
||||||
```shell
|
```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;
|
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
File diff suppressed because it is too large
Load Diff
@@ -53,6 +53,7 @@ while :; do
|
|||||||
if [[ -z $PIA_USER ]]; then
|
if [[ -z $PIA_USER ]]; then
|
||||||
# echo
|
# echo
|
||||||
# read -r -p "PIA username (p#######): " PIA_USER
|
# read -r -p "PIA username (p#######): " PIA_USER
|
||||||
|
# TODO: Extract creds from lastpass
|
||||||
PIA_USER=$(cat /etc/openvpn/auth.txt | head -1)
|
PIA_USER=$(cat /etc/openvpn/auth.txt | head -1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -82,6 +83,7 @@ while :; do
|
|||||||
# echo -n "PIA password: "
|
# echo -n "PIA password: "
|
||||||
# read -r -s PIA_PASS
|
# read -r -s PIA_PASS
|
||||||
# echo
|
# echo
|
||||||
|
# TODO: Extract creds from lastpass
|
||||||
PIA_PASS=$(cat /etc/openvpn/auth.txt | tail -1)
|
PIA_PASS=$(cat /etc/openvpn/auth.txt | tail -1)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
+2
-9
@@ -1,11 +1,8 @@
|
|||||||
#!/bin/bash
|
#!/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 openvpn > /dev/null 2>&1
|
||||||
pkill -f port_forwarding > /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
|
[[ -f $portFile ]] && rm $portFile
|
||||||
|
|
||||||
./run_setup.sh
|
./run_setup.sh
|
||||||
@@ -18,19 +15,15 @@ done
|
|||||||
declare port=$(cat $portFile | head -1)
|
declare port=$(cat $portFile | head -1)
|
||||||
declare gateway=$(ip route | grep tun | awk '/^0.0.0.0*/ { print $3;}')
|
declare gateway=$(ip route | grep tun | awk '/^0.0.0.0*/ { print $3;}')
|
||||||
declare host=$(curl -s api.ipify.org)
|
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
|
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 "/pivpnPORT=/c\pivpnPORT=$port" $setupVarsFile
|
||||||
sed -i "/IPv4gw=/c\IPv4gw=$gateway" $setupVarsFile
|
sed -i "/IPv4gw=/c\IPv4gw=$gateway" $setupVarsFile
|
||||||
sed -i "/pivpnHOST=/c\pivpnHOST=$host" $setupVarsFile
|
sed -i "/pivpnHOST=/c\pivpnHOST=$host" $setupVarsFile
|
||||||
|
|
||||||
declare -a users=( $(pivpn -l | grep -v ':::\|Client' | awk '{print $1;}') )
|
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
|
for user in ${users[@]}; do
|
||||||
pivpn -a -n $user
|
pivpn -a -n $user
|
||||||
|
|||||||
Reference in New Issue
Block a user