Merge pull request #52 from nsf/master

Make it possible to bootstrap using provided ovpn configs zip file.
This commit is contained in:
Matteo Pietro Dazzi
2023-03-09 12:27:14 +01:00
committed by GitHub
3 changed files with 18 additions and 2 deletions

View File

@@ -12,6 +12,7 @@ ENV OPENVPN_OPTS=
ENV CONNECTION_TYPE=tcp
ENV LAN_NETWORK=
ENV CREATE_TUN_DEVICE=
ENV OVPN_CONFIGS=
HEALTHCHECK --interval=60s --timeout=10s --start-period=30s CMD curl -L 'https://ipinfo.io'
COPY startup.sh .
RUN apk add --update --no-cache openvpn wget unzip coreutils curl && chmod +x ./startup.sh

View File

@@ -31,6 +31,7 @@ The container is configurable using 5 environment variables:
|CONNECTION_TYPE|No|The connection type that you want to use: tcp, udp|
|LAN_NETWORK|No|Lan network used to access the web ui of attached containers. Can be comma seperated for multiple subnets Comment out or leave blank: example 192.168.0.0/24|
|CREATE_TUN_DEVICE|No|Creates the TUN device, useful for NAS users|
|OVPN_CONFIGS|No|Manually provide the path used to read the "Surfshark_Config.zip" file (contains Surshark's OpenVPN configuration files)
`SURFSHARK_USER` and `SURFSHARK_PASSWORD` are provided at this page: [https://my.surfshark.com/vpn/manual-setup/main](https://my.surfshark.com/vpn/manual-setup/main).
@@ -103,6 +104,17 @@ If you want access to an attached container's web ui you will also need to expos
If you face network connection problems, I suggest you to set a specific DNS server for each container.
## Provide OpenVPN Configs Manually
Sometimes the startup script fails to download OpenVPN configs file from Surfshark's website, possibly due to the DDoS protection on it.
To avoid it, you can provide your own `Surfshark_Config.zip` file, downloading it from [here](https://my.surfshark.com/vpn/api/v1/server/configurations).
Then, you **must** make the `zip` available inside the container, using a [bind mount](https://docs.docker.com/storage/bind-mounts/) or a [volume](https://docs.docker.com/storage/volumes/).
Finally, you **must** set the `OVPN_CONFIGS` environment variable.
## Do you like my work?
<p align="center">
<a href="https://www.patreon.com/ilteoood">

View File

@@ -1,7 +1,10 @@
#!/bin/sh
rm -rf ovpn_configs*
wget -O ovpn_configs.zip https://my.surfshark.com/vpn/api/v1/server/configurations
unzip ovpn_configs.zip -d ovpn_configs
if [ -z "${OVPN_CONFIGS}" ]; then
wget -O ovpn_configs.zip https://my.surfshark.com/vpn/api/v1/server/configurations
OVPN_CONFIGS=ovpn_configs.zip
fi
unzip "${OVPN_CONFIGS}" -d ovpn_configs
cd ovpn_configs
VPN_FILE=$(ls "${SURFSHARK_COUNTRY}"* | grep "${SURFSHARK_CITY}" | grep "${CONNECTION_TYPE}" | shuf | head -n 1)
echo Chose: ${VPN_FILE}