Giter Club home page Giter Club logo

openconnect-menu-bar's Introduction

openconnect-menu-bar

SwiftBar/xbar plugin to establish VPN connections via OpenConnect and monitor connection status

Credit

Purpose

This script provides a convenient way to control and monitor the OpenConnect VPN connection status from the macOS menu bar using either of these two apps:

Important

This script was only tested with an AnyConnect-based VPN server. It assumes a VPN setup requiring basic login credentials and at most a TOTP/HOTP-based 2FA setup.

Caution

During the setup process (see below), you will be required to save your credentials (meaning password and 2FA seed secret, if applicable) in the macOS keychain.

PROCEED AT YOUR OWN RISK

Screenshots

Connected

Disconnected

Setup

1. Install the latest SwiftBar or xbar release

2. Install dependencies by a method of your choice

Needed are OpenConnect and optionally (depending on VPN server setup) oath-toolkit for 2FA functionality.

Installing can be done e.g. with the homebrew package manager:

brew install openconnect
brew install oath-toolkit

3. Test out the OpenConnect installation manually

Check to see if OpenConnect works out of the box with the provided vpnc-script:
(Change the URL to your own VPN host and also change connection parameters if needed - see here)

sudo openconnect https://vpn.example.tld

If there are errors such as "... is not a recognized network service", see the README in the vpnc-script/ folder of this repo.

4. Download the "openconnect.15s.sh" script and follow the steps inside to customize

  1. Download the file
  2. Open it in a plain text editor or IDE of your choice
  3. Follow all steps in the "CONFIGURATION STEPS" section
  4. Copy/Move it to the SwiftBar/xbar script folder that you or the app chose
  5. Make sure the file is executable: chmod +x openconnect.15s.sh

Miscellaneous tips/tricks and notes

Tip

Hold the ⌥ Option key while clicking on the menu bar entry to bring up SwiftBar options that are hidden by default (only applies to SwiftBar).

Tip

Hold the ⌘ Command key to drag the menu bar entry to the desired spot.

Note

When using SwiftBar, the script (and thus the menu entries) will update itself when the menu bar item is clicked in order to provide an accurate uptime. In case of connection loss, the script (and thus the icon) will update itself after around 15 seconds. Should you want to tweak this value, e.g. because you are using xbar where refresh-on-click is not an available feature or for performance reasons, you can rename the script according to this guide.

openconnect-menu-bar's People

Contributors

niklasbogensperger avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

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.