mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 09:51:02 +01:00
Invert openvpn_alt_mode binding behavior
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
## 5.1.2-24 (30-11-2025)
|
||||||
|
- Reverse `openvpn_alt_mode`: enabled now binds only qBittorrent to the VPN interface; default keeps container-wide binding for OpenVPN and WireGuard.
|
||||||
|
|
||||||
## 5.1.2-23 (29-11-2025)
|
## 5.1.2-23 (29-11-2025)
|
||||||
- Default VPN container binding for OpenVPN and WireGuard with optional qBittorrent-only interface binding.
|
- Default VPN container binding for OpenVPN and WireGuard with optional qBittorrent-only interface binding.
|
||||||
|
|
||||||
|
|||||||
@@ -77,14 +77,14 @@ Network disk is mounted to `/mnt/<share_name>`. You need to map the exposed port
|
|||||||
| `openvpn_config` | str | | OpenVPN config file name (in `/config/openvpn/`) |
|
| `openvpn_config` | str | | OpenVPN config file name (in `/config/openvpn/`) |
|
||||||
| `openvpn_username` | str | | OpenVPN username |
|
| `openvpn_username` | str | | OpenVPN username |
|
||||||
| `openvpn_password` | str | | OpenVPN password |
|
| `openvpn_password` | str | | OpenVPN password |
|
||||||
| `openvpn_alt_mode` | bool | `true` | Container binding for VPN traffic (disable to bind qBittorrent only) |
|
| `openvpn_alt_mode` | bool | `false` | Bind only qBittorrent to the VPN interface (leave disabled for container-wide binding) |
|
||||||
| `wireguard_enabled` | bool | `false` | Enable WireGuard tunnel |
|
| `wireguard_enabled` | bool | `false` | Enable WireGuard tunnel |
|
||||||
| `wireguard_config` | str | _(empty)_ | WireGuard config file name (in `/config/wireguard/`) |
|
| `wireguard_config` | str | _(empty)_ | WireGuard config file name (in `/config/wireguard/`) |
|
||||||
| `qbit_manage` | bool | `false` | Enable qBit Manage integration |
|
| `qbit_manage` | bool | `false` | Enable qBit Manage integration |
|
||||||
| `run_duration` | str | | Run duration (e.g., `12h`, `5d`) |
|
| `run_duration` | str | | Run duration (e.g., `12h`, `5d`) |
|
||||||
| `silent` | bool | `false` | Suppress debug messages |
|
| `silent` | bool | `false` | Suppress debug messages |
|
||||||
|
|
||||||
By default, VPN traffic is container-bound (OpenVPN and WireGuard). Disable `openvpn_alt_mode` only if you prefer binding qBittorrent itself to the VPN interface while exposing the rest of the container on the host network.
|
By default, VPN traffic is container-bound (OpenVPN and WireGuard). Enable `openvpn_alt_mode` only if you prefer binding qBittorrent itself to the VPN interface while exposing the rest of the container on the host network.
|
||||||
|
|
||||||
### WireGuard Setup
|
### WireGuard Setup
|
||||||
|
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ options:
|
|||||||
certfile: fullchain.pem
|
certfile: fullchain.pem
|
||||||
customUI: vuetorrent
|
customUI: vuetorrent
|
||||||
keyfile: privkey.pem
|
keyfile: privkey.pem
|
||||||
openvpn_alt_mode: true
|
openvpn_alt_mode: false
|
||||||
openvpn_config: ""
|
openvpn_config: ""
|
||||||
openvpn_enabled: false
|
openvpn_enabled: false
|
||||||
openvpn_password: ""
|
openvpn_password: ""
|
||||||
@@ -150,4 +150,4 @@ schema:
|
|||||||
slug: qbittorrent
|
slug: qbittorrent
|
||||||
udev: true
|
udev: true
|
||||||
url: https://github.com/alexbelgium/hassio-addons
|
url: https://github.com/alexbelgium/hassio-addons
|
||||||
version: 5.1.2-23
|
version: 5.1.2-24
|
||||||
|
|||||||
@@ -197,29 +197,10 @@ if bashio::config.true 'openvpn_enabled'; then
|
|||||||
# CONFIGURE QBITTORRENT #
|
# CONFIGURE QBITTORRENT #
|
||||||
#########################
|
#########################
|
||||||
|
|
||||||
# WITH CONTAINER BINDING
|
|
||||||
#########################
|
|
||||||
# If alternative mode enabled, bind container
|
|
||||||
if bashio::config.true 'openvpn_alt_mode'; then
|
|
||||||
echo "Using container binding"
|
|
||||||
|
|
||||||
# Remove interface
|
|
||||||
echo "... deleting previous interface settings"
|
|
||||||
sed -i '/Interface/d' "$QBT_CONFIG_FILE"
|
|
||||||
|
|
||||||
# Modify ovpn config
|
|
||||||
if grep -q route-nopull /config/openvpn/"$openvpn_config"; then
|
|
||||||
echo "... removing route-nopull from your config.ovpn"
|
|
||||||
sed -i '/route-nopull/d' /config/openvpn/"$openvpn_config"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Exit
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# WITH INTERFACE BINDING
|
# WITH INTERFACE BINDING
|
||||||
#########################
|
#########################
|
||||||
# Connection with interface binding
|
# If alternative mode enabled, bind only the app
|
||||||
|
if bashio::config.true 'openvpn_alt_mode'; then
|
||||||
echo "Using interface binding in the qBittorrent app"
|
echo "Using interface binding in the qBittorrent app"
|
||||||
|
|
||||||
# Define preferences line
|
# Define preferences line
|
||||||
@@ -251,6 +232,25 @@ if bashio::config.true 'openvpn_enabled'; then
|
|||||||
sed -i "1a route-nopull" /config/openvpn/"$openvpn_config"
|
sed -i "1a route-nopull" /config/openvpn/"$openvpn_config"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Exit
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
# WITH CONTAINER BINDING
|
||||||
|
#########################
|
||||||
|
# Default: bind whole container
|
||||||
|
echo "Using container binding"
|
||||||
|
|
||||||
|
# Remove interface
|
||||||
|
echo "... deleting previous interface settings"
|
||||||
|
sed -i '/Interface/d' "$QBT_CONFIG_FILE"
|
||||||
|
|
||||||
|
# Modify ovpn config
|
||||||
|
if grep -q route-nopull /config/openvpn/"$openvpn_config"; then
|
||||||
|
echo "... removing route-nopull from your config.ovpn"
|
||||||
|
sed -i '/route-nopull/d' /config/openvpn/"$openvpn_config"
|
||||||
|
fi
|
||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
##################
|
##################
|
||||||
|
|||||||
@@ -63,24 +63,23 @@ echo "${wireguard_runtime_config}" > "${WIREGUARD_STATE_DIR}/config"
|
|||||||
echo "${interface_name}" > "${WIREGUARD_STATE_DIR}/interface"
|
echo "${interface_name}" > "${WIREGUARD_STATE_DIR}/interface"
|
||||||
|
|
||||||
if bashio::config.true 'openvpn_alt_mode'; then
|
if bashio::config.true 'openvpn_alt_mode'; then
|
||||||
|
bashio::log.info 'Using qBittorrent interface binding for WireGuard.'
|
||||||
|
if bashio::fs.file_exists "${QBT_CONFIG_FILE}"; then
|
||||||
|
sed -i '/Interface/d' "${QBT_CONFIG_FILE}"
|
||||||
|
sed -i "/\\[Preferences\\]/ i\\Connection\\\\Interface=${interface_name}" "${QBT_CONFIG_FILE}"
|
||||||
|
sed -i "/\\[Preferences\\]/ i\\Connection\\\\InterfaceName=${interface_name}" "${QBT_CONFIG_FILE}"
|
||||||
|
sed -i "/\\[BitTorrent\\]/a \\Session\\\\Interface=${interface_name}" "${QBT_CONFIG_FILE}"
|
||||||
|
sed -i "/\\[BitTorrent\\]/a \\Session\\\\InterfaceName=${interface_name}" "${QBT_CONFIG_FILE}"
|
||||||
|
else
|
||||||
|
bashio::log.warning "qBittorrent config file not found. Bind the client manually to interface ${interface_name}."
|
||||||
|
fi
|
||||||
|
else
|
||||||
bashio::log.info 'Using container-wide WireGuard binding (default).'
|
bashio::log.info 'Using container-wide WireGuard binding (default).'
|
||||||
if bashio::fs.file_exists "${QBT_CONFIG_FILE}"; then
|
if bashio::fs.file_exists "${QBT_CONFIG_FILE}"; then
|
||||||
sed -i '/Interface/d' "${QBT_CONFIG_FILE}"
|
sed -i '/Interface/d' "${QBT_CONFIG_FILE}"
|
||||||
else
|
else
|
||||||
bashio::log.warning 'qBittorrent config file not found. Unable to remove interface binding entries.'
|
bashio::log.warning 'qBittorrent config file not found. Unable to remove interface binding entries.'
|
||||||
fi
|
fi
|
||||||
bashio::log.info "WireGuard prepared with interface ${interface_name} using configuration ${wireguard_config##*/}."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if bashio::fs.file_exists "${QBT_CONFIG_FILE}"; then
|
|
||||||
sed -i '/Interface/d' "${QBT_CONFIG_FILE}"
|
|
||||||
sed -i "/\\[Preferences\\]/ i\\Connection\\\\Interface=${interface_name}" "${QBT_CONFIG_FILE}"
|
|
||||||
sed -i "/\\[Preferences\\]/ i\\Connection\\\\InterfaceName=${interface_name}" "${QBT_CONFIG_FILE}"
|
|
||||||
sed -i "/\\[BitTorrent\\]/a \\Session\\\\Interface=${interface_name}" "${QBT_CONFIG_FILE}"
|
|
||||||
sed -i "/\\[BitTorrent\\]/a \\Session\\\\InterfaceName=${interface_name}" "${QBT_CONFIG_FILE}"
|
|
||||||
else
|
|
||||||
bashio::log.warning "qBittorrent config file not found. Bind the client manually to interface ${interface_name}."
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
bashio::log.info "WireGuard prepared with interface ${interface_name} using configuration ${wireguard_config##*/}."
|
bashio::log.info "WireGuard prepared with interface ${interface_name} using configuration ${wireguard_config##*/}."
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ if bashio::config.true 'wireguard_enabled'; then
|
|||||||
vpn_wireguard=true
|
vpn_wireguard=true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! bashio::config.true 'openvpn_alt_mode'; then
|
if bashio::config.true 'openvpn_alt_mode'; then
|
||||||
if [[ "${vpn_openvpn}" == true ]]; then
|
if [[ "${vpn_openvpn}" == true ]]; then
|
||||||
VPN_INTERFACE="tun0"
|
VPN_INTERFACE="tun0"
|
||||||
bashio::log.info "VPN monitor set to query external IP through interface ${VPN_INTERFACE} (interface binding)."
|
bashio::log.info "VPN monitor set to query external IP through interface ${VPN_INTERFACE} (interface binding)."
|
||||||
|
|||||||
Reference in New Issue
Block a user