jotyGill / openpyn-nordvpn

Easily connect to and switch between, OpenVPN servers hosted by NordVPN on Linux (+patch leakes)
GNU General Public License v3.0
628 stars 114 forks source link

Drop external dependencies and reduce usage of root #225

Closed ranisalt closed 5 years ago

ranisalt commented 5 years ago

I have removed the need for superuser access to store logs and VPN configuration, relying on user home locations instead. That makes it only needed to use root for connection, and I think that can be avoided too, so openpyn can be installed per user.

I also removed the need for external software such as unzip and wget by replacing with Python dependencies (zipfile and requests, respectively).

Edit: I intend to remove other popen calls if possible, replacing with Python code instead.

jotyGill commented 5 years ago

Thanks mate. When i started this project, I was too noob to know which is the better approach, using external tools like 'unzip' to not. Then i just kept it that way. @1951FDG Could you please have a look at this. If this works with your android app setup, I'll merge it (Thanks)

1951FDG commented 5 years ago

@jotyGill I'll have a look at this, this week, also to ensure it works on routerOS...

1951FDG commented 5 years ago

@jotyGill Hi,

Finally got around to reviewing and testing. The code was suddenly highly unstable, most likely due to no testing, so it's a good thing we review each other's code when we get the chance

@ranisalt Nice work, I've learned a couple of neat things from reviewing the code, just don't forget to run the code and run some tests before opening a pull request

@ranisalt I can help you with documentation on how to setup Atom for usage with Python to enable linting and other features if you're interested

Regarding changes I had to make, to make all working again :), see commit: https://github.com/jotyGill/openpyn-nordvpn/pull/226/commits/789717bdc3ff9bd0a2d9da18c5e85ffce56ff0d7

I've opened a pull request containing this one, https://github.com/jotyGill/openpyn-nordvpn/pull/226

This also includes a bugfix, https://github.com/jotyGill/openpyn-nordvpn/pull/226/commits/5b107567fdd1095218ce81edd856174781de80fc

ranisalt commented 5 years ago

using external tools like 'unzip' to not

I usually avoid external tools, e.g. I only have installed unzip and wget because of this (I use gzip and curl)

I can help you with documentation on how to setup Atom for usage with Python to enable linting and other features if you're interested

I don't use Atom, but it could be useful anyway to have a style guide.

Oh, I'm thinking on creating a support library to deal with systemd, instead of calling subprocess when needed.

ranisalt commented 5 years ago

The code was suddenly highly unstable, most likely due to no testing

I've been using this patched version for a few days now without any issues, no loss of connection, no errors, nothing out of usual, what exactly do you point as "highly unstable"?

1951FDG commented 5 years ago

@ranisalt Hi,

By "highly unstable" I meant the code would break at various points depending on the arguments passed to openpyn, but no worries it has been fixed in the new pull request...

arichiardi commented 5 years ago

I am trying this branch and while everything installs fine I then get this on connection:

2019-07-04 20:08:37 [SUCCESS] CONNECTING TO SERVER ca409 ON PORT udp
2019-07-04 20:08:37 [SUCCESS] Your OS 'linux' Does have '/sbin/resolvconf', using it to update DNS Resolver Entries
Thu Jul  4 20:08:38 2019 WARNING: Using --management on a TCP port WITHOUT passwords is STRONGLY discouraged and considered insecure
Thu Jul  4 20:08:38 2019 WARNING: cannot stat file '/home/kapitan/.local/lib/python3.7/site-packages/openpyn/credentials': No such file or directory (errno=2)
Options error: --auth-user-pass fails with '/home/kapitan/.local/lib/python3.7/site-packages/openpyn/credentials': No such file or directory (errno=2)
Options error: Please correct these errors.
Use --help for more information.

I have installed with python -m pip install --user --upgrade . and I am on Manjaro (Arch).

On openpyn --init I see:

2019-07-04 20:12:00 [INFO] Awesome, the credentials have been saved in '/home/kapitan/.local/share/openpyn/credentials'

Sorry to paste this here but I figured that @ranisalt would be interested.