connect/disconnect hooks

Daniel Lenski dlenski at gmail.com
Mon May 17 18:51:26 BST 2021


On Sun, May 16, 2021 at 1:21 AM Anthony Sharobaiko
<anthony.sharobaiko at gmail.com> wrote:
> I'd like to perform certain actions (e.g. mounting vpn-internal NFS
> volumes) after a vpn connection is established. Patching
> vpnc-script/vpn-slice is fine for me, but I'd like to discuss a more
> generic solution - to have either openconnect itself or the companion
> script execute  /etc/openconnect/(dis)?connect-hooks.d/* or something
> similar.

Hi Anthony,
The standard vpnc-script already *has* hooks.

The default directory is /etc/vpnc (for historical reasons), but
otherwise they pretty much match what you're looking for here, I
think: https://gitlab.com/openconnect/vpnc-scripts/blob/master/vpnc-script#L1128-1160

> Or is there a better solution?

If you're using NetworkManager, it doesn't call the standard
vpnc-script, so you would need to add the scripts to a NetworkManager
dispatcher script, instead:
https://man.archlinux.org/man/NetworkManager.8#DISPATCHER_SCRIPTS

David Woodhouse gives an example of such a script here:
https://bugzilla.gnome.org/show_bug.cgi?id=794190#c3

-Dan



More information about the openconnect-devel mailing list