vlaci / openconnect-sso

Wrapper script for OpenConnect supporting Azure AD (SAMLv2) authentication to Cisco SSL-VPNs
GNU General Public License v3.0
280 stars 119 forks source link

Allow configuring a command to be automatically run when disconnecting from VPN #32

Closed jherland closed 3 years ago

jherland commented 3 years ago

I configure my SSH with ControlMaster connections that must be closed when I disconnect from VPN, otherwise they are left stale and existing and future SSH session are left hanging/wedged.

To accomodate this, the last patch in this series teaches openconnect-sso automatically run a configured command on VPN disconnection. In my case, I run a shell script that does ssh -O exit ... on my connections, although this doesn't matter from openconnect-sso's POV.

Otherwise the other patches are only tangentially related:

FWIW, I also have the same series rebased onto the develop branch in my fork.

vlaci commented 3 years ago

Very nice! I'd very much like to keep python 3.6 compatibility as I know a bunch of folks who still use it.

vlaci commented 3 years ago

It may not worth to run openconnect on the event loop. A traditional subprocess.run call may suffice. This would work around the quirks of asyncio in 3.6.

jherland commented 3 years ago

Yes, AFAICS we simply run openconnect at the end, and there's no concurrency or real asynchronicity remaining at that point, so it should be fairly straightforward to "leave" async mode before then.

jherland commented 3 years ago

Superseded by https://github.com/vlaci/openconnect-sso/pull/33

vlaci commented 3 years ago

You may force push to the existing branch you prepared the PR from, it automatically updates the PR itself. No need to create new pull requests in such cases.