Coder Social home page Coder Social logo

pocc / merlink Goto Github PK

View Code? Open in Web Editor NEW
3.0 3.0 1.0 1.53 MB

This program will connect desktop clients to Meraki firewalls

License: Apache License 2.0

Python 82.09% Makefile 2.02% PowerShell 2.65% Shell 9.02% NSIS 3.68% Batchfile 0.55%
l2tp networking pyqt5 python3 vpn vpn-client

merlink's Introduction

Hi there ~ hi

This is the place where I share what I build and break, where I have fun.

Languages and Tools

merlink's People

Contributors

hagemt avatar pocc avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

hagemt

merlink's Issues

Create a mac .dmg or .pkg

Create a mac .dmg

Problem statement

We need to package the files for macOS in a way that's portable.

Join main program to linux VPN script

Join main program to linux VPN script

Problem statement

Currently, we have a linux VPN script that works in isolation as well as the VPN GUI. It should be trivial to pass variables from the program to the linux script using Popen or similar.

Systray Behavior

Systray behaviors

  • Minimize app into systray when connected
  • Change systray icon when connected
  • Systray as separate class and file so that it can be called independently of main program (i.e. on startup)

Package linux version as deb and .tar.gz

Package linux version as deb and .tar.gz

  • Currently working on making a linux version as deb and .tar.gz
  • Getting a .tar.gz should be trivial
  • Making a deb is dependent on getting --onefile to work as part of pyinstaller (#37)

When quit from the dock, Merlink says it's minimized now

Problem

When quit from the Mac's dock, Merlink says it's minimized and the notification lasts 1s. It's clearly quitting and the notification is wrong.

Troubleshooting direction

  • This is likely related to tray behavior which is somehow interfacing wrong with the exit button
  • Note that this only happens when in the main application (when the tray is active), and not during login window popup

merlink.py reports successful connection on failure

Merlink reports successful connection on failure

Problem statement

The powershell script correctly identifies that an error has occurred but returns 0 instead of 1.

Proposed solution

Requires troubleshooting. This likely has something to do with the way that subprocess.call returns a value.

All linux VPN connections start with 'vpn-'

Problem

All linux VPN connections start with 'vpn-' using nmcli, regardless of what vpn_name is used.

Description

  • This issue needs more data

Questions

  • For a list of connections, do we see the L2TP connections prepended with 'vpn-'?
  • Does this occur on any other type of nmcli vpn connections?
  • Is it possible to get around this bug by renaming the connection after creation?

Create windows executable

On linux, command to build with cx_freeze
./venv/bin/python3 setup.py build
But it's going to diff on Windows

Verify that the Windows executable works as well

Validation Tests

Finish basic validation tests that verify that simple mistakes have not been made.

MerLink CLI

Command line interfaces

Trigger if more arguments than argv[0] are specified on the command line (i.e. merlink -h triggers CLI where merlink launches the GUI). Planning on using argparse to achieve this.

CLI

Option 1: Organization + Network IDs

merlink --username <username> --password <password> --org-id <org-id> --network-id <network-id>

Option 2: Organization + Network Names

merlink --username <username> --password <password> --org-name <org-name> --network-name <network-name>

Option 3: Manual

This will not use dashboard at all and is a wrapper for the OS-dependent connect script. All parameters listed are required for a manual configuration.
merlink --username <username> --password <password> --address <address> --psk <psk> --vpn-name <vpn-name>

TUI

Option 1: User selects organization and network where firewall resides to connect

  1. Which org? > User selects
  2. Which network? > User selects
  3. Create vpn connection and connect

macOS: Successful connection isn't registered

Problem name

macOS: Successful connection isn't registered

Problem

  • Successful connection is not registered in status bar (we still see "Connecting...")
  • No notification that a connection is successful
  • Miles doesn't change icon upon successful/unsuccessful connection

Proposed Solution

Add a section after connected status is confirmed

Travis-generated .deb packages fail to start

Problem

  • Travis-generated .deb packages fail to start
  • This is on both 0.7.3 and 0.8
  • Build made by hand at 0.7 works fine

Evidence

0.8 travis build#111 (fa8bd5e)

https://travis-ci.org/pocc/merlink/builds/400353842

0.7.3 travis build#103 (ecd31ca)

https://travis-ci.org/pocc/merlink/builds/399901479

Error output when starting merlink on both 0.7.3 and 0.8

Traceback (most recent call last):
File "merlink/merlink.py", line 11, in
File "/home/travis/virtualenv/python3.6.3/lib/python3.6/site-packages/PyInstaller/loader/pyimod03_importers.py", line 714, in load_module
ModuleNotFoundError: No module named 'PyQt5.sip'
[13326] Failed to execute script merlink

Firmware/hardware

Testing on virtual machine: Ubuntu 18.04

Analysis

  • As merlink is looking for something in the virtualenv referencing a travis directory, there's probably something hardcoded that shouldn't be

PyInstaller doesn't bundle ps1 script or images

Error when I try to connect (in cmd):

C:\merlink\dist\scripts\connect_windows.ps1 : The term
'C:\merlink\dist\scripts\connect_windows.ps1' is not recognized as the name of a cmdlet, function, script
file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct
and try again.

Failed to load modules prior to linux merlink start

Problem

  • Failed to load modules prior to linux merlink start
  • merlink 0.7
  • Doesn't prevent merlink from starting or cause any other type of problem

Rationale

  • Documenting these errors here even if they're innocuous

Evidence

Error output

'g_io_module_load': /usr/lib/x86_64-linux-gnu/gio/modules/libgiolibproxy.so: undefined symbol: g_io_module_load
Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/libgiolibproxy.so
'g_io_module_load': /usr/lib/x86_64-linux-gnu/gio/modules/libgiognomeproxy.so: undefined symbol: g_io_module_load
Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/libgiognomeproxy.so
'g_io_module_load': /usr/lib/x86_64-linux-gnu/gio/modules/libgiognutls.so: undefined symbol: g_io_module_load
Failed to load module: /usr/lib/x86_64-linux-gnu/gio/modules/libgiognutls.so

Add docstrings to all classes/methods

Background

  • PEP257 requires that docstrings be the first thing that comes after classes/methods
  • I would like to have something that can compile to readthedocs.io

Problem

  • I want my code to be better documented inline

Solution

  • Use Sphinx (there are other solutions like pydoc and doxygen, but best to choose)
  • More information to get started with sphinx can be found here

Error if not connected to internet

Immediately fail if device is not online

Problem

If users don't have a working internet connection, they're wasting time by trying to use this program as this is a requirement for VPN.

Proposed Solution

  1. Before calling the login window class, check whether there is a working internet connection
  2. If there is not, create a QMessageBox with a critical icon and error message
  3. This QMessageBox's only option should be to press a button with text "Quit"
  4. Hitting the quit button should exit the program

Version info

  • Using on Windows 10 (but the UI is cross-platform)
  • Target version: Merlink v0.2.1
  • Treat this as a patch and increment patch by one if this is resolved

Notes

  • We have not gotten to MVP, so if you submit a pull request that addresses an issue and doesn't break anything, it will be merged.
  • QNetworkConfigurationManager has isOnline(), which will help achieve this, but so can pings/nslookups or OS-dependent code.

Make an Installer

Create an installer that will put the settings and core files in the correct place (according to OS)

Linux Mint incompatibility

Linux Mint incompatibility

Problem - Mint 18.3 - Failure

This error is shown in the GUI after attempting to connect for VPN connection named vpn-l2tp:
The VPN connection 'vpn-l2tp' failed because the VPN service failed to start

Log debug and error info to file

Problem

  • Currently print statements are used to log information to the console.
  • This is a GUI application so when deployed, there is no console.
  • Debugging is harder when the GUI application fails.

Solution

  • Use the python logging library
  • Info on how to implement this can be found here

Get pyinstaller --onefile to work with internal directories

Get pyinstaller --onefile to work with internal directories

Problem Statement

Currently pyinstaller --onefile will successfully create a single binary with everything in it, but won't contain directories internal to the binary that are required for the script. Specifically, images seem to be affected.

Proposed solution

Looks like this is a known issue

TFA for dashboard login

TFA for dashboard login

Problem statement

Some administrators use TFA. Those that do won't be able to use this program unless TFA support is implemented.

Potential Solution

Add a QDialog window popup when TFA is encountered. Use the same submit system that hitting the login_window's "login" button has.

Version info

  • Targets latest Merlink (0.3.0+)

Verify that value we're scraping is actually primary IP address

While I'm using the IP address I find at '{"public_ip":' in the HTML, I'm not sure it's actually the primary.
Edge cases that need to be tested:

  • Virtual IPs (almost sure it will fail here)
  • Warm spare (no virtual IP)
  • Multiple uplinks, WAN1 primary
  • Multiple uplinks, WAN2 primary

If Merlink is already running, don't create another instance

If Merlink is already running, don't create another instance

Problem statement

As Merlink will often hide in the background once you've closed it, you can have many instances of Merlink open in the taskbar

Proposed solution

  • When opening another instance of Merlink, show an error message indicating that it's already open
  • Hitting ok for this prompt should close the window
  • Once that window closes, the existing Merlink window should come into focus from tray icon

Linux executable is 452M

This is likely due to cx_freeze globbing many libraries that aren't necessary.

To build, use this command from project root:
./venv/bin/python3 setup.py build
./venv/bin/python3 can be replaced with whichever python3

Ability to split tunnel

Components

  • Prefences QCheckBox for Split Tunnel, which is stored in a variable
  • split_tunnel bool is passed to powershell script as argument
  • Powershell Script. In Powershell, there is a Split-Tunneling flag that can be used for this.
  • Verify that it works after building

macOS .dmg fails to use VPN bash scripts

  • Using the unpackaged files generated by PyInstaller works fine though.
  • Part of this may be that when it's installed to /Applications, it's limited by the OS on what it can od.
  • This may require logging to a file because windowed applications don't have console output.

Preferences Dialog

QDialog for set-vpnconnection options as well as linux and mac ones that keeps track of all VPN options

macOS native app

Should have the same functionality as Windows app (Preferences will have some same, some different functionality)

macOS : Don't duplicate VPN connections

macOS : Don't duplicate VPN connections

Problem Statement

scutil and networksetup will fail if there are multiple VPN connections with the same name.

Proposed Solution

  • If there is a VPN with the planned VPN name, don't create a new one
  • If there are multiple VPN connections with the same name, throw an error and quit to main menu
  • Otherwise create the VPN connection

Main window should minimize on success

Main window should minimize on success

Problem statement

If a user successfully connects, they no longer need to see VPN options

Proposed solution

  1. When success is detected, minimize the window

Version info

  • Targets Merlink v0.2.x
  • Currently only testing on Windows 10

Icons don't load

None of the images or icons load.
This is probably related to the usage of relative paths.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.