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

Error connecting on Arch Linux #57

Closed
ghost opened this issue Sep 23, 2017 · 7 comments
Closed

Error connecting on Arch Linux #57

ghost opened this issue Sep 23, 2017 · 7 comments

Comments

@ghost
Copy link

ghost commented Sep 23, 2017

sudo openpyn it
According to NordVPN, Least Busy 4 Servers, In IT With 'Load' less than 70 Which Support OPENVPN-TCP are : [['it15', 7], ['it18', 8], ['it13', 9], ['it7', 11]]

Pinging Server it15 min/avg/max/mdev = [15, 15, 15, 0]

Pinging Server it18 min/avg/max/mdev = [15, 15, 15, 0]

Pinging Server it13 min/avg/max/mdev = [26, 27, 27, 0]

Pinging Server it7 min/avg/max/mdev = [15, 15, 17, 0]

Top 4 Servers with best Ping are: ['it15', 'it18', 'it7', 'it13']

Out of the Best Available Servers, Chose it15
CONNECTING TO SERVER it15 ON PORT tcp443
Traceback (most recent call last):
File "/usr/bin/openpyn", line 11, in
load_entry_point('openpyn==1.7.3', 'console_scripts', 'openpyn')()
File "/usr/lib/python3.6/site-packages/openpyn/openpyn.py", line 116, in main
args.skip_dns_patch)
File "/usr/lib/python3.6/site-packages/openpyn/openpyn.py", line 216, in run
connection = connect(aserver, port, daemon, test, skip_dns_patch)
File "/usr/lib/python3.6/site-packages/openpyn/openpyn.py", line 578, in connect
if root.running_with_sudo():
File "/usr/lib/python3.6/site-packages/openpyn/root.py", line 55, in running_with_sudo
logged_in_user = os.getlogin()
FileNotFoundError: [Errno 2] No such file or directory

@jotyGill
Copy link
Owner

I see. So this python's OS module's function "os.getlogin()" is not designed for Arch Linux. I'll use something else that hopefully works with every os. Btw when installing with Pip3 on Arch, does it create the folder "/usr/share/openpyn" ? Debian is no longer letting Pip create folders or store files in any other location than the default location.

jotyGill added a commit that referenced this issue Sep 24, 2017
@jotyGill
Copy link
Owner

jotyGill commented Sep 24, 2017

openpyn needs to know if it is being run using "sudo", notifications are not allowed if a script is running as root using "su" or "sudo". They work fine if you are logged in as "root".

I tried a bunch of other ways to find out if the logged in user is not "root" it self.
using:
pwd.getpwuid(os.getuid())[0]
getpass.getuser()
shell environment variables "USER" and "LOGNAME"
os.environ["USER"]
os.environ["LOGNAME"]
test.py.txt

None of these work the way I need them to. shell variables worked fine on Fedora but not on "Debian" or "Ubuntu" (when running a script with sudo, they say the user is root).
So the best option for now is to just use os.getlogin() and handle the exception.

To receive desktop notification run it without "sudo" then supply sudo credentials when needed.

PS. Could you please test it out on Arch and let me know.

git clone --branch test https://github.com/jotyGill/openpyn-nordvpn.git
cd openpyn-nordvpn
sudo python3 setup.py install

Cheers :)

@ghost
Copy link
Author

ghost commented Sep 24, 2017

I test it on Arch :

