From 0b5968bb5652af56c452e7cf43100889afd44afb Mon Sep 17 00:00:00 2001 From: mcfly722 <7221798@gmail.com> Date: Sat, 14 Sep 2024 21:12:18 +0300 Subject: [PATCH] cloak public/private keys --- cloak-wg-helper/config.js | 26 +++++++++++++++++++++++--- cloak-wg-helper/index.html | Bin 12708 -> 13470 bytes 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/cloak-wg-helper/config.js b/cloak-wg-helper/config.js index ceeb476..e0e6b3d 100644 --- a/cloak-wg-helper/config.js +++ b/cloak-wg-helper/config.js @@ -5,12 +5,13 @@ var params = { cloakGateway: '', cloakEncryptionMethod: '', cloakNumberOfConnections: '', + cloakServerPrivate: '', + cloakServerPublic: '', wireguardClientPrivate: '', wireguardClientPublic: '', wireguardServerPrivate: '', wireguardServerPublic: '', wireguardMTU: '' - } function fill(){ @@ -63,7 +64,21 @@ function regenerateWGServer(){ document.getElementById("wireguardServerPublic").value = wgServer.publicKey; onChange("wireguardServerPrivate",wgServer.privateKey); onChange("wireguardServerPublic" ,wgServer.publicKey); +} + +function updateCloakServer(privateKey){ + cloakServer = window.wireguard.generateKeypairForPrivate(privateKey) + document.getElementById("cloakServerPublic").value = cloakServer.publicKey; + onChange("cloakServerPrivate",cloakServer.privateKey); + onChange("cloakServerPublic" ,cloakServer.publicKey); +} +function regenerateCloakServer(){ + var cloakServer = window.wireguard.generateKeypair() + document.getElementById("cloakServerPrivate").value = cloakServer.privateKey; + document.getElementById("cloakServerPublic").value = cloakServer.publicKey; + onChange("cloakServerPrivate",cloakServer.privateKey); + onChange("cloakServerPublic" ,cloakServer.publicKey); } @@ -72,6 +87,10 @@ function regenerateWireguard(){ regenerateWGServer(); } +function regenerateCloak(){ + regenerateCloakServer(); +} + function update(){ @@ -94,7 +113,7 @@ sudo tee /etc/cloak/cloak-client.json << EOF "ProxyMethod": "wireguard", "EncryptionMethod": ":cloakEncryptionMethod", "UID": "$ck_uid", - "PublicKey": "$ck_publicKey", + "PublicKey": ":cloakServerPublic", "ServerName": ":fakehost", "NumConn": :cloakNumberOfConnections, "KeepAlive": 0, @@ -190,7 +209,7 @@ sudo tee /etc/cloak/cloak-server.json << EOF "$ck_uid" ], "RedirAddr": ":fakehost", - "PrivateKey": "$ck_privateKey" + "PrivateKey": ":cloakServerPrivate" } EOF @@ -265,6 +284,7 @@ sudo wg window.onload = function() { regenerateWireguard(); + regenerateCloak(); fill(); update(); }; diff --git a/cloak-wg-helper/index.html b/cloak-wg-helper/index.html index 8bfbf6be769bc667d8ba348ba7839c9a5c568450..8cfe55ef7228b44279842ab31681e48e952a89ac 100644 GIT binary patch delta 125 zcmZ3IJTG&@GDS{jh8%``hD3(!$m!~f;;)PMkY|9 z%;Z;cQIi*F@_;q$(=3_Hr%*6igweRGR4jR1T+{C#N>YhdnPOBvrJy2nlsr?Tx4^ErW-c^oGlRO