Thanks to https://github.com/ilteoood/docker-surfshark
Docker container with OpenVPN client preconfigured for SurfShark
Its purpose is to provide the SurfShark VPN to all your containers.
The link is established using the OpenVPN client.
The container is configurable using 7 environment variables:
Name | Mandatory | Description |
---|---|---|
SURFSHARK_USER | Yes | Username provided by SurfShark |
SURFSHARK_PASSWORD | Yes | Password provided by SurfShark |
SURFSHARK_COUNTRY | No | The country, supported by SurfShark, in which you want to connect |
SURFSHARK_CITY | No | The city of the country in which you want to connect |
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. Example 192.168.0.0/24 |
ENABLE_DOCKERNETWORK | No | Enables firewall rule to allow incoming connections from default internal Docker networks. Leave blank to disable |
SURFSHARK_USER
and SURFSHARK_PASSWORD
are provided at this page, under the "Credentials" tab: https://my.surfshark.com/vpn/manual-setup/main
SURFSHARK_COUNTRY
and SURFSHARK_CITY
codes can be found at this page, under the "Files" tab: https://my.surfshark.com/vpn/manual-setup/main
You can run this image using Docker compose
** Remember: if you want to use the web gui of a container, you must open its ports on docker-surfshark
as described below. **
version: "3.8"
services:
surfshark:
build: https://github.com/ChumpyTheBear/docker-surfshark.git
container_name: surfshark
environment:
- SURFSHARK_USER=YOUR_SURFSHARK_USER
- SURFSHARK_PASSWORD=YOUR_SURFSHARK_PASSWORD
- SURFSHARK_COUNTRY=it
- SURFSHARK_CITY=mil
- CONNECTION_TYPE=udp
- LAN_NETWORK=192.168.1.0/24
- ENABLE_DOCKERNETWORK=1
cap_add:
- NET_ADMIN
devices:
- /dev/net/tun
ports:
- 9091:9091 #we open here the port for transmission, as this container will be the access point for the others
restart: unless-stopped
dns:
- 1.1.1.1
To manually test the connection run the following:
docker run -it --net=container:surfshark byrnedo/alpine-curl -L 'https://ipinfo.io'
Use the following for DNS Leak testing https://github.com/macvk/dnsleaktest
If you want access to an attached container's web ui you will also need to expose those ports. The attached container must not be started until this container is up and fully running.