If you try to pass the username/password to OpenVPN from a file via the --auth-user-pass switch, you get the following error:
"Sorry, 'Auth' password cannot be read from a file."
At least they're polite.
So our workaround was to programmatically write to "standard in" when we get the Auth Username: and Auth Password: prompts (this is in C#).
Something with the timing isn't 100% reliable, so I was looking for a way to pass the credentials to OpenVPN in a different way and came across this post: OpenVPN Post
It says you can recompile the source with a --enable-password-save option. Has anyone been able to do this?
My final question is: How can I pass an auth username/password to openvpn.exe on the client side? And does OpenVPNGUI somehow do this (maybe we can copy what they do)?
NOTE! param auth-user-pass not work if start by GUI "C:\Program Files\OpenVPN\config\name.ovpn"
Made start file start_openvpv.cmd (+ link to with "run as admin") with content:
cd C:\Users\Name\Documents\VPN
"C:\Program Files\OpenVPN\bin\openvpn.exe" --config C:\Users\Name\Documents\VPN\myvpnconfig.ovpn --auth-user-pass "C:\Users\Name\Documents\VPN\pass.txt"
pass.txt:
yourusername
yourpassword
OR put line to name.ovpn, as in upper messege:
auth-user-pass pass.txt
+start_openvpv.cmd:
cd C:\Users\Name\Documents\VPN
"C:\Program Files\OpenVPN\bin\openvpn.exe" --config C:\Users\Name\Documents\VPN\myvpnconfig.ovpn
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With