NordVPN WireGuard Configuration Generation
- Log in to your NordAccount dashboard.
- Click on NordVPN in the services list.
- Scroll down to the Manual setup section and click Set up NordVPN manually.
- Verify your email address by entering the code sent to your email.
- Generate a new token in the Access Token tab.
- Copy and save this token. You will use it as the
ACCESS_TOKEN.
If you specify a country, use the 2-letter ISO 3166-1 alpha-2 code (e.g., US, DE, GB, JP).
You can use this command to check available countries
curl --silent "https://api.nordvpn.com/v1/servers/countries" | jq --raw-output '.[].name, .[].code'
-
Build the Docker image:
docker build -t nordvpn-wireguard . -
Run the container: Replace
your_tokenwith your actual token. This command mounts the current directory to/outputinside the container, so the configuration file is saved to your current folder.docker run --rm -v $(pwd):/output -e ACCESS_TOKEN="your_token" -e COUNTRY_CODE="us" nordvpn-wireguard
Windows (PowerShell):
docker run --rm -v ${PWD}:/output -e ACCESS_TOKEN="your_token" -e COUNTRY_CODE="us" nordvpn-wireguard
Windows (Command Prompt):
docker run --rm -v "%cd%":/output -e ACCESS_TOKEN="your_token" -e COUNTRY_CODE="us" nordvpn-wireguard
-
Save the code: Save the code as a Python file (e.g.,
main.py). -
Install dependencies: Open your terminal or command prompt and run:
pip install requests python-dotenv
-
Create a
.envfile: Create a file named.envin the same directory as the script and add your configuration:ACCESS_TOKEN=your_token COUNTRY_CODE=us
ACCESS_TOKEN: Use the token obtained in the Prerequisites section.COUNTRY_CODE(optional): Use the 2-letter ISO code (e.g., "US"). If you don't set this, the program will fetch a general recommended server.
-
Run the program: Execute the Python script:
python main.py
It will print the WireGuard configuration to your console and save it to a file (e.g.,
yyyymmdd-nordvpn-us.conf) in the current directory.
- https://gist.github.com/bluewalk/7b3db071c488c82c604baf76a42eaad3
- If you wanna support my work please use the reference link for register