DaveOff / NordLynx

Nordlynx Configuration Generator (Windows)
24 stars 6 forks source link

[Feature Request] macOS #3

Open Drjacky opened 1 year ago

Drjacky commented 1 year ago

Is that possible to adapt the script with macOS/Linux as well?

I trie to edit the code but not sure what should I put instead of var NordLynxResolveSettings = Module.findExportByName("nordlynxWinTun.dll", 'NordLynxResolveSettings');!

Drjacky commented 1 year ago
  1. Download NordVPN's macOS client, log in and make sure the VPN protocol is set to 'Nordlynx' in the NordVPN client preferences.

  2. Connect to your server of choice or auto-connect if you have no preference. Remember that a WireGuard config only has info for one server; you don't get the fancy auto-connection or server list that the NordVPN client offers.

  3. Open Keychain Access in the /Applications/Utilities folder. In the search box, type in 'nordvpn'. Double-click on the entry for 'NordVPN Configuration', ensuring that the 'Date Modified' time is the same as when you just connected to a server.

  4. Check the 'Show Password' box and enter your macOS (not NordVPN) password. You may have to do this twice.

  5. Select and copy the entire value in the password field, much of which is hidden, and paste it into a text editor like Sublime or VSCode. Ensure Word Wrap is enabled. You will see that you have just pasted a JSON object. It should look like this:

{"mesh_ip_addresses":[],"private_key":"xxxxxxxxxxxxxxxxxxxxxx","exit_peer":{"public_key":"xxxxxxxxxxxxxxxxxxxxxx","endpoint":"xx.xx.xxx.xx:xxxxx"},"dns_servers":["xxx.xx.xx.xxx","xxx.xx.xx.xxx"]}
  1. Remove any and all '\' (backslash) characters from the 'private_key' and 'public_key' fields. These fields are supposed to be encoded in Base64, but for whatever reason, the NordVPN client and/or macOS escape the '/' (forward slash) characters with a backslash. DO NOT delete the forward slash. To be clear, if your 'private_key' or 'public_key' value is 'abcde\/fgh', you should turn it into 'abcde/fgh'.

  2. Copy the now backslash-less private and public keys from your pasted JSON string to the right of the equals signs on the appropriate lines in the template provided below these steps. Do the same for the 'endpoint' field, which should be an IP address in the format of xx.xx.xx.xx:port. For all 3 copied values, do NOT copy the double quotes on either side of the value -- just copy the text inside the quotes.

  3. Save the now filled-out template into a file ending in .conf, such as wireguard_config.conf. Use this file or its contents to configure WireGuard anywhere, e.g. pfSense, OpenWrt, etc.

  4. (Optional) Test your WireGuard configuration in the official macOS WireGuard client by clicking the 'Import tunnel(s) from file' button and selecting your newly-saved .conf file. Make sure your NordVPN client has disconnected. In the WireGuard client, press 'activate' and ensure your IP is behind a VPN.

TEMPLATE -- copy every line between the ==========s into a text editor. Paste the PrivateKey, PublicKey, and Endpoint values you obtained from Keychain Access to the right of the appropriate equals sign:

=======================

[Interface]
PrivateKey = 
Address = 10.5.0.2/16
DNS = 9.9.9.9

[Peer]
PublicKey = 
AllowedIPs = 0.0.0.0/0, ::/0
Endpoint = 
PersistentKeepalive = 25
=======================

Source