Auto run "nordvpn connect (country)" Command on qube start? Safe setup of VPN in a qube/template

Could you provide me with more instructions about this or point me in a right direction.

If I am not mistaken I must provide my VPN template internet while making it because I must install nordvpn to it and maybe some other apps.
Or there is a workaround?

It is not a problem if I made a critical mistake to delete all and start again.
For security reasons

If I’m not mistaken with nordvpn you have to download a package that installs the repo. So download that package in another vm, then within that vm run qvm-copy <nordvpn-package> and select the nordvpn template. Finally in your nordvpn template run apt/dnf install /home/user/QubesIncoming/<vm-name>/<nordvpn-package>. Then run apt update; apt install nordvpn.

Otherwise, from within the nordvpn template you can run:

https_proxy=http://127.0.0.1:8082/ http_proxy=http://127.0.0.1:8082/ wget --secure-protocol=TLSv1_2 --timeout=180 <link-to-nordvpn-package> 

This will download the nordvpn package without having to connect the template to a netvm

I understand now, I must safely transfer file from other preferably disposable vm to my vpn template to avoid security risks. Or download it safe through template with other method you provided. All is clear here.

That still leaves this unclear. Bin-dirs will remember my login data in my appvm? Could you point me or provide some basic instructions

I have changed the title of this topic to include this if someone is searching the same stuff

Exactly. That way you don’t have to touch your template at all.
The main difficulty is finding where nordvpn stores the data.

Once you know what directory to preserve, you create a rule with the following commands (care to replace <dir> with the actual path), then restart the AppVM and finally login with your nordvpn account:

$ sudo mkdir -p /rw/config/qubes-bind-dirs.d
$ echo "binds+=( '<dir>' )" | sudo tee -a /rw/config/qubes-bind-dirs.d/50_user.conf

Now, I don’t know where the directory is, so you’ll have to do a bit of searching for yourself.

$ ls -aR ~/ | grep 'nordvpn\|Nordvpn'
$ ls -aR /etc | grep 'nordvpn\|Nordvpn'
$ ls -aR /opt | grep 'nordvpn\|Nordvpn'

These are just examples, unfortunately I can’t provide you much more help than this. If you can’t find it, you can try asking nordvpn support.

I have contacted them via live chat Their answer was that Nord doesn’t store login credentials, it stores a token.
After my question of the location of the token they had no answer.
So they opened a ticket with this question and told me that a “advanced technician’s team” will look further in to this and contact me via email as soon as possible.

So the above instructions are the same for token?

Yes

1 Like

I have received a response from nordvp about the location of login data

/var/lib/nordvpn/data/settings.dat

That’s how I did and it’s working:

  1. Create a file named nordvpn.sh (you can use teminal “sudo nano nordvpn.sh” or notepad)
  2. Type in this file:
#!/bin/bash
sudo systemctl enable nordvpn
sudo systemctl start nordvpn
nordvpn set killswitch on
nordvpn set notify on
nordvpn set killswitch on
nordvpn login --token "your token here"
nordvpn c

  1. move nordvpn.sh to /home/user/.config/autostart/nordvpn.sh in sys-vpn
  2. create a file named nordvpn.desktop (sudo nano or notepad)
  3. type in nordvpn.desktop
[Desktop Entry]
Type=Application
Exec=/bin/bash /home/user/.config/autostart/nordvpn.sh
Hidden-false
NoDisplay=false
Name=nordvpn
Comment=Connecting to nordvpn
  1. sudo chmod +x ~/.config/autostart/nordvpn.desktop && sudo chmod +x ~/.config/autostart/nordvpn.sh