mirror of
https://github.com/pia-foss/manual-connections.git
synced 2025-02-05 14:08:29 +00:00
parent
3e2091e009
commit
7a76a24a76
|
@ -36,7 +36,7 @@ The functionality of the scripts within this repository has been tested and conf
|
|||
|
||||
## PIA Port Forwarding
|
||||
|
||||
The PIA Port Forwarding service (a.k.a. PF) allows you run services on your own devices, and expose them to the internet by using the PIA VPN Network. The easiest way to set this up is by using a native PIA aplications. In case you require port forwarding on native clients, please follow this documentation in order to enable port forwarding for your VPN connection.
|
||||
The PIA Port Forwarding service (a.k.a. PF) allows you run services on your own devices, and expose them to the internet by using the PIA VPN Network. The easiest way to set this up is by using a native PIA aplication. In case you require port forwarding on native clients, please follow this documentation in order to enable port forwarding for your VPN connection.
|
||||
|
||||
This service can be used only AFTER establishing a VPN connection.
|
||||
|
||||
|
@ -54,7 +54,7 @@ Here is a list of scripts you could find useful:
|
|||
|
||||
To use port forwarding on the NextGen network, first of all establish a connection with your favorite protocol. After this, you will need to find the private IP of the gateway you are connected to. In case you are WireGuard, the gateway will be part of the JSON response you get from the server, as you can see in the [bash script](https://github.com/pia-foss/manual-connections/blob/master/wireguard_and_pf.sh#L119). In case you are using OpenVPN, you can find the gateway by checking the routing table with `ip route s t all`.
|
||||
|
||||
After connecting and finding out what the gateway is, get your payload and your signature by calling `getSignature` via HTTPS on port 19999. You will have to add your token as a GET var to proove you actually have an active account.
|
||||
After connecting and finding out what the gateway is, get your payload and your signature by calling `getSignature` via HTTPS on port 19999. You will have to add your token as a GET var to prove you actually have an active account.
|
||||
|
||||
Example:
|
||||
```bash
|
||||
|
|
|
@ -34,7 +34,7 @@ check_tool curl
|
|||
check_tool jq
|
||||
check_tool openvpn
|
||||
|
||||
# Check if manual PIA OpenVPN connection is alread intitialized.
|
||||
# Check if manual PIA OpenVPN connection is already initialized.
|
||||
# Multi-hop is out of the scope of this repo, but you should be able to
|
||||
# get multi-hop running with both OpenVPN and WireGuard.
|
||||
adapter_check="$( ip a s tun06 )"
|
||||
|
@ -158,7 +158,7 @@ fi
|
|||
# Start the OpenVPN interface.
|
||||
# If something failed, stop this script.
|
||||
# If you get DNS errors because you miss some packages,
|
||||
# just can hardcode /etc/resolv.conf to "nameserver 10.0.0.242".
|
||||
# just hardcode /etc/resolv.conf to "nameserver 10.0.0.242".
|
||||
#rm -f /opt/piavpn-manual/debug_info
|
||||
echo "
|
||||
Trying to start the OpenVPN connection..."
|
||||
|
@ -172,8 +172,8 @@ The OpenVPN connect command was issued.
|
|||
|
||||
Confirming OpenVPN connection state... "
|
||||
|
||||
# Check if manual PIA OpenVPN connection is intitialized.
|
||||
# Manually adjust the connectino_wait_time if needed
|
||||
# Check if manual PIA OpenVPN connection is initialized.
|
||||
# Manually adjust the connection_wait_time if needed
|
||||
connection_wait_time=10
|
||||
confirmation="Initialization Sequence Complete"
|
||||
for (( timeout=0; timeout <=$connection_wait_time; timeout++ ))
|
||||
|
|
|
@ -126,7 +126,7 @@ echo OK!
|
|||
# Start the WireGuard interface.
|
||||
# If something failed, stop this script.
|
||||
# If you get DNS errors because you miss some packages,
|
||||
# just can hardcode /etc/resolv.conf to "nameserver 10.0.0.242".
|
||||
# just hardcode /etc/resolv.conf to "nameserver 10.0.0.242".
|
||||
echo
|
||||
echo Trying to create the wireguard interface...
|
||||
wg-quick up pia || exit 1
|
||||
|
|
|
@ -35,7 +35,7 @@ check_tool curl curl
|
|||
check_tool jq jq
|
||||
|
||||
# This allows you to set the maximum allowed latency in seconds.
|
||||
# All servers that repond slower than this will be ignored.
|
||||
# All servers that respond slower than this will be ignored.
|
||||
# You can inject this with the environment variable MAX_LATENCY.
|
||||
# The default value is 50 milliseconds.
|
||||
MAX_LATENCY=${MAX_LATENCY:-0.05}
|
||||
|
@ -63,11 +63,11 @@ printServerLatency() {
|
|||
export -f printServerLatency
|
||||
|
||||
echo -n "Getting the server list... "
|
||||
# Get all region data since we will need this on multiple ocasions
|
||||
# Get all region data since we will need this on multiple occasions
|
||||
all_region_data=$(curl -s "$serverlist_url" | head -1)
|
||||
|
||||
# If the server list has less than 1000 characters, it means curl failed.
|
||||
if [[ ${#all_region_data} < 1000 ]]; then
|
||||
if [[ ${#all_region_data} -lt 1000 ]]; then
|
||||
echo "Could not get correct region data. To debug this, run:"
|
||||
echo "$ curl -v $serverlist_url"
|
||||
echo "If it works, you will get a huge JSON as a response."
|
||||
|
|
|
@ -80,7 +80,7 @@ fi
|
|||
signature="$(echo "$payload_and_signature" | jq -r '.signature')"
|
||||
|
||||
# The payload has a base64 format. We need to extract it from the
|
||||
# previous reponse and also get the following information out:
|
||||
# previous response and also get the following information out:
|
||||
# - port: This is the port you got access to
|
||||
# - expires_at: this is the date+time when the port expires
|
||||
payload="$(echo "$payload_and_signature" | jq -r '.payload')"
|
||||
|
|
|
@ -82,7 +82,7 @@ export PIA_AUTOCONNECT
|
|||
echo PIA_AUTOCONNECT=$PIA_AUTOCONNECT"
|
||||
"
|
||||
|
||||
# Check for the required presence of resolvconf for settnig DNS on wireguard connections.
|
||||
# Check for the required presence of resolvconf for setting DNS on wireguard connections.
|
||||
setDNS="yes"
|
||||
if ! command -v resolvconf &>/dev/null && [ "$PIA_AUTOCONNECT" == wireguard ]; then
|
||||
echo The resolvconf package could not be found.
|
||||
|
@ -99,11 +99,6 @@ if [ "$setDNS" != no ]; then
|
|||
echo
|
||||
fi
|
||||
|
||||
PIA_DNS="true"
|
||||
if echo ${setDNS:0:1} | grep -iq n; then
|
||||
PIA_DNS="false"
|
||||
fi
|
||||
|
||||
PIA_DNS="true"
|
||||
if echo ${setDNS:0:1} | grep -iq n; then
|
||||
PIA_DNS="false"
|
||||
|
@ -124,7 +119,7 @@ export PIA_PF
|
|||
echo PIA_PF=$PIA_PF
|
||||
|
||||
# Set this to the maximum allowed latency in seconds.
|
||||
# All servers that repond slower than this will be ignored.
|
||||
# All servers that respond slower than this will be ignored.
|
||||
echo -n "
|
||||
With no input, the maximum allowed latency will be set to 0.05s (50ms).
|
||||
If your connection has high latency, you may need to increase this value.
|
||||
|
|
Loading…
Reference in New Issue
Block a user