diff --git a/pia-tools b/pia-tools index 109d394..3baffd6 100755 --- a/pia-tools +++ b/pia-tools @@ -56,7 +56,6 @@ fi usage() { echo "Usage: $1 [-p|r] [-a|d] [-u] [-c] [-h]" echo "-p: Request new port" - echo "-r: Refresh (request port forwarding again) [default]" echo "-a: Block non VPN traffic (iptables)" echo "-d: Unblock non VPN traffic (iptables) [default]" echo "-g: Use PIA DNS (updates resolv.conf)" @@ -203,24 +202,20 @@ transmission_peer_port_update() { # Return a new client ID new_client_id() { - head -n 100 /dev/urandom | md5sum | tr -d " -" | tee $PIA_CLIENT_ID_FILE + head -n 100 /dev/urandom | sha256sum | tr -d " -" | tee $PIA_CLIENT_ID_FILE } request_port() { local username="$(head -1 $PIA_PASSWD_FILE)" local passwd="$(tail -1 $PIA_PASSWD_FILE)" - local local_vpn_ip="$(ip addr show $VIRT_NET_DEV | awk '/inet / { print $2; exit}')" local client_id="$1" - [[ -z "$local_vpn_ip" ]] && local_vpn_ip=$LOCAL_IP echo -n "Updating port forwarding... " if test "$VERBOSE"; then echo "Username: $username" echo "Client ID: $client_id" - echo "VPN local IP: $local_vpn_ip" fi PIA_OPEN_PORT_NEW="$(\ - curl -Ld "user=$username&pass=$passwd&client_id=$client_id&local_ip=$local_vpn_ip" \ - https://www.privateinternetaccess.com/vpninfo/port_forward_assignment \ + curl -qqs http://209.222.18.222:2000/?client_id=$client_id \ | grep -oE "[0-9]+" 2>&1)" if test "$PIA_OPEN_PORT_NEW"; then echo "$PIA_OPEN_PORT_NEW" > "$PIA_OPEN_PORT_FILE" @@ -335,18 +330,18 @@ restore_dns() { mv -f /etc/resolv.conf.orig /etc/resolv.conf } -# If no option -> refresh +# If no option -> portfwd if [[ $# -eq 0 ]]; then - action_port=refresh + action_port=portfwd #action_fw=disallow fi # Every function except help needs root permissions check_root "$*" -ARGS=$(getopt -o "adprfguscihv" \ +ARGS=$(getopt -o "adpfguscihv" \ -l "allow,disallow,\ - port,refresh,pia-dns,google-dns,restore-dns,\ + port,pia-dns,google-dns,restore-dns,\ restore,force,check,\ update,setup,info,help,verbose" \ -n "$0" -- "$@") @@ -372,11 +367,6 @@ while true; do action_port=portfwd shift ;; - -r|--refresh) - test "$action_port" && exit 1 - action_port=refresh - shift - ;; -g|--pia-dns) test "$action_dns" && exit 1 action_dns=pia diff --git a/pia-tools.groff b/pia-tools.groff index 2321808..9e56243 100644 --- a/pia-tools.groff +++ b/pia-tools.groff @@ -12,9 +12,6 @@ Script to automate privateinternetacces port forwarding and starting/stopping tr \fB\-p\fR, \fB \-\-port\fR Request a new forwarding port .TP -\fB\-r\fR, \fB \-\-refresh\fR -Request port forwarding [default] -.TP \fB\-a\fR, \fB \-\-allow\fR Unblock all non-VPN traffic [default] .TP