These are a collection of bash scripts to use the Private Internet Access OpenVPN based VPN with a systemd based linux system. They also modify firewall rules (via ufw
) to channel traffic solely through the VPN interface to prevent leaking information.
Note: These have been retired in favor of the fork of the Private Internet Access Wireguard based scripts located here: https://github.com/retrontology/manual-connections
jq
openvpn
ufw
dig
systemd
(optional)
- Download the
.ovpn
file collection you wish to use from https://helpdesk.privateinternetaccess.com/kb/articles/where-can-i-find-your-ovpn-files - Extract the archive and rename all the
.ovpn
files with the.conf
extension:for i in *.ovpn; do mv "$i" "${i%%ovpn}conf"; done
- Copy all the
.conf
files from the step above to the/etc/openvpn/client/
directory - Note down the configuration file you wish to use for further setup
The script that starts the VPN connection, enables the firewall to prevent leaks, and start up systemd services you want to channel through the VPN.
- Change the variables at the beginning of the script to reflect your setup
- Modify the
systemctl
commands to start the services you want to run through the VPN (optional) - Modify the
systemctl <start/enable> openvpn-client@<config>
lines to use the config you've picked out - Comment or remove the
./port_forwarding.sh
line if you don't want to use port forwarding for Transmission
./vpnks-start.sh
A script that requests port forwarding from PIA and configures Transmission to use the forwarded port
Change the variables at the beginning of the script to reflect your Transmission setup
./port_forwarding.sh
The script that stops the VPN connection, tears down the firewall, and stops the sytemd services you want to channel through the VPN.
- Modify the
systemctl
commands to stop the services you want to run through the VPN (optional) - Modify the
systemctl <stop/disable> openvpn-client@<config>
lines to use the config you've picked out
./vpnks-stop.sh
This is a script designed to change the VPN server you are connecting to within the same region. It's handy for when the server you are currently using is bogged down with traffic from other people.
- Change the
vpnadd
variable to the url of the region you want:<region>.privateinternetaccess.com
- Change the
ovpnconf
variable to the.conf
file you set up for the previous scripts - Change the
vpnks
variable to the location of thevpnks-start.sh
script
./vpnks-change.sh
A simple script that calls, in order:
vpnks-change.sh
vpnks-stop.sh
vpnks-start.sh
It's useful for a restart function of a systemd service
Ensure the scripts are set to the proper location
./vpnks-change.sh