Skip to content

Commit

Permalink
include socks support
Browse files Browse the repository at this point in the history
  • Loading branch information
binhex committed Jun 28, 2024
1 parent 4fa6260 commit 3e5ba13
Show file tree
Hide file tree
Showing 3 changed files with 68 additions and 21 deletions.
16 changes: 0 additions & 16 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,6 @@ ADD config/nobody/ /home/nobody/
RUN chmod +x /root/*.sh /home/nobody/*.sh /home/nobody/*.py && \
/bin/bash /root/install.sh "${RELEASETAG}" "${TARGETARCH}"

# docker settings
#################

# expose port for deluge webui
EXPOSE 8112

# expose port for privoxy
EXPOSE 8118

# expose port for deluge daemon (used in conjunction with LAN_NETWORK env var)
EXPOSE 58846

# expose port for deluge incoming port (used only if VPN_ENABLED=no)
EXPOSE 58946
EXPOSE 58946/udp

# set permissions
#################

Expand Down
21 changes: 16 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,21 @@ This Docker includes OpenVPN and WireGuard to ensure a secure and private connec

Latest stable Deluge release from Arch Linux repo.<br/>
Latest stable Privoxy release from Arch Linux repo.<br/>
Latest stable microsocks release from GitHub.<br/>
Latest stable OpenVPN release from Arch Linux repo.<br/>
Latest stable WireGuard release from Arch Linux repo.

## Usage

```bash
```text
docker run -d \
--cap-add=NET_ADMIN \
-p 8112:8112 \
-p 8118:8118 \
-p 9118:9118 \
-p 58846:58846 \
-p 58946:58946 \
-p 58946:58946/udp \
--name=<container name> \
-v <path for data files>:/data \
-v <path for config files>:/config \
Expand Down Expand Up @@ -73,15 +76,23 @@ Default password for the webui is "deluge"

`http://<host ip>:8118`

## Access microsocks

`<host ip>:9118`

default credentials: admin/socks

## PIA example

```bash
docker run -d \
--cap-add=NET_ADMIN \
-p 8112:8112 \
-p 8118:8118 \
-p 9118:9118 \
-p 58846:58846 \
-p 58946:58946 \
-p 58946:58946/udp \
--name=delugevpn \
-v /apps/docker/deluge/data:/data \
-v /apps/docker/deluge/config:/config \
Expand Down Expand Up @@ -112,10 +123,6 @@ docker run -d \
binhex/arch-delugevpn
```

## IMPORTANT

Please note `VPN_INPUT_PORTS` is **NOT** to define the incoming port for the VPN, this environment variable is used to define port(s) you want to allow in to the VPN network when network binding multiple containers together, configuring this incorrectly with the VPN provider assigned incoming port COULD result in IP leakage, you have been warned!.

## OpenVPN

Please note this Docker image does not include the required OpenVPN configuration file and certificates. These will typically be downloaded from your VPN providers website (look for OpenVPN configuration files), and generally are zipped.
Expand Down Expand Up @@ -158,6 +165,10 @@ The list of default NS providers in the above example(s) is as follows:-
37.235.x.x = FreeDNS<br/>
1.x.x.x = Cloudflare

---
**IMPORTANT**<br/>
Please note `VPN_INPUT_PORTS` is **NOT** to define the incoming port for the VPN, this environment variable is used to define port(s) you want to allow in to the VPN network when network binding multiple containers together, configuring this incorrectly with the VPN provider assigned incoming port COULD result in IP leakage, you have been warned!.

---
User ID (PUID) and Group ID (PGID) can be found by issuing the following command for the user you want to run the container as:-

Expand Down
52 changes: 52 additions & 0 deletions run/nobody/watchdog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,44 @@ while true; do

fi

if [[ "${ENABLE_SOCKS}" == "yes" ]]; then

# get current bind ip for microsocks, if different to vpn_ip then kill
microsocks_current_bind_ip=$(pgrep -fa 'microsocks' | grep -o -P -m 1 '(?<=-b\s)[\d\.]+')

if [[ "${microsocks_current_bind_ip}" != "${vpn_ip}" ]]; then

echo "[info] Restarting microsocks due to change in vpn ip..."
pkill -SIGTERM "microsocks"

# run script to start microsocks
source /home/nobody/microsocks.sh

else

# check if microsocks is running, if not then skip shutdown of process
if ! pgrep -fa "/usr/local/bin/microsocks" > /dev/null; then

echo "[info] microsocks not running"

else

# mark microsocks as running
microsocks_running="true"

fi

if [[ "${microsocks_running}" == "false" ]]; then

# run script to start microsocks
source /home/nobody/microsocks.sh

fi

fi

fi

else

echo "[warn] VPN IP not detected, VPN tunnel maybe down"
Expand Down Expand Up @@ -198,6 +236,20 @@ while true; do

fi

if [[ "${ENABLE_SOCKS}" == "yes" ]]; then

# check if microsocks is running, if not then start via microsocks.sh
if ! pgrep -fa "/usr/local/bin/microsocks" > /dev/null; then

echo "[info] microsocks not running"

# run script to start microsocks
source /home/nobody/microsocks.sh

fi

fi

if [[ "${deluge_running}" == "false" || "${deluge_web_running}" == "false" ]]; then

# run script to start deluge
Expand Down

0 comments on commit 3e5ba13

Please sign in to comment.