Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about installation #160

Open
Jorman opened this issue Jun 6, 2018 · 15 comments
Open

Question about installation #160

Jorman opened this issue Jun 6, 2018 · 15 comments

Comments

@Jorman
Copy link

Jorman commented Jun 6, 2018

Hi, I just discovered this script and I think is quite good for my purpose, seems very good script!

I'm on a qnap system and qnap offer only qvpn service, an application where I've to load the openvpn profile and manually connect to it, so I've always to check if the connection are good and don't "risk" to use my ip.

So my "hope" is to make it automatic, like I give to the script my nordvpn credential, then the script connect to the vpn and if the connection go down, switch to another server.

I think that is pretty much the function that the script do, but I've 2 questions

  1. There's any plan or any way to "select" which service go over the vpn?

  2. Anyone have installed this on a Qnap system? Is based on entware and I've this available

opkg list | grep openvpn
collectd-mod-openvpn - 5.8.0-5 - OpenVPN traffic/compression input plugin
openvpn-easy-rsa - 3.0.1-1 - CLI utility to build and manage a PKI CA.
openvpn-nossl - 2.4.5-3 - Open source VPN solution using plaintext (no SSL)
openvpn-openssl - 2.4.5-3 - Open source VPN solution using OpenSSL

Jo

@Jorman
Copy link
Author

Jorman commented Jun 6, 2018

Tried to install, works!

Tried to configure, don't

sudo: unknown user: root
sudo: unable to initialize policy plugin
Traceback (most recent call last):
  File "/opt/bin/openpyn", line 11, in <module>
    load_entry_point('openpyn==2.6.0', 'console_scripts', 'openpyn')()
  File "/opt/lib/python3.6/site-packages/openpyn/openpyn.py", line 130, in main
    args.skip_dns_patch, args.silent, args.nvram, args.openvpn_options)
  File "/opt/lib/python3.6/site-packages/openpyn/openpyn.py", line 165, in run
    initialise()
  File "/opt/lib/python3.6/site-packages/openpyn/openpyn.py", line 349, in initialise
    credentials.save_credentials()
  File "/opt/lib/python3.6/site-packages/openpyn/credentials.py", line 32, in save_credentials
    subprocess.check_call(["sudo", "chmod", "600", credentials_file_path])
  File "/subprocess.py", line 291, in check_call
subprocess.CalledProcessError: Command '['sudo', 'chmod', '600', '/opt/lib/python3.6/site-packages/openpyn/credentials']' returned non-zero exit status 1.

Any idea?

@jotyGill
Copy link
Owner

Hi Jo,

Thanks.

1 There's any plan or any way to "select" which service go over the vpn?
Ans: Not within openpyn But check out https://github.com/mrahmadt/SmartGW

2: no idea mate.

In this case, you can't seem to run commands as sudo command as your system doesn't have user 'root' in it. maybe create a user called root and give it root permissions. openpyn uses a lot of commands as sudo command to gain root access for changing iptables, running openvpn, etc..
I can't just have the script run as root cause that way you can't have desktop notifications. that's the way things are unfortunately.

@Jorman
Copy link
Author

Jorman commented Aug 31, 2018

Thanks I'll look into it!

Not possible to implement some flag, like the one for asus, to skip this command as sudo? So maybe you can handle with one or more flag this situation and the one for entware systems, this one
#168 (comment)

What do you think?

@jotyGill
Copy link
Owner

would have been easy if it was a few commands. throughout the program there would be >50 commands being run as sudo. I'll see what I can do

@Jorman
Copy link
Author

Jorman commented Sep 11, 2018

Wow! A lot of commands.

I don't know if simply installing sudo and run the program like root can be enough

@jotyGill
Copy link
Owner

jotyGill commented Sep 17, 2018

Most of them are for the '-f' switch anyway. give it a go.

@xmflsct
Copy link

xmflsct commented Feb 18, 2019

Same problem here on asus-merlin.. Cannot even run init and add a credential file as it says there is no root user. How can I do?

@1951FDG
Copy link
Contributor

1951FDG commented Feb 19, 2019

@xmflsct Have you followed instructions as outlined in README

# common dependencies
opkg install git git-http iputils-ping procps-ng-pgrep python3 python3-pip sudo unzip wget
cd /tmp/share/
git clone https://github.com/jotyGill/openpyn-nordvpn.git
cd openpyn-nordvpn/
git pull
pip3 install --upgrade setuptools
pip3 install --upgrade .

@xmflsct
Copy link

xmflsct commented Feb 20, 2019

@1951FDG Yes, installation is completed, and I can run openpyn -h without problem.
When I run openpyn --init after I typed in my username and password, it terminated saying that there is no root user in sudoers. I can see that credential file has been generated. It seems like asus-merlin does not allow to have a user named root.

@salvq
Copy link

salvq commented Oct 10, 2021

@xmflsct have you been able to run openpyn --init ? I currently stuck on the below error on Asus merlin, installation all OK.

Enter the password for NordVPN:
sudo: unknown user: root
sudo: unable to initialize policy plugin
Traceback (most recent call last):
  File "/opt/bin/openpyn", line 33, in <module>
    sys.exit(load_entry_point('openpyn==2.7.5', 'console_scripts', 'openpyn')())
  File "/opt/lib/python3.9/site-packages/openpyn/openpyn.py", line 138, in main
    return_code = run(
  File "/opt/lib/python3.9/site-packages/openpyn/openpyn.py", line 156, in run
    initialise(log_folder)
  File "/opt/lib/python3.9/site-packages/openpyn/openpyn.py", line 442, in initialise
    credentials.save_credentials()
  File "/opt/lib/python3.9/site-packages/openpyn/credentials.py", line 42, in save_credentials
    subprocess.check_call(["sudo", "chmod", "600", credentials_file_path])
  File "/opt/lib/python3.9/subprocess.py", line 373, in check_call
subprocess.CalledProcessError: Command '['sudo', 'chmod', '600', '/opt/lib/python3.9/site-packages/openpyn/credentials']' returned non-zero exit status 1.

Thanks for help

@xmflsct
Copy link

xmflsct commented Oct 10, 2021

@salvq sorry I am not using this library anymore.

@salvq
Copy link

salvq commented Oct 10, 2021

@salvq sorry I am not using this library anymore.

I see, have you found some alternative for asus merlin ?

Thanks

@xmflsct
Copy link

xmflsct commented Oct 11, 2021

@salvq Nope. I was using mannual OpenVPN settings for a while before switching to running NordVPN on my Raspberry Pi.

@1951FDG
Copy link
Contributor

1951FDG commented Oct 12, 2021

@salvq

I'm the maintainer for the Asus Merlin part of the code

A change was made in the latest test branch to address the fact that some systems don't have a user named root:
f0bd26a#diff-a925c95e804261d8dcf5a2768740fe03e3c9de4edd0d3acbc111d88cf91013fd

Allow admin user to run sudo

sed -i 's~root ALL=(ALL) ALL~admin ALL=(ALL) ALL~g' /opt/etc/sudoers

Install the test branch

cd /tmp/share/
git clone --branch test https://github.com/jotyGill/openpyn-nordvpn.git
cd openpyn-nordvpn/
python3 -m pip install --upgrade pip
python3 -m pip install --upgrade .

Always also refer to the readme of the test branch, which is the most up to date readme:
https://github.com/jotyGill/openpyn-nordvpn/blob/test/README.md

@salvq
Copy link

salvq commented Oct 13, 2021

Thanks for the help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants