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.
- Deletes transmission-ovpn containers which have
status=created
and are non functional - Iterates over ports, until a free one is found to run a proxy container on in batch mode
- Supports many vpn providers, see the full list at vpn-configs-contrib.
- Configurable
docker run --restart
argument
- Copy
spawn.sh
from this repo to destination machine (linux) - Retrieve the username & password, which are usually not the vpn login credentials, but special ones created by the provider, shown when choosing manual setup e.g.
- If only one location should be translated into a proxy server
- Head over to vpn-configs-contrib
- Find the folder of the vpn provider used
- Copy the name of the server needed
- Skip to the Usage part
- If many proxies need to be created at once, create a file called
ovpn_list
in the same directory as the script- Copy each needed location's name into the
ovpn_list
- Copy each needed location's name into the
- The
.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 - The vpn providers supported are listed at vpn-configs-contrib
- The script parameters for
spawn.sh
below must be entered in the same order as listed - When creating a proxy, the
.ovpn
can be added also, it will be removed by the script anyway - Batch craeting with restart argument
on-failure:5
is recommended, as non-functional vpn's won't constantly try to restart but stay stopped - If the proxy container needs to be used by another container X:
- Add
172.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
- Run a shell inside the container X using
docker exec -it <container_id_of_x> /bin/sh
- Try to reach the docker host from within container X using
ping -c 4 host.docker.internal
- If it says
ping: bad address 'host.docker.internal'
, add this to container X's run command:--add-host=host.docker.internal:host-gateway
and resart it - If it (now) says e.g.
PING host.docker.internal (172.17.0.1): 56 data bytes
, the host and other containers can now be reached from inside of container X - Use
host.docker.internal
as the hostname and the proxy containers port to use the proxy
- If it says
- Add
vpn_location
: The desired line chosen from theovpn_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 likealways
,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 \
[email protected] \
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)