hotio / qbittorrent

https://hotio.dev/containers/qbittorrent
GNU General Public License v3.0
116 stars 14 forks source link

Only one docker network is assumed to be present #16

Closed ColinHebert closed 9 months ago

ColinHebert commented 1 year ago

When using the docker image with more than one network setup (for example one network for the reverse proxy, one network to allow containers pertaining to qbittorrent to talk to each other), the current set of iptables rules will only allow one network interface (therefore one network) to be accessible.

Fortunately, docker is nice enough to explicitly define routes for each of the network interfaces it manages as proto kernel.

It should be possible to allow all network interfaces of the docker container to continue working with a code similar to this:

echo "Allow docker network"
docker_cirds=$(ip -o -4 route show proto kernel | awk '{print $1}')
for cidr in $docker_cirds; do
    iptables -A INPUT -s "${cidr}" -d "${cidr}" -j ACCEPT
    iptables -A OUTPUT -s "${cidr}" -d "${cidr}" -j ACCEPT
done

This takes inspiration from https://github.com/hotio/qbittorrent/blob/release/root/etc/cont-init.d/02-setup-wg#L103 but applies it to all routes defined by the kernel

mrhotio commented 9 months ago

should be fixed with latest commit in base image