From 7674f367047268a4af28a4e33c536f1a6f0133c2 Mon Sep 17 00:00:00 2001 From: turekt <32360115+turekt@users.noreply.github.com> Date: Mon, 15 May 2023 17:55:10 +0200 Subject: [PATCH] Generate random default IPv6 addresses Fixes https://github.com/angristan/wireguard-install/issues/283 Default IPv6 address is generated instead of fixed --- wireguard-install.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/wireguard-install.sh b/wireguard-install.sh index 2f95ecb..d1a9d77 100644 --- a/wireguard-install.sh +++ b/wireguard-install.sh @@ -131,8 +131,9 @@ function installQuestions() { read -rp "Server WireGuard IPv4: " -e -i 10.66.66.1 SERVER_WG_IPV4 done + DEFAULT_IPV6=$(echo "`date +%s%N``cat /etc/machine-id`" | sha256sum | cut -c 55-65 | sed 's/../&\n/g' | xargs printf "fd%s:%s%s:%s%s::1") until [[ ${SERVER_WG_IPV6} =~ ^([a-f0-9]{1,4}:){3,4}: ]]; do - read -rp "Server WireGuard IPv6: " -e -i fd42:42:42::1 SERVER_WG_IPV6 + read -rp "Server WireGuard IPv6: " -e -i "${DEFAULT_IPV6}" SERVER_WG_IPV6 done # Generate random number within private ports range