Trigus42 / alpine-qbittorrentvpn

Multiarch docker image with the latest qBittorrent-nox client (WEB UI) and WireGuard/OpenVPN tunnel
GNU General Public License v3.0
87 stars 13 forks source link

If VPN_ENABLED=no the run script for qBittorrent fails #25

Closed CondorUK closed 1 year ago

CondorUK commented 1 year ago

There is no check in the qBittorrent run service for VPN_ENABLED=no therefore when it hits this part of the run script it fails.

/etc/services.d/qbittorrent/run

# Check if it is possible to bypass the VPN
echo "$(date +'%Y-%m-%d %H:%M:%S') [INFO] Trying to ping 1.1.1.1 and 8.8.8.8 over the docker interface for 500ms each..."
if (timeout 0.5 ping -I "$DOCKER_INTERFACE" -c 1 "1.1.1.1" > /dev/null 2>&1) || (timeout 0.5 ping -I "$DOCKER_INTERFACE" -c 1 "8.8.8.8" > /dev/null 2>&1); then
        echo "$(date +'%Y-%m-%d %H:%M:%S') [ERROR] Firewall is down! Exiting.."
        exit 1
else
        echo "$(date +'%Y-%m-%d %H:%M:%S') [INFO] Success: Could not connect. This means the firewall is most likely working properly."
fi

This fixes the issue

# Check if it is possible to bypass the VPN
if [[ $VPN_ENABLED != "no" ]]; then
        echo "$(date +'%Y-%m-%d %H:%M:%S') [INFO] Trying to ping 1.1.1.1 and 8.8.8.8 over the docker interface for 500ms each..."
        if (timeout 0.5 ping -I "$DOCKER_INTERFACE" -c 1 "1.1.1.1" > /dev/null 2>&1) || (timeout 0.5 ping -I "$DOCKER_INTERFACE" -c 1 "8.8.8.8" > /dev/null 2>&1); then
                echo "$(date +'%Y-%m-%d %H:%M:%S') [ERROR] Firewall is down! Exiting.."
                exit 1
        else
                echo "$(date +'%Y-%m-%d %H:%M:%S') [INFO] Success: Could not connect. This means the firewall is most likely working properly."
        fi
fi