Coder Social home page Coder Social logo

bernhard-da / pia-tools Goto Github PK

View Code? Open in Web Editor NEW

This project forked from pschmitt/pia-tools

0.0 2.0 0.0 515 KB

Shell script to automate privateinternetaccess port forwarding and starting/stopping transmission when connected/disconnected and other stuff

Home Page: https://aur.archlinux.org/packages/pia-tools/

License: GNU General Public License v3.0

Shell 100.00%

pia-tools's Introduction

pia-tools

Description

OpenVPN hook for privateinternetaccess.com to automate port forwarding, dynamically add a firewall rule, starting/stopping transmission when connected/disconnected

TODO

  • Ship a ready-to-go OpenVPN wrapper service for systemd
  • Get rid of cURL and rename (and sudo?) dependencies
  • Modularity
  • Automate the post-installation
  • Better error handling

Dependencies

  • curl
  • dnsutils (nslookup)
  • openvpn
  • sed
  • sudo
  • systemd (pseudo-optional - required for service start/stopping)
  • transmission-cli
  • ufw

Installation

ArchLinux

mkdir /tmp/pia-tools; cd !$
curl -O https://raw.githubusercontent.com/pschmitt/pia-tools/master/{PKGBUILD,pia-tools.install}
makepkg -si

Other distros

curl https://raw.githubusercontent.com/pschmitt/pia-tools/master/pia-tools > /usr/bin/pia-tools

MANPAGE

If you also want to have the MANPAGE:

curl https://raw.githubusercontent.com/pschmitt/pia-tools/master/pia-tools.groff | gzip -c - > $MAN_PATH/pia-tools.1.gz

Note: $MANPATH may not be defined, so you'll have to find out where to put the obtained file. On ArchLinux, this would be /usr/share/man/man1/

Systemd service file

curl https://raw.githubusercontent.com/pschmitt/pia-tools/master/[email protected] > /usr/lib/systemd/system/[email protected]

Post installation

First I recommend to create /etc/openvpn/pia and the required config files:

mkdir -p /etc/openvpn/pia

# Feel free to edit the up/down parameters
cat <<EOM > /etc/openvpn/pia/pia_common
auth-user-pass passwd
script-security 2
up "/usr/bin/pia-tools -g"
down "/usr/bin/pia-tools --restore-dns"
EOM

# Start interactive setup
pia-tools --setup

The setup will store your credentials in /etc/openvpn/pia/passwd, download the config files from PIA and append /etc/openvpn/pia/pia_common to all of them.

In order to download the config files again run pia-tools --update

Go! Go! GOOOOO!

systemctl start pia@Sweden

Sample config file

Path: /etc/pia-tools.conf

PIA_CONFIG_DIR='/etc/openvpn/pia'
PIA_CONFIG_URL='https://www.privateinternetaccess.com/openvpn/openvpn.zip'
PIA_COMMON_CONFIG="$PIA_CONFIG_DIR/pia_common"
PIA_SERVERS_FILE="$PIA_CONFIG_DIR/piaservers"
PIA_SERVERS_IP_FILE="$PIA_CONFIG_DIR/piaserverips"
PIA_PASSWD_FILE="$PIA_CONFIG_DIR/passwd"
PIA_CLIENT_ID_FILE="$PIA_CONFIG_DIR/clientid"
TRANSMISSION_SETTINGS_FILE='/home/dl/.config/transmission-daemon/settings.json'
PIA_OPEN_PORT_FILE="$PIA_CONFIG_DIR/open_port"
VIRT_NET_DEV='tun0'

Read more

If you installed the MANPAGE:

man pia-tools

pia-tools's People

Contributors

jolan avatar pschmitt avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.