NordSecurity / nordvpn-linux

NordVPN Linux client
GNU General Public License v3.0
303 stars 41 forks source link

DNS entries are sticking after disconnecting from NordVPN #26

Closed dbolger closed 3 months ago

dbolger commented 1 year ago

I have a static nameserver defined in /etc/dhcpcd.conf that is being overwritten and not being returned to /etc/resolv.conf after disconnecting from NordVPN.

Before connecting to NordVPN:

# Generated by resolvconf
nameserver 192.168.50.13

After connecting to NordVPN:

# Generated by NordVPN
nameserver 103.86.96.100
nameserver 103.86.99.100

After disconnecting from NordVPN:

# Generated by resolvconf
nameserver 103.86.96.100
nameserver 103.86.99.100
dbolger commented 1 year ago

Ah, I just noticed that Arch Linux isn't on the list of supported distros.

Is Arch support coming in the future?

Edit: #3, I'm blind

EmilijusS commented 1 year ago

Hello and thank you for reporting an issue. I couldn't reproduce it on Ubuntu and unfortunately we do not officially support Arch, so we aren't going to investigate this issue further at this time.

On the other hand we gladly accept community contributions and if a Pull Request with the fix would be created we could merge it.

saucecode commented 1 year ago

Since this is appears as a top search result, I now share how I fixed this on my arch machine.

After disconnecting with nordvpn d and DNS requests stopped working.

/etc/resolv.conf still showed the NordVPN name servers. The command resolvectl also confirms that those nameservers are still loaded.

I manually edited /etc/resolvconf adding 1.1.1.1 and 8.8.8.8, then ran sudo systemctl restart systemd-resolved

Confirmed that the changes are reflected when running resolvectl.

pyro12 commented 3 months ago

Greetings. I'm also on Arch. I sometimes use Nord and sometimes use PIA VPN's. Pretty sure this issue started with 3.13.18-1 for me, but I can't be certain as I hadn't used PIA for awhile. When I tried to use PIA today, it wouldn't connect and gave the error, "could not resolve DNS settings."

My resolv.conf was stuck on

# Generated by NordVPN
nameserver 103.86.96.100
nameserver 103.86.99.100

even when nord was disconnected. Also, my resolv.conf had been rendered immutable. I checked, and it IS NOT a symlink to /run/NetworkManager/resolv.conf. Pretty sure PIA wanted to make its own changes to /etc/resolv.conf and couldn't.

lsattr /etc/resolv.conf

if there's an 'i' in the output then it is immutable. (something like ------i---------- /etc/resolv.conf)

sudo chattr -i /etc/resolv.conf

to remove the 'i' attribute

All seems well again. I DID NOT like having to do this. I can understand nord taking control of that file while connected, but it should release it and change it back when disconnected - especially if the kill switch is disabled - which it was for me:

$ nordvpn settings
Technology: NORDLYNX
Firewall: disabled
Firewall Mark: 0xe1f1
Routing: enabled
Analytics: enabled
Kill Switch: disabled
Threat Protection Lite: disabled
Notify: enabled
Auto-connect: disabled
IPv6: disabled
Meshnet: disabled
DNS: disabled
LAN Discovery: disabled
Allowlisted subnets:
        10.42.0.0/24

Maybe I'm wrong and this isn't nord refusing to give back control, but an immutable file whose first line is #Generated by NordVPN makes me think nord did this.

mariusSincovici commented 3 months ago

Hi, thanks for updates. If the file contains # Generated by NordVPN that means it was modified by the NordVPN app and they should be cleared at disconnect. Unfortunately we cannot reproduce this on our side, but we'll try to add some more checks for this case in the upcoming releases, maybe it will prevent this.

Do you know by any chance is the daemon crashed or was killed before this?

pyro12 commented 3 months ago

@mariusSincovici

I am positive that I disconnected with 'nordvpn d' so I would think that it was running. I also connected/disconnected a few times while trying to fix the issue.

keliramu commented 3 months ago

Hi, there are improvements in handling/recovering resolv.conf check this commit. To be released with next version v3.18.3 soon.

keliramu commented 3 months ago

Closing this issue now.