Aller au contenu

Qbittorrent

Prérequis

Désactiver IPv6

Pour l'instant le tunnel wireguard ne gère pas IPv6.

Bash
nano /etc/sysctl.conf

Ajouter ceci :

Text Only
net.ipv6.conf.all.disable_ipv6 = 1

Wireguard (Proton VPN)

Installation

Bash
apk add wireguard-tools

Configuration

Après avoir récupéré le fichier de configuration dans les paramètres, sur le site internet, créer le fichier de configuration sur votre serveur.

Bash
mkdir /etc/wireguard/protonvpn
nano /etc/wireguard/protonvpn/wg0.conf

Coller la configuration précédemment récupérée et ajouter après la ligne "VPN accelerator" :

Text Only
1
2
3
4
5
6
PostUp = route add -net 10.1.0.0/16 gw 10.100.0.1
PostUp  = iptables -I OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
PostUp = iptables -I OUTPUT -d 10.0.0.0/8 -j ACCEPT
PreDown = route del -net 10.1.0.0/16 gw 10.100.0.1
PreDown = iptables -D OUTPUT ! -o %i -m mark ! --mark $(wg show %i fwmark) -m addrtype ! --dst-type LOCAL -j REJECT
PreDown = iptables -D OUTPUT -d 10.0.0.0/8 -j ACCEPT

Remplacer 10.0.0.0/8 par la plage d'IP que vous utilisez sur votre réseau local.

Monter le tunnel

Pour tester la connexion :

Bash
wg-quick up /etc/wireguard/protonvpn/wg0.conf

Lancement au démarrage

Pour monter le tunnel au démarrage :

Bash
nano /etc/network/interfaces

Ajouter à la fin du fichier :

Text Only
1
2
3
auto wg0
iface wg0 inet static
pre-up wg-quick up /etc/wireguard/protonvpn/wg0.conf

Qbittorrent

Installation

Bash
apk add qbittorrent-nox

Configuration

Port web

Bash
nano /etc/conf.d/qbittorrent-nox

Ajouter au fichier le port web à utiliser, exemple avec le port 13001 :

Text Only
# qbittorrent configuration options

# extra arguments to pass to qbittorrent
command_args="--webui-port=13001"
# user:group
command_user="qbittorrent:qbittorrent"
# qbittorrent roots itself in this directory,
# creating its config files/logs under it
directory="/var/lib/qbittorrent"
umask=0022

# comment to use traditional service management
supervisor=supervise-daemon

Démarrer seulement si VPN

Bash
nano /etc/init.d/qbittorrent-nox

Ajouter dans la partie start_pre()

Text Only
#!/sbin/openrc-run

name=qbittorrent-nox
description="qbittorrent torrent daemon"
command="/usr/bin/qbittorrent-nox"
command_background=true
: ${directory:=/var/lib/qbittorrent}
: ${command_user:=qbittorrent:qbittorrent}
: ${umask:=0022}
# raise file descriptor count (many open files..)
rc_ulimit="-n 50000"

depend() {
        need net
        after firewall
}

start_pre() {
        checkpath -d -o $command_user "$directory"
        # Check if WireGuard interface is up
        if ! wg show wg0 &>/dev/null; then
            eerror "WireGuard tunnel wg0 is not up."
            return 1
        fi
}

Lancement au démarrage

Bash
rc-service qbittorrent-nox start
rc-update add qbittorrent-nox

Redémarrer et tester

Redémarrer

Redémarrer le serveur et vérifier le bon lancement des services

Bash
reboot

Tester

Tester son IP publique avec un torrent : http://checkmyip.torrentprivacy.com