morpheusthewhite / nordpy

A gui application to connect automatically to the recommended NordVPN server
GNU General Public License v3.0
105 stars 16 forks source link

Root password window not responding #23

Closed Kruk79 closed 5 years ago

Kruk79 commented 5 years ago

Hi

I have updated my Pi 3 from Stretch to Buster and since then I was heaving problems with NordPy windows. I thought that I will reinstall everything as I hadthe same with few other apps and this helped.

With NordPy reinstall something went wrong and I can't run it again. Also I accidentally removed the desktop icon and it does not appear after reinstall.

Can you help me with this? I'm not experienced with Linux/Raspbian. Can I somehow remove all related to NordVPN / NordPy and start from beginning or fix what I have installed already?

Please see some info from terminal:

pi@raspberrypi:~ $ sudo apt-get install strongswan strongswan-ikev2 libstrongswan-standard-plugins libstrongswan-extra-plugins libcharon-extra-plugins Reading package lists... Done Building dependency tree
Reading state information... Done libcharon-extra-plugins is already the newest version (5.7.2-1). libstrongswan-extra-plugins is already the newest version (5.7.2-1). libstrongswan-standard-plugins is already the newest version (5.7.2-1). strongswan is already the newest version (5.7.2-1). strongswan-ikev2 is already the newest version (5.5.1-4+deb9u4). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

pi@raspberrypi:~ $ sudo apt-get install networkmanager-openvpn Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package networkmanager-openvpn

pi@raspberrypi:~ $ sudo apt-get install automake autoconf perl gnupg quilt libtool openssl-devel lzo-devel pam-devel net-tools Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package openssl-devel E: Unable to locate package lzo-devel E: Unable to locate package pam-devel

pi@raspberrypi:~ $ sudo /home/pi/NordPy-master/install.sh Do you want to install support for obfuscated servers (it will reinstall openvpn)?[y/n] (Recommended: n) n Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package openpn sudo: dnf: command not found sudo: pacman: command not found Reading package lists... Done Building dependency tree
Reading state information... Done openvpn is already the newest version (2.4.7-1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Required packages installed installing certificates (needed by ipsec) downloading and extracting conf files from NordVPN

Edit 1:

I managed to get the icon back. There was an issue with folders. Somehow folders have been relocated.

Now when I try to open the app I have the window for password, I'm keying the password and after pressing ok nothing is happening. The window itself looks not correct .

image

and resized:

image

morpheusthewhite commented 5 years ago

Can you go to the folder you cloned and run ./nordpy? Paste here the output please

Kruk79 commented 5 years ago

I'm getting this:

image

Am I doing something wrong?

morpheusthewhite commented 5 years ago

I mean run ./nordpy

Kruk79 commented 5 years ago

This is what I got:

image

Should I run it in this folder?

image

morpheusthewhite commented 5 years ago

Sorry, I forgot the extension, it is

./nordpy.py

Kruk79 commented 5 years ago

Thanks

Traceback (most recent call last): File "./nordpy.py", line 27, in main() File "./nordpy.py", line 21, in main from bin.gui import gui File "/home/pi/NordPy-master/bin/gui.py", line 4, in from bin.gui_components.manual_selection_frame import File "/home/pi/NordPy-master/bin/gui_components/manual_selection_frame.py", line 1, in from bin.gui_components.manual_selection_window import File "/home/pi/NordPy-master/bin/gui_components/manual_selection_window.py", line 9, in SERVERS_DICT = get_available_servers_dict() File "/home/pi/NordPy-master/bin/conf_util.py", line 92, in get_available_servers_dict servers_entire_names = os.listdir(CURRENT_PATH + "ovpn_tcp/") FileNotFoundError: [Errno 2] No such file or directory: '/home/pi/NordPy-master/ovpn_tcp/' Retrieved stats Retrieved stats

I noticed that open-tcp was missing so I copied it and run it again:

Traceback (most recent call last): File "./nordpy.py", line 27, in main() File "./nordpy.py", line 21, in main from bin.gui import gui File "/home/pi/NordPy-master/bin/gui.py", line 10, in from bin.vpn_util.vpn import * File "/home/pi/NordPy-master/bin/vpn_util/vpn.py", line 3, in from bin.vpn_util.nm import nm_running_vpn, nm_disconnect, nm_connect, nm_openvpn_exists File "/home/pi/NordPy-master/bin/vpn_util/nm.py", line 5, in from bin.vpn_util.openvpn import get_path_to_conf, PROTOCOLS ImportError: cannot import name 'PROTOCOLS' from 'bin.vpn_util.openvpn' (/home/pi/NordPy-master/bin/vpn_util/openvpn.py) Retrieved stats Retrieved stats

morpheusthewhite commented 5 years ago

I cannot reproduce the error; have you downloaded the latest version? Try git pull in the cloned directory

If that doesn't help try cloning again the project and relaunch the installation

Kruk79 commented 5 years ago

Should I place the cloned project in a specific location? Currently I have it in home/pi/download I think. I'm at work now but check later tour suggestion re git pull. Sorry I'm not expert but git pull should be done in main terminal window or from specific folder?

Thanks.

morpheusthewhite commented 5 years ago

It's not important the location of the folder, you can put it where it was before

The git pull should be done in the cloned folder

Kruk79 commented 5 years ago

Hi

Please see below:

pi@raspberrypi:~/NordPy-master $ git pull fatal: not a git repository (or any of the parent directories): .git

I downloaded the zip file again and run install.sh

pi@raspberrypi:~/NordPy-master $ sudo /home/pi/NordPy-master/install.sh Do you want to install support for obfuscated servers (it will reinstall openvpn)?[y/n] (Recommended: n) n Reading package lists... Done Building dependency tree
Reading state information... Done E: Unable to locate package openpn sudo: dnf: command not found sudo: pacman: command not found Reading package lists... Done Building dependency tree
Reading state information... Done openvpn is already the newest version (2.4.7-1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Required packages installed installing certificates (needed by ipsec) downloading and extracting conf files from NordVPN

morpheusthewhite commented 5 years ago

ok, now try to run again ./nordpy.py

Kruk79 commented 5 years ago

Please see below Screenshot_20190705-173508_TeamViewer

If you are out if ideas can you let me know what to remove completly and how from my pi to start with clean sheet and try to install this again from scratch.

Thanks

morpheusthewhite commented 5 years ago

That's very strange, the error is caused by a variable not found in a Module, while I can clearly see that it's present. Can you please

1) post here the content of bin/vpn_util/openvpn.py

2) Use this version of NordPy https://github.com/morpheusthewhite/NordPy/archive/1.2.tar.gz Again, extract it, launch the installation and then ./nordpy.py

Kruk79 commented 5 years ago

Content of openvpn.py

from bin.conf_util import get_path_to_conf
from bin.credentials import *
from bin.root import *
from bin.logging_util import get_logger
from bin.vpn_util.exceptions import LoginError, OpenresolvError
from bin.vpn_util.killswitch import killswitch_up, killswitch_down

import signal

MAXIMUM_TRIES = 2
IKEV2_PROTOCOL_NUMBER = 2
TIMEOUT_TIME = 10
logger = get_logger(__name__)

def timeout_handler(signum, frame):
    raise TimeoutError

# registers the handler for the signal
signal.signal(signal.SIGALRM, timeout_handler)

def start_openvpn(server, protocol):
    """
    starts openvpn connection with a certain protocol to a specific server. Raise a ConnectionError
    if the connection failed, a LoginError if the credentials are wrong or a OpenresolvError if openresolv is missing
    :param server: the server to which the connection will be established
    :param protocol: the protocol to be used (an integer)
    """
    pathToConf = get_path_to_conf(server, protocol)
    args = ["sudo", "openvpn", "--config", pathToConf, "--auth-user-pass", CURRENT_PATH + CREDENTIALS_FILENAME,
            # to prevent dns leaks
            "--script-security", "2", "--up", os.path.join(CURRENT_PATH, "scripts", "nordpy_up.sh"), "--down",
            os.path.join(CURRENT_PATH, "scripts", "nordpy_down.sh")]

    tries = 0
    while tries < MAXIMUM_TRIES:

        # activate killswitch
        killswitch_up(server, protocol)

        openvpn = subprocess.Popen(args, stdin=subprocess.PIPE, universal_newlines=True, stdout=subprocess.PIPE)

        signal.alarm(TIMEOUT_TIME)

        try:
            while True:
                line = openvpn.stdout.readline()

                if not line.strip() == '':
                    logger.debug("[OPENVPN]: "+line)

                if "Initialization Sequence Completed" in line:
                    # success !
                    signal.alarm(0)
                    return openvpn
                elif "connection failed" in line or "Exiting" in line:
                    tries += 1
                    openvpn_stop()
                    break

                elif "AUTH_FAILED" in line:
                    # something's wrong
                    signal.alarm(0)
                    killswitch_down()
                    raise LoginError

                # missing script
                elif "script fails with" in line:
                    signal.alarm(0)
                    killswitch_down()
                    raise OpenresolvError

        except TimeoutError:
            logger.warning("expired timeout for openvpn connection")
            tries += 1
            openvpn_stop()

    signal.alarm(0)

    # sometimes openvpn.kill() doesn't close the launched processes
    openvpn_stop()

    raise ConnectionError

def openvpn_stop():
    """
    Closes all runnning openvpn processes
    """
    killswitch_down()
    subprocess.Popen(["sudo", "killall", "openvpn"]).communicate()

def checkOpenVPN():
    """
    Checks if a openvpn process is already running
    :return: True if is running, False otherwise
    """
    c = subprocess.Popen(["ps ax | grep openvpn | grep -v grep"], stdout=subprocess.PIPE, shell=True, universal_newlines=True)
    (out, _) = c.communicate()
    if out != '':
        return True
    return False

I installed the one from above link and it worked. However window is not resized properly.

image

image

The other problem I now have is I can't connect to UDP or TCP. I have error connecting. I had the same some time ago but somehow I managed to resolve it. I just do not remember how. Any suggestions?

I can connect via ikev/IPsec.

morpheusthewhite commented 5 years ago

1) That's strange, the file seems not to be updated with the latest commit

2) You can increase the scale factor in the advanced option to fix the size problem Again, after launching NordPy from terminal try to connect and paste here the output on terminal

Kruk79 commented 5 years ago

After using scale factor 1.1 the main window is ok. The one with servers list still the same:

image

Info form terminal:

pi@raspberrypi:~/NordPy-1.2 $ ./nordpy.py Read a factor scale of 1.1 and False Retrieved stats Retrieved stats Verifing saved file File is correct sudo: openvpn: command not found expired timeout for openvpn connection sudo: openvpn: command not found expired timeout for openvpn connection openvpn: no process found

morpheusthewhite commented 5 years ago

The window with server misses the button, am I wrong?

The solution is to install openvpn sudo apt-get install openvpn

Kruk79 commented 5 years ago

Window have buttons. I just need to resize the window manually.

image

I tried to install it again:

pi@raspberrypi:~/NordPy-1.2 $ sudo apt-get install openvpn Reading package lists... Done Building dependency tree
Reading state information... Done openvpn is already the newest version (2.4.7-1). 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Edit:

I purged the openvpn and install it again and I can now connect to TCP and UDP.

Many thanks for your help and assistance.

morpheusthewhite commented 5 years ago

You're welcome

I'll soon fix the buttons in the manual connection window

morpheusthewhite commented 5 years ago

I fixed the wrong import in the last commit

Kruk79 commented 5 years ago

Thanks for your hard work. Should I update my version or I don't need to?

morpheusthewhite commented 5 years ago

I'll soon fix other bugs and release the 1.3, you should wait for it if you want killswitch

morpheusthewhite commented 5 years ago

All seems to be resolved with the last commits, let me know if you find other problems

Kruk79 commented 5 years ago

Hi

Sorry to trouble you again. After this new version once connected I do not have access to internet.

In browser can't access any website.

pi@raspberrypi:~/NordPy-master $ ./nordpy.py Read a factor scale of 1.2 and False Retrieved stats Retrieved stats Key not found Read a factor scale of 1.2 and False [OPENVPN]: Sun Jul 7 11:07:58 2019 OpenVPN 2.4.7 arm-unknown-linux-gnueabihf [SSL (OpenSSL)] [LZO] [LZ4] [EPOLL] [PKCS11] [MH/PKTINFO] [AEAD] built on Feb 20 2019

[OPENVPN]: Sun Jul 7 11:07:58 2019 library versions: OpenSSL 1.1.1c 28 May 2019, LZO 2.10

[OPENVPN]: Sun Jul 7 11:07:58 2019 WARNING: --ping should normally be used with --ping-restart or --ping-exit

[OPENVPN]: Sun Jul 7 11:07:58 2019 NOTE: the current --script-security setting may allow this configuration to call user-defined scripts

[OPENVPN]: Sun Jul 7 11:07:58 2019 NOTE: --fast-io is disabled since we are not using UDP

[OPENVPN]: Sun Jul 7 11:07:58 2019 Outgoing Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication

[OPENVPN]: Sun Jul 7 11:07:58 2019 Incoming Control Channel Authentication: Using 512 bit message hash 'SHA512' for HMAC authentication

[OPENVPN]: Sun Jul 7 11:07:58 2019 TCP/UDP: Preserving recently used remote address: [AF_INET]93.190.140.150:443

[OPENVPN]: Sun Jul 7 11:07:58 2019 Socket Buffers: R=[87380->87380] S=[16384->16384]

[OPENVPN]: Sun Jul 7 11:07:58 2019 Attempting to establish TCP connection with [AF_INET]93.190.140.150:443 [nonblock]

[OPENVPN]: Sun Jul 7 11:07:59 2019 TCP connection established with [AF_INET]93.190.140.150:443

[OPENVPN]: Sun Jul 7 11:07:59 2019 TCP_CLIENT link local: (not bound)

[OPENVPN]: Sun Jul 7 11:07:59 2019 TCP_CLIENT link remote: [AF_INET]93.190.140.150:443

[OPENVPN]: Sun Jul 7 11:07:59 2019 TLS: Initial packet from [AF_INET]93.190.140.150:443, sid=5d53987e fed710cf

[OPENVPN]: Sun Jul 7 11:07:59 2019 WARNING: this configuration may cache passwords in memory -- use the auth-nocache option to prevent this

[OPENVPN]: Sun Jul 7 11:07:59 2019 VERIFY OK: depth=2, C=PA, O=NordVPN, CN=NordVPN Root CA

[OPENVPN]: Sun Jul 7 11:07:59 2019 VERIFY OK: depth=1, C=PA, O=NordVPN, CN=NordVPN CA3

[OPENVPN]: Sun Jul 7 11:07:59 2019 VERIFY KU OK

[OPENVPN]: Sun Jul 7 11:07:59 2019 Validating certificate extended key usage

[OPENVPN]: Sun Jul 7 11:07:59 2019 ++ Certificate has EKU (str) TLS Web Server Authentication, expects TLS Web Server Authentication

[OPENVPN]: Sun Jul 7 11:07:59 2019 VERIFY EKU OK

[OPENVPN]: Sun Jul 7 11:07:59 2019 VERIFY OK: depth=0, CN=nl112.nordvpn.com

[OPENVPN]: Sun Jul 7 11:08:00 2019 Control Channel: TLSv1.2, cipher TLSv1.2 ECDHE-RSA-AES256-GCM-SHA384, 4096 bit RSA

[OPENVPN]: Sun Jul 7 11:08:00 2019 [nl112.nordvpn.com] Peer Connection Initiated with [AF_INET]93.190.140.150:443

[OPENVPN]: Sun Jul 7 11:08:01 2019 PUSH: Received control message: 'PUSH_REPLY,redirect-gateway def1,dhcp-option DNS 103.86.96.100,dhcp-option DNS 103.86.99.100,sndbuf 524288,rcvbuf 524288,explicit-exit-notify,comp-lzo no,route-gateway 10.7.7.1,topology subnet,ping 60,ping-restart 180,ifconfig 10.7.7.6 255.255.255.0,peer-id 0,cipher AES-256-GCM'

[OPENVPN]: Sun Jul 7 11:08:01 2019 OPTIONS IMPORT: timers and/or timeouts modified

[OPENVPN]: Sun Jul 7 11:08:01 2019 OPTIONS IMPORT: --explicit-exit-notify can only be used with --proto udp

[OPENVPN]: Sun Jul 7 11:08:01 2019 OPTIONS IMPORT: compression parms modified

[OPENVPN]: Sun Jul 7 11:08:01 2019 OPTIONS IMPORT: --sndbuf/--rcvbuf options modified

[OPENVPN]: Sun Jul 7 11:08:01 2019 Socket Buffers: R=[341760->327680] S=[44800->327680]

[OPENVPN]: Sun Jul 7 11:08:01 2019 OPTIONS IMPORT: --ifconfig/up options modified

[OPENVPN]: Sun Jul 7 11:08:01 2019 OPTIONS IMPORT: route options modified

[OPENVPN]: Sun Jul 7 11:08:01 2019 OPTIONS IMPORT: route-related options modified

[OPENVPN]: Sun Jul 7 11:08:01 2019 OPTIONS IMPORT: --ip-win32 and/or --dhcp-option options modified

[OPENVPN]: Sun Jul 7 11:08:01 2019 OPTIONS IMPORT: peer-id set

[OPENVPN]: Sun Jul 7 11:08:01 2019 OPTIONS IMPORT: adjusting link_mtu to 1659

[OPENVPN]: Sun Jul 7 11:08:01 2019 OPTIONS IMPORT: data channel crypto options modified

[OPENVPN]: Sun Jul 7 11:08:01 2019 Data Channel: using negotiated cipher 'AES-256-GCM'

[OPENVPN]: Sun Jul 7 11:08:01 2019 Outgoing Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key

[OPENVPN]: Sun Jul 7 11:08:01 2019 Incoming Data Channel: Cipher 'AES-256-GCM' initialized with 256 bit key

[OPENVPN]: Sun Jul 7 11:08:01 2019 ROUTE_GATEWAY 192.168.0.1/255.255.255.0 IFACE=eth0 HWADDR=b8:27:eb:35:6d:f7

[OPENVPN]: Sun Jul 7 11:08:01 2019 TUN/TAP device tun0 opened

[OPENVPN]: Sun Jul 7 11:08:01 2019 TUN/TAP TX queue length set to 100

[OPENVPN]: Sun Jul 7 11:08:01 2019 /sbin/ip link set dev tun0 up mtu 1500

[OPENVPN]: Sun Jul 7 11:08:01 2019 /sbin/ip addr add dev tun0 10.7.7.6/24 broadcast 10.7.7.255

[OPENVPN]: Sun Jul 7 11:08:01 2019 /home/pi/NordPy-master/scripts/nordpy_up.sh tun0 1500 1587 10.7.7.6 255.255.255.0 init

[OPENVPN]: Sun Jul 7 11:08:01 2019 /sbin/ip route add 93.190.140.150/32 via 192.168.0.1

[OPENVPN]: Sun Jul 7 11:08:01 2019 /sbin/ip route add 0.0.0.0/1 via 10.7.7.1

[OPENVPN]: Sun Jul 7 11:08:01 2019 /sbin/ip route add 128.0.0.0/1 via 10.7.7.1

[OPENVPN]: Sun Jul 7 11:08:01 2019 Initialization Sequence Completed

morpheusthewhite commented 5 years ago

Can you run in a terminal sudo route and paste here the output?

Kruk79 commented 5 years ago
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         10.7.1.1        128.0.0.0       UG    0      0        0 tun0
default         192.168.0.1     0.0.0.0         UG    202    0        0 eth0
10.7.1.0        0.0.0.0         255.255.255.0   U     0      0        0 tun0
82.102.19.148   192.168.0.1     255.255.255.255 UGH   0      0        0 eth0
128.0.0.0       10.7.1.1        128.0.0.0       UG    0      0        0 tun0
192.168.0.0     0.0.0.0         255.255.255.0   U     202    0        0 eth0

And below from browser.

This site can’t be reached The web page at https://www.iplocation.net/find-ip-address might be temporarily down or it may have moved permanently to a new web address. ERR_NAME_RESOLUTION_FAILED

When I checked sudo route was exactly the same when using both versions.

morpheusthewhite commented 5 years ago

Issue should be solved, if you find other problems let me know