Tun device gration

This commit is contained in:
iLTeoooD
2022-01-09 14:47:05 +01:00
parent f4bac78362
commit 213eb19869
4 changed files with 11 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@@ -0,0 +1 @@
.vscode

View File

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

View File

@@ -30,6 +30,7 @@ The container is configurable using 5 environment variables:
|OPENVPN_OPTS|No|Any additional options for OpenVPN| |OPENVPN_OPTS|No|Any additional options for OpenVPN|
|CONNECTION_TYPE|No|The connection type that you want to use: tcp, udp| |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| |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|
`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). `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).

View File

@@ -21,4 +21,12 @@ then
echo Do not forget to expose the ports for attached container we ui access echo Do not forget to expose the ports for attached container we ui access
fi fi
if [ "${CREATE_TUN_DEVICE}" = "true" ]; then
echo "Creating TUN device /dev/net/tun"
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 0666 /dev/net/tun
fi
openvpn --config $VPN_FILE --auth-user-pass vpn-auth.txt --mute-replay-warnings $OPENVPN_OPTS openvpn --config $VPN_FILE --auth-user-pass vpn-auth.txt --mute-replay-warnings $OPENVPN_OPTS