anyconnect

Re-Writing an OpenConnect VPN Connect script in Babashka

This is the second of a 2-part series of articles.1 It was updated 2021.005.24 to add the :servercert option to the openconnect command. The sundries of just handling arguments and options2 was alone so annoying in Bash that I finally used it as an excuse to play with Babashka3, which I’ve been watching eagerly for quite a while. The script itself is small while providing niceties that would have taken much longer, and also more lines of code, to implement in Bash.

Writing an OpenConnect VPN Connect script in Bash

Bypassing proprietary GUI for VPN connection was a very productive idea, and using OpenConnect to replace the Cisco AnyConnect client which was continually breaking for me proved nice, and provided a nice1 command-line interface to make it scriptable. This is part of a series2 of articles because making something even as trivial as an API wrapper in Bash, gave me a mortifying glimpse of the antiquity of Bash. So after this article, check out the re-work in Babashka, a fast and much better designed interpreter that works as a shell script.