Script is undermined by background mode
I find that when I invoke openconnect with --background
, the --script
argument can become ineffective. I run this with vpn-slice, which is supposed to update my hosts file, and every time that I use --background
, my hosts file receives no update.
sudo openconnect \
--background \
--protocol=anyconnect \
--user=Myself \
--script "vpn-slice --verbose --dump 10.0.0.0/8 hostname1 hostname2" \
vpn.example.com
System details
OS: Ubuntu 22.04.3 LTS
OpenConnect version v8.20-1
Using GnuTLS 3.7.3. Features present: TPMv2, PKCS#11, RSA software token, HOTP software token, TOTP software token, Yubikey OATH, System keys, DTLS, ESP
Supported protocols: anyconnect (default), nc, gp, pulse, f5, fortinet, array
Default vpnc-script (override with --script): /usr/share/vpnc-scripts/vpnc-script
Redirecting stderr
I initially reported this as an issue on vpn-slice, but it appears as if this is an openconnect issue. When I redirect stderr, only then does the intended behaviour appear: openconnect moves to the background and my hosts file gets updated.
2>/dev/null sudo openconnect \
--background \
--protocol=anyconnect \
--user=Myself \
--script "vpn-slice --verbose --dump 10.0.0.0/8 hostname1 hostname2" \
vpn.example.com