• Stars
    star
    127
  • Rank 276,800 (Top 6 %)
  • Language
    Shell
  • License
    MIT License
  • Created over 4 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Docker container with OpenVPN client preconfigured for SurfShark

docker-surfshark

Docker container with OpenVPN client preconfigured for SurfShark

Build only image


logo

This is a multi-arch image, updated automatically thanks to GitHub Actions.

Its purpose is to provide the SurfShark VPN to all your containers.

The link is established using the OpenVPN client.

Configuration

The container is configurable using different 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
OPENVPN_OPTS No Any additional options for OpenVPN
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
ENABLE_MASQUERADE No Masquerade NAT allows you to translate multiple IP addresses to another single IP address.
OVPN_CONFIGS No Manually provide the path used to read the "Surfshark_Config.zip" file (contains Surshark's OpenVPN configuration files)
ENABLE_KILL_SWITCH No Enable the kill-switch functionality

SURFSHARK_USER and SURFSHARK_PASSWORD are provided at this page.

SurfShark credentials

Execution

You can run this image using Docker compose and the sample file provided.
Remember: if you want to use the web gui of a container, you must open its ports on docker-surfshark as described below.

version: "2"

services: 
    surfshark:
        image: ilteoood/docker-surfshark
        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=
        cap_add: 
            - NET_ADMIN
        devices:
            - /dev/net/tun
        ports:
            - 1080:1080 #if you want to use the socks5 server
            - 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
    service_test:
        image: byrnedo/alpine-curl
        container_name: alpine
        command: -L 'https://ipinfo.io'
        depends_on: 
            - surfshark
        network_mode: service:surfshark
        restart: always
    transmission:
        image: linuxserver/transmission
        container_name: transmission
        environment:
            - PUID=1000
            - PGID=1000
            - TZ=Europe/Rome
        #ports:
            #- 9091:9091 needed to access transmission's GUI
        network_mode: service:surfshark
        restart: unless-stopped

Or you can use the standard docker run command.

sudo docker run -it --cap-add=NET_ADMIN --device /dev/net/tun --name CONTAINER_NAME -e SURFSHARK_USER=YOUR_SURFSHARK_USER -e SURFSHARK_PASSWORD=YOUR_SURFSHARK_PASSWORD ilteoood/docker-surfshark

If you want to attach a container to the VPN, you can simply run:

sudo docker run -it --net=container:CONTAINER_NAME alpine /bin/sh

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.

If you face network connection problems, I suggest you to set a specific DNS server for each container.

Alternatively, if your software supports it, you can use the socks5 server embedded in this container. It will redirect your traffic through the Surfshark's VPN.

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.

Then, you must make the zip available inside the container, using a bind mount or a volume.

Finally, you must set the OVPN_CONFIGS environment variable.

Do you like my work?

patreon or buy-me-a-coffee

More Repositories

1

flutter_i18n

I18n made easy, for Flutter!
Dart
214
star
2

tele_uploader

Telegram bot able to upload large file, also on Dropbox!
PHP
23
star
3

docker_buildx

GitHub actions with docker buildx
JavaScript
22
star
4

SiteAlert-Python

SiteAlert, what are you waiting for?
Python
22
star
5

native-federation-typescript

Bundler agnostic plugin to share federated types
TypeScript
17
star
6

re-flusso

Utility library to operate with JavaScript Streams API
TypeScript
12
star
7

bluetooth_piconet

Create bluetooth piconet in Android with this simple application!
Java
6
star
8

elements-impaginator

Project used to generate the page configuration of your web components using the `microlc-element-composer` standard
TypeScript
6
star
9

vscode-remote-tunnels

VSCode remote tunnels Docker image that can be easily deployed everywhere you want
Dockerfile
4
star
10

seqproto-schemify

Generate seqproto code from json schema
TypeScript
4
star
11

italian_free_iptv

Script that will push, everyday, free iptv channels on gists
Java
4
star
12

Viope2014

Java
2
star
13

dhcp_dos

DHCP Denial Of Service tool
Python
2
star
14

sesamo-backend

Backend API for Sesamo project
TypeScript
2
star
15

xdcc-mule

xdcc-mule port to NodeJS
TypeScript
2
star
16

sharpDash

sharpDash is a C# porting of the famouse JavaScript Lodash library
C#
2
star
17

vscode_settings

Settings repo for vscode
2
star
18

monorepo-vite

Repository used for the talk "Monorepo: come te li aggiusto con un cacciaVite"
2
star
19

docker-brains

Docker images for Jetbrains products
Dockerfile
1
star
20

rar-on-arm

This Docker image will provide rar binary for arm platforms
Dockerfile
1
star
21

sveltwind

The fastest way to include Tailwind CSS in your Svelte project
JavaScript
1
star
22

ilteoood

1
star
23

napi-rs-benchmark

NAPI-RS benchmark, with different use cases
JavaScript
1
star
24

native-federation-tests

Bundler agnostic plugin to share aggregated files for tests
TypeScript
1
star
25

interceptor-repro

TypeScript
1
star
26

module-federation-typescript

Module federation TypeScript bug repro
1
star