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
@@ -2,6 +2,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
CONF_DIR="${1:?Usage: $0 <conf-directory>}"
|
||||
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
|
||||
Reference in new issue
Block a user