d4rkcat / pia

Private Internet Access VPN Linux bash client
GNU General Public License v2.0
92 stars 18 forks source link

PIA zip no longer uses .ovpn extension #12

Open Tjololo12 opened 6 years ago

Tjololo12 commented 6 years ago

Updating files fails on line 54 because the .zip file provided from PIA does not have the .ovpn file extension. The files are extensionless. I can't quite figure out how to make the script work again with that caveat.

Tjololo12 commented 6 years ago

I made a few updates that appear to work. Diff attached below:

pi@seedbox:~/scripts/pia $ diff /usr/bin/pia pia.sh
48d47
<         find $VPNPATH -type f ! -name '*.*' -exec rm {} \;
52,53c51
<       #cd $VPNPATH && for CONFIGFILE in *.ovpn;do mv "$CONFIGFILE" $(echo $CONFIGFILE | tr ' ' '_') &>/dev/null;done
<         for CONFIGFILE in $VPNPATH/*; do mv "$CONFIGFILE" "${CONFIGFILE// /_}" 2>/dev/null; done
---
>       cd $VPNPATH && for CONFIGFILE in *.ovpn;do mv "$CONFIGFILE" $(echo $CONFIGFILE | tr ' ' '_') &>/dev/null;done
56,68c54
< #        find /etc/openvpn/pia -type f ! -name "*.*" -exec mv {} {}.ovpn \;
< #     for CONFIGFILE in $VPNPATH/*.ovpn;do
< #             CNT=0
< #             for OLD in "${OLDS[@]}";do
< #                     sed -i "s%$OLD%${NEWS[$CNT]}%g" $CONFIGFILE
< #                     ((++CNT))
< #             done
< #             echo -e "auth-nocache\nlog /var/log/pia.log" >> $CONFIGFILE
< #             echo -n $(basename $CONFIGFILE | cut -d '.' -f 1)" " >> $VPNPATH/servers.txt
< #             cat $CONFIGFILE | grep .com | awk '{print $2}' >> $VPNPATH/servers.txt
< #     done
< #     find $VPNPATH -type f ! -name '*.*' -exec sh -c '
<         for CONFIGFILE in `find $VPNPATH -type f ! -name '*.*'| sort`; do
---
>       for CONFIGFILE in $VPNPATH/*.ovpn;do
70,76c56,58
<                 for OLD in "${OLDS[@]}";do
<                         sed -i "s%$OLD%${NEWS[$CNT]}%g" $CONFIGFILE
<                         ((++CNT))
<                 done
<                 echo -e "auth-nocache\nlog /var/log/pia.log" >> $CONFIGFILE
<                 echo -n $(basename $CONFIGFILE | cut -d '.' -f 1)" " >> $VPNPATH/servers.txt
<                 cat $CONFIGFILE | grep .com | awk '{print $2}' >> $VPNPATH/servers.txt
---
>               for OLD in "${OLDS[@]}";do
>                       sed -i "s%$OLD%${NEWS[$CNT]}%g" $CONFIGFILE
>                       ((++CNT))
77a60,63
>               echo -e "auth-nocache\nlog /var/log/pia.log" >> $CONFIGFILE
>               echo -n $(basename $CONFIGFILE | cut -d '.' -f 1)" " >> $VPNPATH/servers.txt
>               cat $CONFIGFILE | grep .com | awk '{print $2}' >> $VPNPATH/servers.txt
>       done
89d74
<         echo $FORWARDEDPORT > /etc/openvpn/pia/portnum
683,684c668
< #CONFIG=$SERVERNAME.ovpn
< CONFIG=$SERVERNAME
---
> CONFIG=$SERVERNAME.ovpn
Tjololo12 commented 6 years ago

Interesting. Trying it today, I'm getting the .ovpn extension in the zip file. I wonder if they had a wonky update. This may not be necessary

quadrilo44 commented 6 years ago

Yeah, they had a day or so when their config files didn't have an extension, it's fixed now, but they have updated the config format to OpenVPN 2.4.

I have sent their support an email asking whether they no longer support <v2.4.