feat(wg-randomize): rotate qbittorrent-public gluetun VPN config
crontab entry for randomize script and docker restart vpn config file use Dockerfile to install scp
This commit is contained in:
1 parent
5b16ce7843
commit
e568f214bd
19 files changed
+208
-9
No files matched your search
@@ -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
|
*/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
|
||||||
|
|
||||||
@@ -12,7 +12,6 @@ services:
|
|||||||
- "55661:55661/udp"
|
- "55661:55661/udp"
|
||||||
- "55661:55661/tcp"
|
- "55661:55661/tcp"
|
||||||
restart: "unless-stopped"
|
restart: "unless-stopped"
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
- "./10-torrent-init.sh:/custom-cont-init.d/10-torrent-init.sh:ro"
|
- "./10-torrent-init.sh:/custom-cont-init.d/10-torrent-init.sh:ro"
|
||||||
- "./qbittorrent-private:/config"
|
- "./qbittorrent-private:/config"
|
||||||
@@ -20,7 +19,8 @@ services:
|
|||||||
- "/torrent/qbittorrent-private/downloads:/downloads-private"
|
- "/torrent/qbittorrent-private/downloads:/downloads-private"
|
||||||
- "/torrent/qbittorrent-private/torrents:/torrents"
|
- "/torrent/qbittorrent-private/torrents:/torrents"
|
||||||
qbittorrent-public:
|
qbittorrent-public:
|
||||||
image: "lscr.io/linuxserver/qbittorrent:5.2.3"
|
# image: "lscr.io/linuxserver/qbittorrent:latest"
|
||||||
|
build: qbittorrent-public/
|
||||||
container_name: "qbittorrent-public"
|
container_name: "qbittorrent-public"
|
||||||
environment:
|
environment:
|
||||||
- PGID=1000
|
- PGID=1000
|
||||||
@@ -30,13 +30,19 @@ services:
|
|||||||
network_mode: "service:gluetun"
|
network_mode: "service:gluetun"
|
||||||
depends_on:
|
depends_on:
|
||||||
- gluetun
|
- gluetun
|
||||||
|
# ports:
|
||||||
|
# - 8082:8080 # qBittorrent WebUI
|
||||||
|
# - 55662:55663
|
||||||
|
# - 55662:55663/udp
|
||||||
restart: "unless-stopped"
|
restart: "unless-stopped"
|
||||||
volumes:
|
volumes:
|
||||||
- "./10-torrent-init.sh:/custom-cont-init.d/10-torrent-init.sh:ro"
|
- "./10-torrent-init.sh:/custom-cont-init.d/10-torrent-init.sh:ro"
|
||||||
- "./qbittorrent-public:/config"
|
- "./qbittorrent-public:/config"
|
||||||
- "/home/lucas/scripts/torrent:/hostscripts:ro"
|
- "/home/lucas/scripts/torrent:/hostscripts:ro"
|
||||||
- "/torrent/qbittorrent-public/downloads:/downloads-public"
|
- "/torrent/qbittorrent-public/downloads:/downloads-public"
|
||||||
|
- "/torrent/qbittorrent-public/buffer:/downloads-private"
|
||||||
- "/torrent/qbittorrent-public/torrents:/torrents"
|
- "/torrent/qbittorrent-public/torrents:/torrents"
|
||||||
|
- "/data/torrent:/downloads-special"
|
||||||
gluetun:
|
gluetun:
|
||||||
image: qmcgaw/gluetun:latest
|
image: qmcgaw/gluetun:latest
|
||||||
container_name: gluetun
|
container_name: gluetun
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
CONF_DIR="${1:?Usage: $0 <conf-directory>}"
|
||||||
|
|
||||||
|
# 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
|
||||||
@@ -6,7 +6,6 @@ Address = 10.14.0.2/16
|
|||||||
PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I=
|
PrivateKey = mKeDQdxtM1iFJS7WLlb2jPGabZIt3NkoA/nGCcNOU1I=
|
||||||
DNS = 162.252.172.57, 149.154.159.92
|
DNS = 162.252.172.57, 149.154.159.92
|
||||||
[Peer]
|
[Peer]
|
||||||
PublicKey = dPZe8Jq3Hu0k07MDk+Y4+AS2XHSLYalyg91TSFXRYEA=
|
PublicKey = zPg3ZJ7OsztQ0CRSSvH5o2KVL1DYgDGW65DFwLsYwyw=
|
||||||
AllowedIPs = 0.0.0.0/0
|
AllowedIPs = 0.0.0.0/0
|
||||||
Endpoint = 87.249.133.4:51820
|
Endpoint = 92.62.123.85:51820
|
||||||
|
|
||||||
@@ -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
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
CONF_DIR="${1:?Usage: $0 <conf-directory>}"
|
CONF_DIR="${1:?Usage: $0 <conf-directory>}"
|
||||||
|
wgfile=${CONF_DIR}/wg0.conf
|
||||||
|
|
||||||
# Pick a random .conf except 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)
|
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"
|
echo "Selected: $random_conf"
|
||||||
|
|
||||||
# Copy to wg0.conf in current directory
|
# Copy to wg0.conf in current directory
|
||||||
cp "$random_conf" ./wg0.conf
|
cp "$random_conf" $wgfile
|
||||||
|
|
||||||
# Resolve hostname in Endpoint to IP
|
# Resolve hostname in Endpoint to IP
|
||||||
endpoint=$(grep '^Endpoint' wg0.conf | awk '{print $3}')
|
endpoint=$(grep '^Endpoint' $wgfile | awk '{print $3}')
|
||||||
host=${endpoint%:*}
|
host=${endpoint%:*}
|
||||||
port=${endpoint##*:}
|
port=${endpoint##*:}
|
||||||
|
|
||||||
@@ -23,7 +24,7 @@ if [[ -z "$ip" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i "s|^Endpoint = .*|Endpoint = $ip:$port|" wg0.conf
|
sed -i "s|^Endpoint = .*|Endpoint = $ip:$port|" $wgfile
|
||||||
|
|
||||||
echo "Updated Endpoint:"
|
echo "Updated Endpoint:"
|
||||||
grep '^Endpoint' wg0.conf
|
grep '^Endpoint' $wgfile
|
||||||
Reference in new issue
Block a user