OpenVPN -auth-user-pass FILE on Windows

If you try to pass OpenVPN username / password from a file using the --auth-user-pass switch, you will receive the following error:

"Sorry, 'Auth' password cannot be read from a file."

At least they are polite.

So, our workaround was to programmatically write "standard in" when we get Auth Username: and Auth Password: (in C #).

Something over time is not 100% more reliable, so I was looking for a way to transfer OpenVPN credentials in another way and came across this message: OpenVPN message

It says that you can recompile the source code with the --enable-password-save option. Could anyone do this?

My last question is: how do I pass the auth username / password to openvpn.exe on the client side? And does OpenVPNGUI do it somehow (maybe we can copy what they do)?

+3
source share
4 answers

It turns out that the problem is not standard.

I used some kind of lock, where if the process went in the middle of writing to standard, there could be a dead end.

There is no problem sending the password this way.

0
source

You can open a VPN connection through a script using the following DOS command (however, this is not recommended as the password is not encrypted)

$openvpn.exe config.ovpn < username < password
+1
source

! param auth-user-pass , GUI "C:\Program Files\OpenVPN\config\name.ovpn"

start_openvpv.cmd(+ "run as admin" ) :

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

name.ovpn, 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
0

Openvpn config.ovpn.

-Go OpenVPN\config .ovpn

- → auth-user-pass password.txt

- password.txt :

yourusername
yourpassword

- openvpn .

-2

Source: https://habr.com/ru/post/1713905/


All Articles