Skip to content

Instantly share code, notes, and snippets.

Last active Feb 16, 2019
What would you like to do?
Private Internet Access PPTP VPN Profile Script
## This script requires jq
if ! [ -x "$(command -v jq)" ]; then
echo 'Error: jq is not installed.' >&2
exit 1
echo -n "PIA pptp username (xNNNNNNN not pNNNNNNN): "
read pia_username
if [ -z "$pia_username" ]; then
error "Username is required, aborting."
echo -n "PIA pptp password: "
read pia_password
if [ -z "$pia_password" ]; then
error "Password is required, aborting."
servers_json=$(curl -Ss "" | head -1| jq -S 'del(.info)')
servers=(`echo $servers_json | jq -S '.[].dns'`)
for i in "${servers[@]}"
gateway=$(echo $i | sed 's/"//g')
name="pia-$(echo $gateway | cut -d . -f1)"
echo "Creating $name with gateway of $gateway"
## Create nmcli VPN profile
sudo nmcli con add type vpn ifname '*' vpn-type pptp -- $name connection.autoconnect no ipv6.method ignore vpn.secrets "password = $pia_password" "password-flags = 0, user = $pia_username, require-mppe = yes, gateway = $gateway"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment