Deprecated: Assigning the return value of new by reference is deprecated in /usr/share/php/HTML/Menu.php on line 228

Strict Standards: Declaration of HTML_Menu3::_findNodeType() should be compatible with HTML_Menu::_findNodeType($nodeId, &$nodeUrl, $level) in /var/www/ on line 49 | OpenVPN, AutoHotkey saves the day. - Putting the fizzle in Wi-Fi since 2005 .. (yes, this was a poor choice for a domain name)

<div class="news_item">#427<div class="news_title">OpenVPN, AutoHotkey saves the day.

Posted by dandriff on Wednesday June 02, 2010@05:13PM

So I really didn't want to remember an insane password to connect to my OpenVPN, and I don't have the luxury of controller the certificate signing, meaning that I can't create a signed key certificate file to use.

Disclaimer: I realize the solution described in this post is not ideal, but IMO it's better than keeping the password in a plain-text file on the desktop (like my boss does).

AutoHotkey can be found here.

AHK Script:

 SetTimer, EnterAuth, 250
 Process, wait, openvpn-gui.exe, 2
 If %ErrorLevel% = 0
 Run, C:\Program Files (x86)\OpenVPN\config\shortcut.lnk
 Sleep, 2000
 IfWinExist OpenVPN - User Authentication
 ControlSetText, Edit1, {USERNAME}, OpenVPN - User Authentication ahk_class #32770
 ControlSetText, Edit2, {PASSWORD}, OpenVPN - User Authentication ahk_class #32770
 ControlSend, Edit1, {Enter}, OpenVPN - User Authentication ahk_class #32770

Where {USERNAME}/{PASSWORD} get replaced by your OpenVPN username and password, and the shortcut.lnk is a shortcut to openvpn with the connect command, i.e.:
 "C:\Program Files (x86)\OpenVPN\bin\openvpn-gui-1.0.3.exe" --connect my-openvpn-config.ovpn

I then compiled the executable and added a scheduled task to run after user logon to run the executable and trigger OpenVPN to launch. It works great.