Creates proxy servers for locations listed by a VPN provider, e.g. ExpressVPN, Surfshark, etc. Each (OpenVPN) location translates into a seperate docker container. The OpenVPN to Proxy conversion is provided by haugene/docker-transmission-openvpn.
status=created
and are non functionaldocker run --restart
argumentspawn.sh
from this repo to destination machine (linux)ovpn_list
in the same directory as the script
ovpn_list
.ovpn
file to use is not provided as file, but as a name (string). The Transmission-service fetches the corresponding file and handles the rest spawn.sh
below must be entered in the same order as listed.ovpn
can be added also, it will be removed by the script anywayon-failure:5
is recommended, as non-functional vpn's won't constantly try to restart but stay stopped172.17.0.0/24
to the network parameter of the shell script, e.g. sudo ./spawn.sh ... 172.17.0.0/24,192.168.0.0/24
docker exec -it <container_id_of_x> /bin/sh
ping -c 4 host.docker.internal
ping: bad address 'host.docker.internal'
, add this to container X's run command: --add-host=host.docker.internal:host-gateway
and resart itPING host.docker.internal (172.17.0.1): 56 data bytes
, the host and other containers can now be reached from inside of container Xhost.docker.internal
as the hostname and the proxy containers port to use the proxyvpn_location
: The desired line chosen from the ovpn_list
vpn_provider
: The company of the service used (Internal or External), full list herestarting_port
: The port on which the proxy should serve in single mode, and where it should start iterating in batch mode (see Features)vpn_username
: The expressvpn username which you kept handy (see setup above)vpn_password
: The corresponding passwordcontainer_restart
: The docker run restart behaviour like always
, unless-stopped
, etc, see documentationnetwork_cidr
: The host network's range, e.g. 192.168.0.0/24
sudo ./spawn.sh \
<vpn_location> \
<vpn_provider> \
<starting_port> \
<vpn_username> \
<vpn_password> \
<container_restart> \
<network_cidr>
Create a proxy server, which connects to "Hong Kong - 2" and be available on port 8900:
sudo ./spawn.sh \
my_expressvpn_hong_kong_-_2_udp.ovpn \
EXPRESSVPN \
8900 \
y7v1wwy6wg5vh8s9jfn2sj3c \
ixay8f10fdljm31zks09x287 \
always \
192.168.0.0/24
sudo ./spawn.sh \
list \
<vpn_provider> \
<starting_port> \
<vpn_username> \
<vpn_password> \
<container_restart> \
<network_cidr>
If ovpn_list
file contains
jp-tok-st014.prod.surfshark.com_udp.ovpn
ua-iev.prod.surfshark.com_udp.ovpn
us-nyc.prod.surfshark.com
Then the following would create 3 proxy servers, one for each location. First (Japan) would listen on port 8900, Second (Ukraine) on port 8901, etc.
sudo ./spawn.sh \
list \
SURFSHARK \
8900 \
someone@something.com \
8x5o60nz22gll9o8qsf63to2 \
on-failure:5 \
192.168.0.0/24
docker ps -a --format "{{.Names}}" | grep "openvpn" | xargs -r -I {} docker stop {}
docker ps -a --format "{{.Names}}" | grep "openvpn" | xargs -r -I {} docker rm -f {}
docker ps -a --filter "status=exited" --format "{{.ID}} {{.Names}}" | grep openvpn | cut -d ' ' -f1 | xargs docker rm -f
docker exec -it $(docker ps -a --format '{{.Names}}' | grep 'openvpn' | head -n 1) /bin/sh
docker logs $(docker ps -a --format '{{.Names}}' | grep 'openvpn' | head -n 1)