Skip to content

Instantly share code, notes, and snippets.

@alext
Last active June 14, 2018 09:50
Show Gist options
  • Save alext/58f3b3d5ff9262b5064f0e90f6bc04bd to your computer and use it in GitHub Desktop.
Save alext/58f3b3d5ff9262b5064f0e90f6bc04bd to your computer and use it in GitHub Desktop.
#!/bin/bash
# vpnc-script wrapper for use with openconnect that Prevents routing DNS over the VPN.
#
# Example usage:
# openconnect https://vpn.example.com/profile --script '/path/to/vpnc-script-no-dns'
unset INTERNAL_IP4_DNS
unset CISCO_DEF_DOMAIN
set +eu
SCRIPT_LOCATIONS="
/etc/vpnc/vpnc-script
/usr/share/vpnc-scripts/vpnc-script
/usr/local/etc/vpnc-script
/opt/boxen/homebrew/etc/vpnc-script
"
for script in $SCRIPT_LOCATIONS; do
if [ -f "${script}" ]; then
. "${script}"
exit 0
fi
done
echo "$0: Cannot locate vpnc-script"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment