Monday, 7 November 2005
Alternate OpenVPN OS X DNS updating script
Arjan van der Velde made several valiant attempts to post a shell script that did most of what my Python script did, but there seem to be some issues with the HTML parser in the comments truncating whatever he tried to post.
I’ve posted Arjan’s script; you may prefer it to mine because it doesn’t have the PyObjC/SystemConfiguration wrapper dependencies, though it doesn’t support multiple VPN domains/nameservers. It uses scutil to apply the same changes as my script, unlike the first shell script linked in the comments.
Here are a few minor tweaks I’ve made to my OpenVPN client setup.
First, I start OpenVPN with a zsh function and completion:
vpn () {
title "OpenVPN" "${1:r}"
sudo openvpn --config ~/.openvpn/$1
chpwd
}
compctl -W ~/.openvpn -g '*.conf' vpn
which lets me type vpn <tab> to see a list of the (currently four) networks I can connect to, and the window title will change to OpenVPN:calamity or similar, courtesy of the title function:
title () {
if [[ $TERM = "screen" ]]
then
print -Pn "\ek$1\e\\"
print -Pn "\e]0;$2\a"
elif [[ -n $xterm_prompt ]]
then
print -Pn "\e]0;$1:$2\a"
fi
}
That’s part of another tweak I made a few months ago to get screen titles to be concise yet helpful… I’ll write about that another time.
Second, I added a line under if going_up at the end of acm-client.py to minimize the window once it’s connected:
if going_up: [...] print '\x1b[2t'
That way there’s a very visual cue indicating the VPN connection is established, and I can mouse over the minimized Terminal windows in my Dock to see what VPNs I’m connected to. Not exactly the world’s best UI, but it works.
2:43 PM
3 Comments