Skip to content
forked from hsand/pia-wg

A WireGuard configuration utility for Private Internet Access. Fork adds env vars and CLI arguments for use with automation

License

Notifications You must be signed in to change notification settings

TonyTwoStep/pia-wg

 
 

Repository files navigation

pia-wg

Modifications of this fork

Specify PIA credentials via env vars (optional)

  • PIA_USERNAME (the pia username)
  • PIA_PASSWORD (the pia password)

If these vars are not specified the program will fall back to the default behavior to get the credentials (user prompt)

CLI arguments for generate-config.py (optional)

  • --list or -l - list out the availble PIA servers to use in the generated config
  • --server or -s - specify a server to use when generating the config

If a server is not specified manually with -s the program will fall back to the default behavior of having you select a server from the list UI

Original README contents

A WireGuard configuration utility for Private Internet Access

This is a Python utility that generates WireGuard configuration files for the Private Internet Access VPN service. This allows you to take advantage of the WireGuard protocol without relying on PIA's proprietary client.

This was created by reverse engineering the manual-connections script released by PIA. At this stage, the tool is a quick and dirty attempt to get things working. It could break at any moment if PIA makes changes to their API.

pia-wg runs on both Windows and Linux.

Windows

  • Install the latest version of Python 3
    • Select "Add Python to environment variables"
  • Install WireGuard

Open a command prompt and navigate to the directory where you placed the pia-wg utility. The following commands will create a virtual Python environment, install the dependencies, and run the tool.

python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
generate-config.py

Follow the prompts. When finished, you can exit the virtual environment with the deactivate command.

The script should generate a .conf file that can be imported into the WireGuard utility.

Linux (Debian/Ubuntu)

Install dependencies, clone pia-wg project, and create a virual Python environment:

sudo apt install git python3-venv wireguard openresolv
git clone https://github.com/hsand/pia-wg.git
cd pia-wg
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Run the tool, and follow the prompts

python3 generate-config.py

Copy the .conf file to /etc/wireguard/, and start the interface

sudo cp PIA-Iceland-1605054556.conf /etc/wireguard/wg0.conf
sudo wg-quick up wg0

You can shut down the interface with sudo wg-quick down wg0

Check everything is working

Visit https://dnsleaktest.com/ to see your new IP and check for DNS leaks.

About

A WireGuard configuration utility for Private Internet Access. Fork adds env vars and CLI arguments for use with automation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 90.5%
  • Shell 9.5%