diff --git a/files/www/cgi-bin/vpn b/files/www/cgi-bin/vpn index 9cf92fdc..f43a30af 100755 --- a/files/www/cgi-bin/vpn +++ b/files/www/cgi-bin/vpn @@ -386,6 +386,12 @@ do break end + -- Generate a new key if we chance the client name + local cname = cursor:get("wireguard", "client_" .. wgclient_num, "name") or "" + local ckey = cursor:get("wireguard", "client_" .. wgclient_num, "key") or "" + if key == ckey and name ~= cname and name ~= "" then + key = "" + end if key == "" then local privS = capture("/usr/bin/wg genkey"):match("(%S+)") local pubS = capture("echo " .. privS .. " | /usr/bin/wg pubkey"):match("(%S+)")