mirror of
https://github.com/ilteoood/docker-surfshark.git
synced 2025-12-21 11:35:00 +01:00
First commit
This commit is contained in:
15
Dockerfile
Normal file
15
Dockerfile
Normal file
@@ -0,0 +1,15 @@
|
||||
FROM alpine:latest
|
||||
LABEL maintainer.name="Matteo Pietro Dazzi" \
|
||||
maintainer.email="matteopietro.dazzi@gmail.com" \
|
||||
version="1.0" \
|
||||
description="OpenVPN client configured for SurfShark VPN"
|
||||
ENV SURFSHARK_USER=
|
||||
ENV SURFSHARK_PASSWORD=
|
||||
ENV SURFSHARK_COUNTRY=
|
||||
ENV CONNECTION_TYPE=tcp
|
||||
HEALTHCHECK --interval=60s --timeout=10s --start-period=30s CMD curl -L 'https://ipinfo.io'
|
||||
RUN apk add --update --no-cache openvpn wget unzip coreutils curl
|
||||
WORKDIR /vpn
|
||||
COPY startup.sh .
|
||||
RUN chmod +x ./startup.sh
|
||||
ENTRYPOINT [ "./startup.sh" ]
|
||||
64
README.md
Normal file
64
README.md
Normal file
@@ -0,0 +1,64 @@
|
||||
# docker-surfshark
|
||||
|
||||
Docker container with OpenVPN client preconfigured for SurfShark
|
||||
|
||||
------------------------------------------------
|
||||

|
||||
|
||||
This is a [multi-arch](https://medium.com/gft-engineering/docker-why-multi-arch-images-matters-927397a5be2e) image, updated automatically thanks to [GitHub Actions](https://github.com/features/actions).
|
||||
|
||||
Its purpose is to provide the [SurfShark VPN](https://surfshark.com/) to all your containers.
|
||||
|
||||
The link is established using the [OpenVPN](https://openvpn.net/) client.
|
||||
|
||||
## Configuration
|
||||
|
||||
The container is configurable using 4 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|
|
||||
|CONNECTION_TYPE|No|The connection type that you qant to use: tcp, udp|
|
||||
|
||||
`SURFSHARK_USER` and `SURFSHARK_PASSWORD` are provided at the bottom of this page: [https://account.surfshark.com/setup/manual](https://account.surfshark.com/setup/manual).
|
||||
|
||||

|
||||
|
||||
## Execution
|
||||
|
||||
You can run this image using [Docker compose](https://docs.docker.com/compose/) and the [sample file](./docker-compose.yml) provided.
|
||||
|
||||
```
|
||||
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
|
||||
- CONNECTION_TYPE=udp
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
devices:
|
||||
- /dev/net/tun
|
||||
restart: unless-stopped
|
||||
```
|
||||
|
||||
Or you can use the standard `docker run` command.
|
||||
|
||||
```sh
|
||||
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:
|
||||
|
||||
```sh
|
||||
sudo docker run -it --net=container:CONTAINER_NAME alpine /bin/sh
|
||||
```
|
||||
|
||||
If you face network connection problems, I suggest you to set a specific DNS server for each container.
|
||||
16
docker-compose.yml
Normal file
16
docker-compose.yml
Normal file
@@ -0,0 +1,16 @@
|
||||
version: "2"
|
||||
|
||||
services:
|
||||
surfshark:
|
||||
image: ilteoood:latest
|
||||
container_name: surfshark
|
||||
environment:
|
||||
- SURFSHARK_USER=YOUR_SURFSHARK_USER
|
||||
- SURFSHARK_PASSWORD=YOUR_SURFSHARK_PASSWORD
|
||||
- SURFSHARK_COUNTRY=it
|
||||
- CONNECTION_TYPE=udp
|
||||
cap_add:
|
||||
- NET_ADMIN
|
||||
devices:
|
||||
- /dev/net/tun
|
||||
restart: unless-stopped
|
||||
BIN
images/logo.png
Normal file
BIN
images/logo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 64 KiB |
9
startup.sh
Normal file
9
startup.sh
Normal file
@@ -0,0 +1,9 @@
|
||||
#!/bin/sh
|
||||
rm -rf ovpn_configs*
|
||||
wget -O ovpn_configs.zip https://api.surfshark.com/v1/server/configurations
|
||||
unzip ovpn_configs.zip -d ovpn_configs
|
||||
cd ovpn_configs
|
||||
VPN_FILE=$(ls | grep "${SURFSHARK_COUNTRY}-" | grep "${CONNECTION_TYPE}" | shuf | head -n 1)
|
||||
echo Choosed: ${VPN_FILE}
|
||||
printf "${SURFSHARK_USER}\n${SURFSHARK_PASSWORD}" > vpn-auth.txt
|
||||
openvpn --config $VPN_FILE --auth-user-pass vpn-auth.txt
|
||||
Reference in New Issue
Block a user