Private Internet Access (PIA) provides high quality and inexpensive VPN services, but installing VPN routes on linux can be tedious or require the installation of third party applets. The purpose of this repository is to host and maintain a configuration package that will automatically populate NetworkManager keyfiles for use with PIA OpenVPN service on various Linux distributions and to avoid the installation of any third party applets.
Install with pip install pypia
On first run, start with pypia -i
.
The pypia
package has been designed to automatically detect your operating system. Currently the supported distros are:
*For other distros, please see note at end of this README
System
General
PIA certificate, which is automatically downloaded by the script, is provided by PIA here. Route/VPN server information is downloaded from this page.
pip install pypia
Note: in some distros pip
points to python2. In those distros, it may be required to use pip3
or python3 -m pip
instead of plain pip
.
In some cases, pip installs packages to a user path. It may be required to add PATH=$PATH:~/.local/bin
to your ~/.bashrc
file to be able to invoke pypia
directly from the command line.pip
, you should do pypia -i
to initialize, which will configure the NetworkManager keyfiles. Root permissions are required to install dependencies via the package manager and to write the VPN config files to /etc/NetworkManager/system-connections/
, so you will be prompted to enter the root password.python3 pypia/pypia.py -i
to configure the keyfiles.If everything goes as intended, the VPN routes will be accessible from the VPN Connections menu in the NetworkManager applet or via the nmcli
command line tool.
usage: pypia [-h] [-i] [-p] [-s] [-r {us,all,int}] [-f] [-d]
optional arguments:
-h, --help show this help message and exit
-i, --initialize configure pia vpn routes as networkmanager keyfiles.
requires sudo priveleges. use this flag on first run
and anytime you want to refresh pia vpn routes
-p, --ping ping each vpn server and list latencies
-s, --shuffle connect to or shuffle a random vpn
-r {us,all,int}, --region {us,all,int}
"us" for US only, "int" for non-US, "all" for
worldwide
-f, --fastest connect to network with lowest ping latency
-d, --disconnect disconnect current PIA vpn connection
If your distribution of choice is not currently listed as supported, please take a minute to help me add support! To add it, I'll need to know:
network-manager-openvpn
package in your particular package manager. Usually searching the package database for "openvpn" is enough to find it.apt install
or dnf install
, etc.)get_distro()
function is:
import subprocess
def get_distro():
os_release = subprocess.check_output(['cat', '/etc/os-release']).decode('utf-8').splitlines()
os_dict = {i.split('=')[0]: i.split('=')[1].strip('"') for i in os_release if '=' in i}
distro = os_dict['ID'].lower()
return distro
get_distro()
With that information, I can update the package_info.json
file to include your distro. Or feel free to submit a pull request.
The python code in this project is distributed under GPLv3.
If you want to sign up for PIA, feel free to use my affiliate link. If you'd rather not use that link, no worries! This is free software that I hope you continue to use and enjoy.