Skip to content

Instantly share code, notes, and snippets.

@ronen
Last active October 1, 2015 16:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ronen/7d486adbde5d6bfd2472 to your computer and use it in GitHub Desktop.
Save ronen/7d486adbde5d6bfd2472 to your computer and use it in GitHub Desktop.
convenient wrapper around openconnect
Moved to https://github.com/ronen/vpn
@ronen
Copy link
Author

ronen commented Sep 25, 2015

Wrapper around openconnect that lets you do

$ vpn up [vpn-password]
$ vpn down
$ vpn reset # if your lan connection glitches

Looks for a file named .vpn starting in your current directory and moving up the tree. .vpn should be a yaml file that must contain "server"; other things are arguments to openconnect. e.g.

         server:     vpn.mycompany.com
         usergroup:  OTP
         user:       ronen

Suggestions for improvement welcome!

@tjrivera
Copy link

very cool. thanks for sharing this

@ronen
Copy link
Author

ronen commented Oct 1, 2015

Glad you like it. FYI the new revision dispenses with the directory-search thing, and instead just looks in ~/.vpn -- but now that file can have multiple entries for multiple sites. So the yaml looks like this:

mycompany:
     server:        vpn.mycompany.com
     usergroup:  OTP
     user:           ronen

other:
    server:         remote.othercorp.com
    ...etc...

(Not backwards compatible: even if you have only one you need to give it a name and indent the settings.)

By default it will connect to the first one in the file; otherwise use vpn up <site>.

It also now hides the vpn password when you type it

@ronen
Copy link
Author

ronen commented Oct 1, 2015

Ok, seemed like it may as well be a proper repo rather than updating a gist. Moved it over to https://github.com/ronen/vpn

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment