diff --git a/docker_compose/serverhost/crontab.bak b/docker_compose/serverhost/crontab.bak index 40e5cdb..318d1c2 100644 --- a/docker_compose/serverhost/crontab.bak +++ b/docker_compose/serverhost/crontab.bak @@ -1,2 +1,12 @@ +# Example of job definition: +# .---------------- minute (0 - 59) +# | .------------- hour (0 - 23) +# | | .---------- day of month (1 - 31) +# | | | .------- month (1 - 12) OR jan,feb,mar,apr ... +# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat +# | | | | | +# * * * * * user-name command to be executed */5 * * * * /home/lucas/scripts/docker_compose/node-exporter-pubip-docker-states.sh +0 0 */2 * * /home/lucas/scripts/network/wg-randomize.sh /docker/qbittorrent/gluetun/ && /usr/bin/docker restart gluetun qbittorrent-public + diff --git a/docker_compose/serverhost/qbittorrent/docker-compose.yaml b/docker_compose/serverhost/qbittorrent/docker-compose.yaml index 970112f..33924d2 100644 --- a/docker_compose/serverhost/qbittorrent/docker-compose.yaml +++ b/docker_compose/serverhost/qbittorrent/docker-compose.yaml @@ -12,7 +12,6 @@ services: - "55661:55661/udp" - "55661:55661/tcp" restart: "unless-stopped" - volumes: - "./10-torrent-init.sh:/custom-cont-init.d/10-torrent-init.sh:ro" - "./qbittorrent-private:/config" @@ -20,7 +19,8 @@ services: - "/torrent/qbittorrent-private/downloads:/downloads-private" - "/torrent/qbittorrent-private/torrents:/torrents" qbittorrent-public: - image: "lscr.io/linuxserver/qbittorrent:5.2.3" +# image: "lscr.io/linuxserver/qbittorrent:latest" + build: qbittorrent-public/ container_name: "qbittorrent-public" environment: - PGID=1000 @@ -30,13 +30,19 @@ services: network_mode: "service:gluetun" depends_on: - gluetun +# ports: +# - 8082:8080 # qBittorrent WebUI +# - 55662:55663 +# - 55662:55663/udp restart: "unless-stopped" volumes: - "./10-torrent-init.sh:/custom-cont-init.d/10-torrent-init.sh:ro" - "./qbittorrent-public:/config" - "/home/lucas/scripts/torrent:/hostscripts:ro" - "/torrent/qbittorrent-public/downloads:/downloads-public" + - "/torrent/qbittorrent-public/buffer:/downloads-private" - "/torrent/qbittorrent-public/torrents:/torrents" + - "/data/torrent:/downloads-special" gluetun: image: qmcgaw/gluetun:latest container_name: gluetun diff --git a/docker_compose/serverhost/qbittorrent/gluetun/at-vie.conf b/docker_compose/serverhost/qbittorrent/gluetun/at-vie.conf new file mode 100644 index 0000000..09dcfc3 --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/at-vie.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = dPZe8Jq3Hu0k07MDk+Y4+AS2XHSLYalyg91TSFXRYEA= +AllowedIPs = 0.0.0.0/0 +Endpoint = at-vie.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/bd-dac.conf b/docker_compose/serverhost/qbittorrent/gluetun/bd-dac.conf new file mode 100644 index 0000000..5a76199 --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/bd-dac.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = 6tOduT4iNbZyqKNzsSgDe/ckziO6101NPZwrnY5WpTk= +AllowedIPs = 0.0.0.0/0 +Endpoint = bd-dac.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/de-ber.conf b/docker_compose/serverhost/qbittorrent/gluetun/de-ber.conf new file mode 100644 index 0000000..bca63db --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/de-ber.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = d3ldwEjnFcbLwD1o8uC5xC3DaSNek8DGeTpOb/h/IE4= +AllowedIPs = 0.0.0.0/0 +Endpoint = de-ber.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/ec-uio.conf b/docker_compose/serverhost/qbittorrent/gluetun/ec-uio.conf new file mode 100644 index 0000000..90ddefb --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/ec-uio.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = LErFIOc3YBK1khnmwV+a6fBbYff2OS3h+wnIuOKZQTY= +AllowedIPs = 0.0.0.0/0 +Endpoint = ec-uio.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/ee-tll.conf b/docker_compose/serverhost/qbittorrent/gluetun/ee-tll.conf new file mode 100644 index 0000000..8c2e238 --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/ee-tll.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = CsdrT+WfcMRPhrOWgZeHj9DQiQtJfYFci94K5ztjr2E= +AllowedIPs = 0.0.0.0/0 +Endpoint = ee-tll.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/fi-hel.conf b/docker_compose/serverhost/qbittorrent/gluetun/fi-hel.conf new file mode 100644 index 0000000..8d1dd86 --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/fi-hel.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = +nv/Z8I2VS0eRdZwkpQW3U9RmsboTz2MUF94jVg5w10= +AllowedIPs = 0.0.0.0/0 +Endpoint = fi-hel.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/gl-goh.conf b/docker_compose/serverhost/qbittorrent/gluetun/gl-goh.conf new file mode 100644 index 0000000..7b3dc01 --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/gl-goh.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = zPg3ZJ7OsztQ0CRSSvH5o2KVL1DYgDGW65DFwLsYwyw= +AllowedIPs = 0.0.0.0/0 +Endpoint = gl-goh.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/ie-dub.conf b/docker_compose/serverhost/qbittorrent/gluetun/ie-dub.conf new file mode 100644 index 0000000..42b96e6 --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/ie-dub.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = TjYxodFNdGlefxnWqe9vWWJHnz3meYWWhiIJyU8rgg8= +AllowedIPs = 0.0.0.0/0 +Endpoint = ie-dub.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/in-del.conf b/docker_compose/serverhost/qbittorrent/gluetun/in-del.conf new file mode 100644 index 0000000..bd5f45c --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/in-del.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = +dmGrWPM9NI3vQkZ9E7hMRKAJKYzd3YMXGq10sjbN0A= +AllowedIPs = 0.0.0.0/0 +Endpoint = in-del.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/kh-pnh.conf b/docker_compose/serverhost/qbittorrent/gluetun/kh-pnh.conf new file mode 100644 index 0000000..e0066bc --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/kh-pnh.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = z2Ik8BG6XgosyYE/O4Vz4kiPTZyoWSlJvZtFeFlNclI= +AllowedIPs = 0.0.0.0/0 +Endpoint = kh-pnh.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/mt-mla.conf b/docker_compose/serverhost/qbittorrent/gluetun/mt-mla.conf new file mode 100644 index 0000000..636f6cb --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/mt-mla.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = c9EuAnWYvGUyFrzrV70Fph0onkFv2xe3Bc0gTCFuKRw= +AllowedIPs = 0.0.0.0/0 +Endpoint = mt-mla.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/se-sto.conf b/docker_compose/serverhost/qbittorrent/gluetun/se-sto.conf new file mode 100644 index 0000000..a14553f --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/se-sto.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = oUFRc+2emXgogDVWnJF4RAzr72PyafCzMVeQOgG92lY= +AllowedIPs = 0.0.0.0/0 +Endpoint = se-sto.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/si-lju.conf b/docker_compose/serverhost/qbittorrent/gluetun/si-lju.conf new file mode 100644 index 0000000..3770a9e --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/si-lju.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = yPdmxOfzm06fotkt/dlaAiyxWPaWfCuDPaUljNx+c38= +AllowedIPs = 0.0.0.0/0 +Endpoint = si-lju.prod.surfshark.com:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/gluetun/wg-randomize.sh b/docker_compose/serverhost/qbittorrent/gluetun/wg-randomize.sh new file mode 100755 index 0000000..445e57c --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/gluetun/wg-randomize.sh @@ -0,0 +1,29 @@ +#!/bin/bash +set -euo pipefail + +CONF_DIR="${1:?Usage: $0 }" + +# Pick a random .conf except wg0.conf +random_conf=$(find "$CONF_DIR" -maxdepth 1 -type f -name "*.conf" ! -name "wg0.conf" | shuf -n1) + +echo "Selected: $random_conf" + +# Copy to wg0.conf in current directory +cp "$random_conf" ./wg0.conf + +# Resolve hostname in Endpoint to IP +endpoint=$(grep '^Endpoint' wg0.conf | awk '{print $3}') +host=${endpoint%:*} +port=${endpoint##*:} + +ip=$(getent ahostsv4 "$host" | awk '{print $1; exit}') + +if [[ -z "$ip" ]]; then + echo "Failed to resolve $host" + exit 1 +fi + +sed -i "s|^Endpoint = .*|Endpoint = $ip:$port|" wg0.conf + +echo "Updated Endpoint:" +grep '^Endpoint' wg0.conf diff --git a/docker_compose/serverhost/qbittorrent/gluetun/wg0.conf b/docker_compose/serverhost/qbittorrent/gluetun/wg0.conf index a446913..8f17f54 100644 --- a/docker_compose/serverhost/qbittorrent/gluetun/wg0.conf +++ b/docker_compose/serverhost/qbittorrent/gluetun/wg0.conf @@ -6,7 +6,6 @@ Address = 10.14.0.2/16 PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= DNS = 162.252.172.57, 149.154.159.92 [Peer] -PublicKey = dPZe8Jq3Hu0k07MDk+Y4+AS2XHSLYalyg91TSFXRYEA= +PublicKey = zPg3ZJ7OsztQ0CRSSvH5o2KVL1DYgDGW65DFwLsYwyw= AllowedIPs = 0.0.0.0/0 -Endpoint = 87.249.133.4:51820 - +Endpoint = 92.62.123.85:51820 \ No newline at end of file diff --git a/docker_compose/serverhost/qbittorrent/wg0.conf b/docker_compose/serverhost/qbittorrent/wg0.conf new file mode 100644 index 0000000..9831442 --- /dev/null +++ b/docker_compose/serverhost/qbittorrent/wg0.conf @@ -0,0 +1,11 @@ +# +# Use this configuration with WireGuard client +# +[Interface] +Address = 10.14.0.2/16 +PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I= +DNS = 162.252.172.57, 149.154.159.92 +[Peer] +PublicKey = d3ldwEjnFcbLwD1o8uC5xC3DaSNek8DGeTpOb/h/IE4= +AllowedIPs = 0.0.0.0/0 +Endpoint = 86.38.98.61:51820 \ No newline at end of file diff --git a/network/wg-randomize.sh b/network/wg-randomize.sh index 445e57c..42e47db 100755 --- a/network/wg-randomize.sh +++ b/network/wg-randomize.sh @@ -2,6 +2,7 @@ set -euo pipefail CONF_DIR="${1:?Usage: $0 }" +wgfile=${CONF_DIR}/wg0.conf # Pick a random .conf except wg0.conf random_conf=$(find "$CONF_DIR" -maxdepth 1 -type f -name "*.conf" ! -name "wg0.conf" | shuf -n1) @@ -9,10 +10,10 @@ random_conf=$(find "$CONF_DIR" -maxdepth 1 -type f -name "*.conf" ! -name "wg0.c echo "Selected: $random_conf" # Copy to wg0.conf in current directory -cp "$random_conf" ./wg0.conf +cp "$random_conf" $wgfile # Resolve hostname in Endpoint to IP -endpoint=$(grep '^Endpoint' wg0.conf | awk '{print $3}') +endpoint=$(grep '^Endpoint' $wgfile | awk '{print $3}') host=${endpoint%:*} port=${endpoint##*:} @@ -23,7 +24,7 @@ if [[ -z "$ip" ]]; then exit 1 fi -sed -i "s|^Endpoint = .*|Endpoint = $ip:$port|" wg0.conf +sed -i "s|^Endpoint = .*|Endpoint = $ip:$port|" $wgfile echo "Updated Endpoint:" -grep '^Endpoint' wg0.conf +grep '^Endpoint' $wgfile