`╰─➤ sudo openpyn it -u -p2p -m 45 -d
According to NordVPN, Least Busy 4 Servers, In IT With 'Load' less than 45 Which Support OPENVPN-UDP are : [['it14', 13], ['it16', 15], ['it18', 16], ['it8', 17]]

Pinging Server it14 min/avg/max/mdev = [14, 15, 15, 0]

Pinging Server it16 min/avg/max/mdev = [15, 15, 15, 0]

Pinging Server it18 min/avg/max/mdev = [14, 14, 15, 0]

Pinging Server it8 min/avg/max/mdev = [26, 26, 26, 0]

Top 4 Servers with best Ping are: ['it18', 'it14', 'it16', 'it8']

CONNECTING TO SERVER it18 ON PORT udp1194
os.getlogin, returned error, assuming 'openpyn' is running without 'SUDO'
Started 'openvpn' in--daemonmode
Options error: In [CMD-LINE]:1: Error opening configuration file: /usr/share/openpyn/files/it18.nordvpn.com.udp1194.ovpn
Use --help for more information.
╭─ubermensch@netblackbook ~
╰─➤ openpyn it -u -p2p -m 45 -d
According to NordVPN, Least Busy 4 Servers, In IT With 'Load' less than 45 Which Support OPENVPN-UDP are : [['it12', 10], ['it14', 12], ['it8', 15], ['it18', 15]]

Pinging Server it12 min/avg/max/mdev = [16, 16, 16, 0]

Pinging Server it14 min/avg/max/mdev = [16, 69, 121, 52]

Pinging Server it8 min/avg/max/mdev = [28, 28, 28, 0]

Pinging Server it18 min/avg/max/mdev = [15, 15, 15, 0]

Top 4 Servers with best Ping are: ['it18', 'it12', 'it8', 'it14']

CONNECTING TO SERVER it18 ON PORT udp1194
Started 'openvpn' in--daemonmode
Options error: In [CMD-LINE]:1: Error opening configuration file: /usr/share/openpyn/files/it18.nordvpn.com.udp1194.ovpn
Use --help for more information.
`

@ghost
Copy link
Author

ghost commented Sep 24, 2017

The problem appear only with "-d" option is very strange :(

@ghost
Copy link
Author

ghost commented Sep 24, 2017

New error : `╭─ubermensch@netblackbook ~
╰─➤ sudo openpyn it -u -p2p -m 45 -d
According to NordVPN, Least Busy 4 Servers, In IT With 'Load' less than 45 Which Support OPENVPN-UDP are : [['it14', 10], ['it17', 10], ['it19', 11], ['it18', 12]]

Pinging Server it14 min/avg/max/mdev = [15, 15, 16, 0]

Pinging Server it17 min/avg/max/mdev = [16, 16, 16, 0]

Pinging Server it19 min/avg/max/mdev = [15, 19, 23, 4]

Pinging Server it18 min/avg/max/mdev = [15, 16, 17, 0]

Top 4 Servers with best Ping are: ['it14', 'it17', 'it18', 'it19']

CONNECTING TO SERVER it14 ON PORT udp1194
os.getlogin, returned error, assuming 'openpyn' is running without 'SUDO'
Started 'openvpn' in--daemonmode
╭─ubermensch@netblackbook ~
╰─➤ Traceback (most recent call last):
File "/usr/bin/openpyn-management", line 11, in
load_entry_point('openpyn==1.7.3', 'console_scripts', 'openpyn-management')()
File "/usr/lib/python3.6/site-packages/openpyn-1.7.3-py3.6.egg/openpyn/management/management.py", line 34, in show
notification.show()
GLib.Error: g-spawn-exit-error-quark: Error spawning command line “dbus-launch --autolaunch=067a14c930a848829d89427779bfda27 --binary-syntax --close-stderr”: Child process exited with code 1 (1)
Traceback (most recent call last):
File "/usr/bin/openpyn-management", line 11, in
load_entry_point('openpyn==1.7.3', 'console_scripts', 'openpyn-management')()
File "/usr/lib/python3.6/site-packages/openpyn-1.7.3-py3.6.egg/openpyn/management/management.py", line 34, in show
notification.show()
GLib.Error: g-io-error-quark: The connection is closed (18)

`

@jotyGill
Copy link
Owner

jotyGill commented Sep 25, 2017

Bruh as I stated earlier don't run it with 'sudo' for the notifications to work. btw now if it is run using 'sudo', it will just warn you about notifications but won't give you an error. 3dfbdc4

For this "Options error: In [CMD-LINE]:1: Error opening configuration file: /usr/share/openpyn/files/it18.nordvpn.com.udp1194.ovpn"

Can you make sure you have files in /usr/share/openpyn/files ?

And update your config files (openpyn --update) it could be that server you were trying to connect to was recently added and did not have a config yet. Cheers.
(actually yeah: the server it18.nordvpn.com.udp1194.ovpn was added very recently)

@jotyGill
Copy link
Owner

If all is good now. I'll close this issue.

@jotyGill jotyGill closed this as completed Oct 8, 2017
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

1 participant