Support downloading alternate OpenVPN configuration files
This handles 4 out of the 5 variations on PIA's site. lport is not
supported in Chrome OS (AFAICT).
Signed-off-by: Kevin Cernekee <cernekee@chromium.org>
diff --git a/README.md b/README.md
index edd5ec7..89e6cc8 100644
--- a/README.md
+++ b/README.md
@@ -48,7 +48,11 @@
Rebuilding the ONC files by hand
================================
-Running `./build_all.sh` will download the default OpenVPN configuration
+First, clone this repo on a Linux machine:
+
+`git clone https://chromium.googlesource.com/experimental/cros-pia`
+
+Then run `./build_all.sh` to download the default OpenVPN configuration
files from
[the official PIA site](https://www.privateinternetaccess.com/pages/client-support/),
convert them into ONC format, and create `cros-pia.zip` in the current
@@ -63,6 +67,17 @@
`./ovpn_to_onc.py "US California.ovpn"`
+To download an alternate set of OVPN files, specify the appropriate flag as
+the first argument:
+
+`./build_all.sh --pia-tcp`
+
+The supported flags are:
+
+ * `--pia-ip`: Connect via IP address instead of server hostname.
+ * `--pia-tcp`: Connect over 443/tcp instead of 1194/udp.
+ * `--pia-ip-tcp`: Same as above, but connect via IP address.
+
Limitations and notes
=====================
diff --git a/build_all.sh b/build_all.sh
index 683e019..5a1311e 100755
--- a/build_all.sh
+++ b/build_all.sh
@@ -6,9 +6,32 @@
set -euo pipefail
-URL="https://www.privateinternetaccess.com/openvpn/openvpn.zip"
+BASE_URL="https://www.privateinternetaccess.com/openvpn"
OUT="cros-pia.zip"
+case "${1:-}" in
+ --pia-ip)
+ URL="$BASE_URL/openvpn-ip.zip"
+ shift
+ ;;
+# ONC doesn't handle "lport"
+# --pia-ip-lport)
+# URL="$BASE_URL/openvpn-ip-lport.zip"
+# shift
+# ;;
+ --pia-tcp)
+ URL="$BASE_URL/openvpn-tcp.zip"
+ shift
+ ;;
+ --pia-ip-tcp)
+ URL="$BASE_URL/openvpn-ip-tcp.zip"
+ shift
+ ;;
+ *)
+ URL="$BASE_URL/openvpn.zip"
+ ;;
+esac
+
rm -rf tmp
mkdir tmp
cd tmp